Re: [Mesa-dev] [PATCH 07/18] egl: add Android-specific extensions

2011-08-17 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Reviewed-by: Chad Versace c...@chad-versace.us

On 08/16/2011 11:28 PM, Chia-I Wu wrote:
 Add EGL_ANDROID_image_native_buffer and EGL_ANDROID_swap_rectangle.
 There is no spec for them though.
 ---
  include/EGL/eglext.h  |   14 ++
  src/egl/main/eglapi.c |   25 +
  src/egl/main/eglapi.h |8 
  src/egl/main/egldisplay.h |3 +++
  src/egl/main/eglmisc.c|3 +++
  5 files changed, 53 insertions(+), 0 deletions(-)
 
 diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
 index 9915b8c..0449ae2 100644
 --- a/include/EGL/eglext.h
 +++ b/include/EGL/eglext.h
 @@ -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
  }
 diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
 index 5d186c6..3cb1a5b 100644
 --- a/src/egl/main/eglapi.c
 +++ b/src/egl/main/eglapi.c
 @@ -948,6 +948,9 @@ eglGetProcAddress(const char *procname)
{ eglBindWaylandDisplayWL, (_EGLProc) eglBindWaylandDisplayWL },
{ eglUnbindWaylandDisplayWL, (_EGLProc) eglUnbindWaylandDisplayWL },
  #endif
 +#ifdef EGL_ANDROID_swap_rectangle
 +  { eglSetSwapRectangleANDROID, (_EGLProc) eglSetSwapRectangleANDROID 
 },
 +#endif
{ NULL, NULL }
 };
 EGLint i;
 @@ -1565,3 +1568,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
 diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h
 index 4fcbe40..1e0aef6 100644
 --- a/src/egl/main/eglapi.h
 +++ b/src/egl/main/eglapi.h
 @@ -131,6 +131,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
   */
 @@ -210,6 +214,10 @@ struct _egl_api
 BindWaylandDisplayWL_t BindWaylandDisplayWL;
 UnbindWaylandDisplayWL_t UnbindWaylandDisplayWL;
  #endif
 +
 +#ifdef EGL_ANDROID_swap_rectangle
 +   SetSwapRectangleANDROID_t SetSwapRectangleANDROID;
 +#endif
  };
  
  #endif /* EGLAPI_INCLUDED */
 diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
 index f0815d0..cddea80 100644
 --- a/src/egl/main/egldisplay.h
 +++ b/src/egl/main/egldisplay.h
 @@ -108,6 +108,9 @@ struct _egl_extensions
  
 EGLBoolean NOK_swap_region;
 EGLBoolean NOK_texture_from_pixmap;
 +
 +   EGLBoolean ANDROID_image_native_buffer;
 +   EGLBoolean ANDROID_swap_rectangle;
  };
  
  
 diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c
 index da189b6..ab48bc6 100644
 --- a/src/egl/main/eglmisc.c
 +++ b/src/egl/main/eglmisc.c
 @@ -113,6 +113,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
  }
  

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOS/vDAAoJEAIvNt057x8i4hgP/RQyZexlxPFCeCPkKRXvlg4l

Re: [Mesa-dev] [PATCH 09/18] android: build libGLES_mesa

2011-08-17 Thread Chad Versace
 line is misleading. It implies that the build system is intended 
only for Gallium.
Very soon the build system will also build non-Gallium drivers.

 +
 +LOCAL_PATH := $(call my-dir)
 +
 +MESA_PYTHON2 := python
 +
 +MESA_TOP := $(LOCAL_PATH)
 +DRM_TOP := external/drm
 +DRM_GRALLOC_TOP := hardware/drm_gralloc
 +
 +MESA_COMMON_MK := $(MESA_TOP)/Android.common.mk
 +
 +SUBDIRS := \
 + $(LOCAL_PATH)/src/gallium/Android.mk

The gallium subdir should only be added if MESA_BUILD_GALLIUM is true.

 +
 +MESA_GPU_DRIVERS := $(BOARD_GPU_DRIVERS)
 +
 +classic_drivers :=
 +gallium_drivers := swrast
 +
 +# warn about invalid drivers
 +invalid_drivers := $(filter-out \
 + $(classic_drivers) $(gallium_drivers), $(MESA_GPU_DRIVERS))
 +ifneq ($(invalid_drivers),)
 +$(warning invalid GPU drivers: $(invalid_drivers))
 +# tidy up
 +MESA_GPU_DRIVERS := $(filter-out $(invalid_drivers), $(MESA_GPU_DRIVERS))
 +endif
 +
 +# host and target must be the same arch to generate matypes.h
 +ifeq ($(TARGET_ARCH),$(HOST_ARCH))
 +MESA_ENABLE_ASM := true
 +else
 +MESA_ENABLE_ASM := false
 +endif
 +
 +ifneq ($(filter $(gallium_drivers), $(MESA_GPU_DRIVERS)),)
 +MESA_BUILD_GALLIUM := true
 +else
 +MESA_BUILD_GALLIUM := false
 +endif
 +
 +ifneq ($(strip $(MESA_GPU_DRIVERS)),)
 +include $(SUBDIRS)
 +endif

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOTAJ4AAoJEAIvNt057x8ilcAP/0wvxg/hUFAE/96bCsSDFjsB
5pl7KdyGpV7UyS71gpTSa/+P79zXRFqLb7+eXNTkApIyVn4G6XhDmhzaU0oLVlGT
Y/HFN3rX61ouzdoUQ9vJ2DhagL/fD3sLNEtb4Ly760i+Ek/sownADABIj2fI1qSr
H26XluLv5zRfTgxjJHo+MBsRvYbyme+Y34/ePVDjDkyUhBMiIP0IInBDLrUGWdEy
0O7FDJ8ANRW6inZhboYY4uh/SPU/QwTRmFtUdNz3gvX7ZqL1QC1wZAGmAE33HUDC
xy3hRyCA5rWQ1OPfPalwwvfwijZ4z9F2/WM5TU/Pm3gUEmiBFFDNq/BnFqzG1ccn
eGbjtmdlo7MLvK8ol5ImAcv5C4GMRUysmz8AOKsKgpYegrnmCWZwxXuG5OOcQUoC
Szeiy8T34ZcMcNO778YrKGTKE7pBlVAb1BxCL5J5Czsxn1IYLXMKYOJIzRloUMPA
xVMwHAhORcJ6cvqbirL812PIVKUkBqYRovtrAB7HUiGFipMTb7h6pCsUzODNspbq
DWq2+Rp9WE5lYzbOrZ3EeB8fWu8DW9cF0SBuffahtOoPQGb9xhGOka1Zp9rigMVu
PZsISoOR/A2qbQnnbqTcHBL1SBtSXABBWhyPrR923pGpZGyEMCBJ9RXymBIUgHyB
o6hWE3k/EiSVkfI5i7nr
=qXo/
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 14/18] android: build core EGL

2011-08-17 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

The version tag in the copyright header should be removed. But, either way, 
this is
Reviewed-by: Chad Versace c...@chad-versace.us

On 08/16/2011 11:28 PM, Chia-I Wu wrote:
 This builds the static library libmesa_egl from core EGL.
 ---
  Android.mk |1 +
  src/egl/Android.mk |   66 
 
  2 files changed, 67 insertions(+), 0 deletions(-)
  create mode 100644 src/egl/Android.mk
 
 diff --git a/Android.mk b/Android.mk
 index 8da5120..0315b8e 100644
 --- a/Android.mk
 +++ b/Android.mk
 @@ -42,6 +42,7 @@ DRM_GRALLOC_TOP := hardware/drm_gralloc
  MESA_COMMON_MK := $(MESA_TOP)/Android.common.mk
  
  SUBDIRS := \
 + $(LOCAL_PATH)/src/egl/Android.mk \
   $(LOCAL_PATH)/src/gallium/Android.mk
  
  MESA_GPU_DRIVERS := $(BOARD_GPU_DRIVERS)
 diff --git a/src/egl/Android.mk b/src/egl/Android.mk
 new file mode 100644
 index 000..16504c1
 --- /dev/null
 +++ b/src/egl/Android.mk
 @@ -0,0 +1,66 @@
 +# Mesa 3-D graphics library
 +# Version:  7.12
 +#
 +# Copyright (C) 2010-2011 Chia-I Wu olva...@gmail.com
 +# Copyright (C) 2010-2011 LunarG Inc.
 +#
 +# Permission is hereby granted, free of charge, to any person obtaining a
 +# copy of this software and associated documentation files (the Software),
 +# to deal in the Software without restriction, including without limitation
 +# the rights to use, copy, modify, merge, publish, distribute, sublicense,
 +# and/or sell copies of the Software, and to permit persons to whom the
 +# Software is furnished to do so, subject to the following conditions:
 +#
 +# The above copyright notice and this permission notice shall be included
 +# in all copies or substantial portions of the Software.
 +#
 +# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 +# 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.
 +
 +# Android.mk for EGL
 +
 +LOCAL_PATH := $(call my-dir)
 +
 +# 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
 +
 +include $(CLEAR_VARS)
 +
 +LOCAL_SRC_FILES := \
 + $(addprefix main/, $(SOURCES))
 +
 +LOCAL_CFLAGS := \
 + -D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_ANDROID \
 + -D_EGL_DRIVER_SEARCH_DIR=\/system/lib/egl\ \
 + -D_EGL_OS_UNIX=1
 +
 +ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
 +LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_GALLIUM
 +endif
 +
 +LOCAL_MODULE := libmesa_egl
 +
 +include $(MESA_COMMON_MK)
 +include $(BUILD_STATIC_LIBRARY)

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOTANPAAoJEAIvNt057x8invUP/1Yx30jwjSc4rsSE6nJr+KcZ
ka3aXSEY4v0uKAKRXNDqcU1WA0YjLA68/ds/uKbB1VN+N1/IwMTpIa2xvIZKZF6V
ExVfGkSzsu2rjK/oVVvaavNLAhhst3kB72C+BNJ6lC/GT6lHg6J7U7IFWSW8g+vv
mx+NWYCdIP8Gy2kaitbPkpaXV91yMI8DkzBY3GPsAAKhCPY7/QT/CJDVhu3l28h+
RMaVtIni8PwDh+jFZB0rQzs7Gp7JVtSReTzqoeXyYZSzdiz0GWATxBQZ8Nqlatc3
VjlZ9sMNj4IvRsCh82UjGVc86a5T+UkGtWo736m9Ral02kqBx6os//Bk6aNBs4Ax
abVvAvAJ4SJBOTy/ya16cMFiXTE7+BRDRMUNYAp5+IAkliSogEDm8+ih5EkVt6qK
6WdIvrlrJfmWfH+B40L2/a/wLu2Du6bWh7mb3NeRKY9wcc6WhiYUrqpLG6W+7ZPs
QnkJdyx4Zx9tjkNnnQCnWFkYU5az917tOPJpNaIB0AM0rCkELpoB0N+BYyzBgc8t
v1uW2ey2TRk0LToKjab34PHFQJ6Im/8r8ptKwNO9MRRPyF1txj3WK25Ql5LLsZcQ
oPzmRdG3iuAhJbwpQbEufg1RPj2zBNsoK9oR8KDCVeAScapahIsCLhfiTWsF0+K+
gTaFCkW5rOx567eFI/NC
=kuDU
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 15/18] android: build core mesa

2011-08-17 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Overall this looks good, but some of it I don't follow. I trust that you're 
doing
the right thing for those parts.

Acked-by: Chad Versace c...@chad-versace.us

On 08/16/2011 11:28 PM, Chia-I Wu wrote:
 This builds the static library libmesa_st_mesa from core mesa.
 ---
  Android.mk  |1 +
  src/mesa/Android.gen.mk |  106 
 +++
  src/mesa/Android.mk |   76 +
  3 files changed, 183 insertions(+), 0 deletions(-)
  create mode 100644 src/mesa/Android.gen.mk
  create mode 100644 src/mesa/Android.mk
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOTAe0AAoJEAIvNt057x8ijmAP/38WwAcRbIwwur/N8emZTdj2
+qd1J8n+URfp5QN3heQwhtgkObi+tDBHXVTRTd6T0NvLaJh6pV159xkD6IHzjRd9
8Y0bYsBQ2TcvfVa6P4Zfaq2fCgJVnqiuToPbiT7sRbIa2fKGvnvGwEEkl//W3rwK
Q3bCe2TrW6f+PW7pI6J4EKnxLHDn8jL3SwC4CVKOMDvYPRj+VUmF/DFhyHFboXxw
PPDMAFMZXtwOV8WQuKoHLjuvXc0JNBI6SD+xjkPUODx9r3lJ7+RzheQHcqAaOFEV
WNzD2OIenSO3JfhUv5LQYikoTjcK66YINA+MhH2rj1VZSem5ivjw0GbyS1L4+pyI
CSb3CoBfTmRFlOncLgv4wNf9E7dWCiPIm98kDfiZAyVSeepFcZIcoB0JD5KzIpIS
6OCsvQSaRhwAh7Z2sAa35ScC8eDZ8YVj41qI5qKQSA8DMhWuvrNQhD16HQJHKd/o
30YQ2sZbVD6/jQEK3YnJo+eoEi9awxnBiuWPQQpfGF5DMQuMb0EPy1ENxXBXSg2b
rWIRl7bLb5luWBkInUcPznP5oBxVLm2NF4BIQxr8rsVPM3uNBcjdqgSah+db/1+H
XrUvaWm9fmTtA7kb35cwzccBZAWcNSaIsF1+bd2ubzUbl1Fcl5Wl8QRCQfmQg/ri
7/jqo5k3Zv8gur2ubjD6
=sy1K
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 17/18] android: build shared glapi

2011-08-17 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Reviewed-by: Chad Versace c...@chad-versace.us

On 08/16/2011 11:28 PM, Chia-I Wu wrote:
 This builds the shared library libglapi from shared glapi.
 ---
  Android.mk  |1 +
  src/mapi/Android.mk |   61 
 +++
  2 files changed, 62 insertions(+), 0 deletions(-)
  create mode 100644 src/mapi/Android.mk
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOTA6gAAoJEAIvNt057x8iJJQP/1lxq0qXV6xYpqyyn2W1/w4D
wphXOvScbhlMqhsFzNiY8clbgyPYZZQtGhOCO2AnIy3Fw8beUfaWTHo3WGq8rnSO
tXWwGMUw7B6lqggb6eiANJxmULD7PUsRk0xxj0UKFso6TUV4nH2JKdOBU77C7pVA
2ZWeCHFwDbzBstYbAH9nQA8zPqM/nO9qeUsXiuOOaTIpiA2TPohneBlZzo085ysd
A7CVwuUA37S2rtNNWYB6wH25XpxnbOLpVUheBJjKWtFCYdBMG0yNk04FyfZMNGom
XjJqVFjbdDnVkhGv1H1Y6myjzsSSwRvXAFTDWVlbnpmjUp7ZxICSerm6mM9OkhZr
+wIMKvDLtE5al1cE7RC3CUS76nV59ZkdFbTYPgk7AAH2M4PLea35RzKU946iwlTN
HfHYcD9JGJ6G78IADGJ16+hR5e9vkR8v0v85/mdLl/n49ZANLgbaKknsG0nVA3UA
RyEhbyYrCFYkudcvdm6YPWNmv1tRAwclEz2D77plxwfY/b730KdNGQnjGuL5822u
vptbr+Y6uKj0Uc/xT0V7nYuCj8k34Naf5F4chXYgO0g68bMDDETz8JDkS0LVD9w+
M3VyeAMee6QFzB7IdqyH++fVZC1kGHdr/LUrgyciI/rUHIXWeT+uHzcc2pyAB22/
9I2HvYY8XLNk2GCOv43g
=TiKg
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 16/18] android: build glsl

2011-08-17 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/16/2011 11:28 PM, Chia-I Wu wrote:
 This builds the static library libmesa_glsl and executable glsl_compiler
 from glsl.  glsl_compiler is only installed for engineering build.
 ---
  Android.mk  |1 +
  src/glsl/Android.gen.mk |   73 +
  src/glsl/Android.mk |  161 
 +++
  src/mesa/Android.mk |   25 +++
  4 files changed, 260 insertions(+), 0 deletions(-)
  create mode 100644 src/glsl/Android.gen.mk
  create mode 100644 src/glsl/Android.mk
 
 diff --git a/Android.mk b/Android.mk
 index 0dc8fe1..f05d54f 100644
 --- a/Android.mk
 +++ b/Android.mk
 @@ -42,6 +42,7 @@ DRM_GRALLOC_TOP := hardware/drm_gralloc
  MESA_COMMON_MK := $(MESA_TOP)/Android.common.mk
  
  SUBDIRS := \
 + $(LOCAL_PATH)/src/glsl/Android.mk \
   $(LOCAL_PATH)/src/mesa/Android.mk \
   $(LOCAL_PATH)/src/egl/Android.mk \
   $(LOCAL_PATH)/src/gallium/Android.mk
 diff --git a/src/glsl/Android.gen.mk b/src/glsl/Android.gen.mk
 new file mode 100644
 index 000..61b2e4d
 --- /dev/null
 +++ b/src/glsl/Android.gen.mk
 @@ -0,0 +1,73 @@
 +ifeq ($(LOCAL_MODULE_CLASS),)
 +LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 +endif
 +
 +intermediates := $(call local-intermediates-dir)
 +
 +sources := \
 + glsl_lexer.cpp \
 + glsl_parser.cpp \
 + glcpp/glcpp-lex.c \
 + glcpp/glcpp-parse.c
 +
 +ifneq ($(LOCAL_IS_HOST_MODULE),true)
 +sources += builtin_function.cpp
 +endif
 +
 +LOCAL_SRC_FILES := $(filter-out $(sources), $(LOCAL_SRC_FILES))
 +
 +LOCAL_C_INCLUDES += $(intermediates) $(intermediates)/glcpp 
 $(MESA_TOP)/src/glsl/glcpp
 +
 +sources := $(addprefix $(intermediates)/, $(sources))
 +LOCAL_GENERATED_SOURCES += $(sources)
 +
 +define local-l-or-ll-to-c-or-cpp
 + @mkdir -p $(dir $@)
 + @echo Mesa Lex: $(PRIVATE_MODULE) = $
 + $(hide) $(LEX) --nounistd -o$@ $
 +endef
 +
 +define local-y-to-c-and-h
 + @mkdir -p $(dir $@)
 + @echo Mesa Yacc: $(PRIVATE_MODULE) = $
 + $(hide) $(YACC) -o $@ $
 +endef
 +
 +define local-yy-to-cpp-and-h
 + @mkdir -p $(dir $@)
 + @echo Mesa Yacc: $(PRIVATE_MODULE) = $
 + $(hide) $(YACC) -p _mesa_glsl_ -o $@ $
 + touch $(@:$1=$(YACC_HEADER_SUFFIX))
 + echo '#ifndef '$(@F:$1=_h)  $(@:$1=.h)
 + echo '#define '$(@F:$1=_h)  $(@:$1=.h)
 + cat $(@:$1=$(YACC_HEADER_SUFFIX))  $(@:$1=.h)
 + echo '#endif'  $(@:$1=.h)
 + rm -f $(@:$1=$(YACC_HEADER_SUFFIX))
 +endef
 +
 +$(intermediates)/glsl_lexer.cpp: $(LOCAL_PATH)/glsl_lexer.ll
 + $(call local-l-or-ll-to-c-or-cpp)
 +
 +$(intermediates)/glsl_parser.cpp: $(LOCAL_PATH)/glsl_parser.yy
 + $(call local-yy-to-cpp-and-h,.cpp)
 +
 +$(intermediates)/glcpp/glcpp-lex.c: $(LOCAL_PATH)/glcpp/glcpp-lex.l
 + $(call local-l-or-ll-to-c-or-cpp)
 +
 +$(intermediates)/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glcpp/glcpp-parse.y
 + $(call local-y-to-c-and-h)
 +
 +BUILTIN_COMPILER := 
 $(BUILD_OUT_EXECUTABLES)/mesa_builtin_compiler$(BUILD_EXECUTABLE_SUFFIX)
 +
 +builtin_function_deps := \
 + $(LOCAL_PATH)/builtins/tools/generate_builtins.py \
 + $(LOCAL_PATH)/builtins/tools/texture_builtins.py \
 + $(BUILTIN_COMPILER) \
 + $(wildcard $(LOCAL_PATH)/builtins/profiles/*) \
 + $(wildcard $(LOCAL_PATH)/builtins/ir/*)
 +
 +$(intermediates)/builtin_function.cpp: PRIVATE_SCRIPT := $(MESA_PYTHON2) 
 $(LOCAL_PATH)/builtins/tools/generate_builtins.py
 +$(intermediates)/builtin_function.cpp: $(builtin_function_deps)
 + @mkdir -p $(dir $@)
 + @echo Gen GLSL: $(PRIVATE_MODULE) = $(notdir $@)
 + $(hide) $(PRIVATE_SCRIPT) $(BUILTIN_COMPILER)  $@ || rm -f $@
 diff --git a/src/glsl/Android.mk b/src/glsl/Android.mk
 new file mode 100644
 index 000..5f0c83c
 --- /dev/null
 +++ b/src/glsl/Android.mk
 @@ -0,0 +1,161 @@
 +# Mesa 3-D graphics library
 +# Version:  7.12

Again, this version tag should be removed.

 +#
 +# Copyright (C) 2010-2011 Chia-I Wu olva...@gmail.com
 +# Copyright (C) 2010-2011 LunarG Inc.
 +#
 +# Permission is hereby granted, free of charge, to any person obtaining a
 +# copy of this software and associated documentation files (the Software),
 +# to deal in the Software without restriction, including without limitation
 +# the rights to use, copy, modify, merge, publish, distribute, sublicense,
 +# and/or sell copies of the Software, and to permit persons to whom the
 +# Software is furnished to do so, subject to the following conditions:
 +#
 +# The above copyright notice and this permission notice shall be included
 +# in all copies or substantial portions of the Software.
 +#
 +# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 

Re: [Mesa-dev] [PATCH 18/18] android: make libGLES_mesa real

2011-08-17 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Acked-by: Chad Versace c...@chad-versace.us

On 08/16/2011 11:28 PM, Chia-I Wu wrote:
 libGLES_mesa with swrast should link in these libraries
 
   libmesa_egl
   libmesa_st_egl
   libmesa_st_mesa
   libmesa_glsl
   libmesa_glsl_utils
   libmesa_pipe_softpipe
   libmesa_winsys_sw_android
   libmesa_gallium
 ---
  Android.mk|   11 ++
  src/gallium/targets/egl-static/Android.mk |   54 
 +
  2 files changed, 65 insertions(+), 0 deletions(-)
 
 diff --git a/Android.mk b/Android.mk
 index 5a4e133..5e4c09d 100644
 --- a/Android.mk
 +++ b/Android.mk
 @@ -29,6 +29,17 @@
  #
  # The main target is libGLES_mesa.  There is no classic drivers yet.
  #
 +# Gallium drivers depend on
 +#
 +#   libmesa_egl
 +#   libmesa_st_egl
 +#   libmesa_st_mesa
 +#   libmesa_glsl
 +#   libmesa_glsl_utils
 +#   libmesa_pipe_DRIVER
 +#   libmesa_winsys_DRIVER
 +#   libmesa_gallium
 +#
  # The rules can be found in src/gallium/targets/Android.mk.
  
  LOCAL_PATH := $(call my-dir)
 diff --git a/src/gallium/targets/egl-static/Android.mk 
 b/src/gallium/targets/egl-static/Android.mk
 index e62fcaa..1f7c41c 100644
 --- a/src/gallium/targets/egl-static/Android.mk
 +++ b/src/gallium/targets/egl-static/Android.mk
 @@ -32,6 +32,60 @@ LOCAL_SRC_FILES :=
  LOCAL_CFLAGS :=
  LOCAL_C_INCLUDES :=
  
 +LOCAL_STATIC_LIBRARIES :=
 +LOCAL_WHOLE_STATIC_LIBRARIES := libmesa_egl
 +
 +LOCAL_SHARED_LIBRARIES := \
 + libglapi \
 + libdrm \
 + libdl \
 + libhardware \
 + liblog \
 + libcutils
 +
 +ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
 +
 +LOCAL_SRC_FILES += \
 + egl.c \
 + egl_pipe.c \
 + egl_st.c
 +
 +LOCAL_CFLAGS += \
 + -DFEATURE_ES1=1 \
 + -DFEATURE_ES2=1 \
 + -D_EGL_MAIN=_eglBuiltInDriverGALLIUM
 +
 +LOCAL_C_INCLUDES += \
 + $(GALLIUM_TOP)/state_trackers/vega \
 + $(GALLIUM_TOP)/state_trackers/egl \
 + $(MESA_TOP)/src/egl/main \
 + $(MESA_TOP)/src/mesa \
 + $(DRM_TOP)/include/drm \
 + $(DRM_TOP)
 +
 +gallium_DRIVERS :=
 +
 +# swrast
 +gallium_DRIVERS += libmesa_pipe_softpipe libmesa_winsys_sw_android
 +LOCAL_CFLAGS += -DGALLIUM_SOFTPIPE
 +
 +#
 +# Notes about the order here:
 +#
 +#  * libmesa_st_egl depends on libmesa_winsys_sw_android in 
 $(gallium_DRIVERS)
 +#  * libmesa_st_mesa depends on libmesa_glsl
 +#  * libmesa_glsl depends on libmesa_glsl_utils
 +#
 +LOCAL_STATIC_LIBRARIES := \
 + libmesa_st_egl \
 + $(gallium_DRIVERS) \
 + libmesa_st_mesa \
 + libmesa_glsl \
 + libmesa_glsl_utils \
 + libmesa_gallium
 +
 +endif # MESA_BUILD_GALLIUM
 +
  LOCAL_MODULE := libGLES_mesa
  LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
  

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOTB/DAAoJEAIvNt057x8iULgP/1+s5viX1UK+Rtk74X1odyi4
dtIxXkcOHAoQ1ahj4rGWxeSDS6dSB/htJ3coAXia+9uwi/dadOda1BUgksdOB6fv
oetheS95zdG+6Hrpi48XSe2NjMQJjF+IYut/516N2yZR850TP8u1RqyfhYCaQwCn
2jeerMJvnQYMtMtxGHaCryjr0ZpYZsrGEg8JefeAERNG8YkkSembf63xwaWVnede
rsheN23i2yykvyMt7wDx26nV4Bs2UceBoATmnuRKM08t56edxQlQCQxmtVF5AWx1
xyYta7HGOTS74PbzM8urJObn2/F7lsqUpKs/i7xzW49mtkjmR3RoJEQ1lg3eAuBS
nYoYrjCflhnrbKUOc/JbSEa0lAalM8YVm96xlPR/GJIC2tY5ACc4lNW0kZxBhnUL
745o2TSuayPjrcwD8OTklZ3YvwhO4MoMVWys0rOXrDeuyXeMYTFPx+ats9XJO3oE
v0i8wVnqvviu+KEhVM0H1AfS4lF1IpdoA37MCGUeb2nm1l3o1ppW6fcSfsiPn45o
WBwCqKCYtcYC5TJ5uv0mM7ZgTqzuzuhLTrn5rzoEb4J06ff2Hs/U2Vck1osmsttf
a3zrX4DdLzZTPaLjAT4y/w0YgF1sb6yZAtnK/fUSjUiwwBFC9JuHLA8sEE7ch0Ya
6B+MhTyLnkL0gLeRT2dh
=2g8I
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC-PATCH 00/18] add Android support

2011-08-17 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



On 08/16/2011 11:28 PM, Chia-I Wu wrote:
 Hi list,
 
 This patch series adds Android Gingerbread support to Mesa.  To begin
 with, it only supports software rendering with softpipe.  I've tested
 it with VirtualBox.  There are pending series that enable all other
 gallium pipe drivers and the classic i915/i965.  I would like to see
 how this series goes before sending them out.
 
 If you are familiar with Android-x86, you can replace external/mesa by
 the master branch plus this series, and build the image like this
 
  $ make -j2 iso_img BOARD_GPU_DRIVERS=swrast
 
 The first five patches fix build issues with Android's toolchain and
 libc.  They are generally pretty small.
 
 Patch 6-8 adds Android Gingerbread support to core EGL and st/egl.
 They are quite isolated and should be interesting to EGL developers.
 
 Patch 9-18 adds Android.mk's to the source tree.  The Android build
 system will include them and build mesa when BOARD_GPU_DRIVERS is
 defined.
 
 This series is RFC because Android.mk's duplicate the source lists in
 Makefile's.  It means it will suffer from the same pain as SCons does:
 it needs to be updated if a new file is added.  Chad has concerns
 about this.  Since he also needs to work on that for his series, I
 will join him and update Android.mk's accordingly.
 
 Other than that, please review.

Chia-I,

I'm glad to see your Android patches on the list. Now the Mesa
and Android-x86 communities can begin to fold Android support into
master and make progress towards a stable Mesa on Android.

I've commented, acked, or rb'd all the patches that are within my
domain. I've avoided commenting on patches specific to Gallium.

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOTCENAAoJEAIvNt057x8i2pMQAIeq9u1fQEGSOrFxz1Ql+R5F
XpRWAu2hFmRlsc5avSt3MFXGg7hFfdU2mlwuhzJDjEnEEH/sg61vnZ0nVNc1ARJH
O9cG7yrkKhbjdHVvsZeGHtAC+dy2o2H+YMymvPDELjMjqWv54OMX6cNghc/Pfq/s
PcfpZOIyVWrvDDJfBpS/fZsS/O5WRvHodGcXQ6SSNgEqI3rSC5vBjG8apSOE/kop
rbvq3T1XG6ulNN4qK/DITC8XAQge9jHiANhW55E9PXM7gioqeezJ9FbRmw1zlmE6
hctRm13/f+LENe6qmbL4FV5KFrkkh6QkJo+7qE9MGDl38tsAWJ0m3wN7in4qkEnJ
aPmeezwrh0fWnEywNLyZTtIT9AVfNJa4uYSWFFhzlDLkKKGcuplOvU03vGEW3bUa
os8i+kf1I8QYawjgvC+A3s80CHeGzI1dCaFYni9u0sv7OeG4S4Htr6v0i8Qk3yHS
4x6WD4sqz9mSoD2mbyTfAUioyv0DKvrPSKbzkAGTL+BtgBGzd/cksB0JFU1Upt+Y
KHuh7XFyb8Q3nuO0ij5z+AP+OrEDsNNqLMImAyX6WuZCkptneKjlK/iN7NVft6Bs
Ct4AR1ANCm/8ns6wKpfdL610mMXK8WgA5hjR0bOaOCAt6zVfeq0g1QM6t9JNIvyV
FHmWNp0dwfBpOyszr+vT
=7ZVA
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 04/18] ralloc: SIZE_MAX is missing on Android

2011-08-18 Thread Chad Versace
On 08/17/2011 08:06 PM, Chia-I Wu wrote:
 On Thu, Aug 18, 2011 at 12:28 AM, Chad Versace c...@chad-versace.us wrote:
 On 08/17/2011 08:31 AM, Ian Romanick wrote:
 On 08/16/2011 11:28 PM, Chia-I Wu wrote:
 Define SIZE_MAX to UINT32_MAX for it. --- src/glsl/ralloc.c |4  1
 files changed, 4 insertions(+), 0 deletions(-)

 diff --git a/src/glsl/ralloc.c b/src/glsl/ralloc.c index 6a5eac6..757ab5c
 100644 --- a/src/glsl/ralloc.c +++ b/src/glsl/ralloc.c @@ -46,6 +46,10
 @@ #endif #endif

 +#ifdef ANDROID +#define SIZE_MAX UINT32_MAX +#endif +

 Android doesn't have this in stdint.h?  C99 requires that it be there.
 Either way, this assumes that size_t is a uint32_t, which it may not be. A
 better approach might be:

 /* C99 requires that SIZE_MAX be at least 65536.  The allocator * shouldn't
 ever need it to be more than 2^32.  Good luck allocating a * a single block
 that big anyway. */ #ifndef SIZE_MAX #  if sizeof(size_t) = 4 #define
 SIZE_MAX UINT32_MAX #  else #define SIZE_MAX 65536 #  endif #endif
 
 Bionic defines SIZE_MAX in bionic/arch-x86/include/machine/limits.h. By
 inspecting the include chain below, I believe simply including limits.h will
 do the job.
 
 arch-x86/include/machine/limits.h:#define SIZE_MAX
 include/sys/limits.h:#include machine/limits.h
 include/limits.h:#include sys/limits.h
 I will have ralloc include limits.h when ANDROID is defined.  I will
 add a comment saying that SIZE_MAX is supposed to be in stdint.h.

Then this is
Reviewed-by: Chad Versace c...@chad-versace.us

-- 
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 09/18] android: build libGLES_mesa

2011-08-18 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/17/2011 08:24 PM, Chia-I Wu wrote:
 On Thu, Aug 18, 2011 at 2:03 AM, Chad Versace c...@chad-versace.us wrote:
 I've commented below on TOP/Android.mk and TOP/Android.common.mk.
 The Gallium makefiles are outside of my domain, so I have no comments on 
 those.
 
 On 08/16/2011 11:28 PM, Chia-I Wu wrote:
 This is the first step to integrate Mesa into Android(-x86) build
 system.  You can git clone mesa under the external/ directory of Android
 source tree and build Android with

  $ make BOARD_GPU_DRIVERS=swrast

 It will build libGLES_mesa that will be loaded by Android runtime.

 libGLES_mesa is still a stub in this commit.
 ---
  Android.common.mk |   48 ++
  Android.mk|   76 
 +
  src/gallium/Android.mk|   36 ++
  src/gallium/Android.template.mk   |   33 
  src/gallium/targets/egl-static/Android.mk |   39 +++
  5 files changed, 232 insertions(+), 0 deletions(-)
  create mode 100644 Android.common.mk
  create mode 100644 Android.mk
  create mode 100644 src/gallium/Android.mk
  create mode 100644 src/gallium/Android.template.mk
  create mode 100644 src/gallium/targets/egl-static/Android.mk

 diff --git a/Android.common.mk b/Android.common.mk
 new file mode 100644
 index 000..c1e4cce
 --- /dev/null
 +++ b/Android.common.mk
 @@ -0,0 +1,48 @@
 +# Mesa 3-D graphics library
 +# Version:  7.12
 
 Version 7.12 is misleading and should be removed from all the
 copyright headers in the series.
 I will remove the version tag from all new files.
 +#
 +# Copyright (C) 2010-2011 Chia-I Wu olva...@gmail.com
 +# Copyright (C) 2010-2011 LunarG Inc.
 +#
 +# Permission is hereby granted, free of charge, to any person obtaining a
 +# copy of this software and associated documentation files (the 
 Software),
 +# to deal in the Software without restriction, including without 
 limitation
 +# the rights to use, copy, modify, merge, publish, distribute, sublicense,
 +# and/or sell copies of the Software, and to permit persons to whom the
 +# Software is furnished to do so, subject to the following conditions:
 +#
 +# The above copyright notice and this permission notice shall be included
 +# in all copies or substantial portions of the Software.
 +#
 +# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS 
 OR
 +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 +# 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.
 +
 +LOCAL_C_INCLUDES += \
 + $(MESA_TOP)/include
 +
 +LOCAL_CFLAGS += \
 + -DPTHREADS \
 + -fvisibility=hidden \
 + -Wno-sign-compare
 +
 +ifeq ($(strip $(MESA_ENABLE_ASM)),true)
 +ifeq ($(TARGET_ARCH),x86)
 +LOCAL_CFLAGS += \
 + -DUSE_X86_ASM
 +endif
 +endif
 +
 +LOCAL_CPPFLAGS += \
 + -Wno-error=non-virtual-dtor \
 + -Wno-non-virtual-dtor
 +
 +#LOCAL_STRIP_MODULE := false
 
 Did you intend to comment out this line? If you intend for it to
 remain commented-out in the file, then there should be a comment
 explaining why.
 I will add a comment.  Uncomment it will leave the libraries
 unstripped, easier for debugging.

Ah! That's good to know.


 +ifeq ($(strip $(LOCAL_MODULE_TAGS)),)
 +LOCAL_MODULE_TAGS := optional
 +endif
 diff --git a/Android.mk b/Android.mk
 new file mode 100644
 index 000..8da5120
 --- /dev/null
 +++ b/Android.mk
 @@ -0,0 +1,76 @@
 +# Mesa 3-D graphics library
 +# Version:  7.12
 +#
 +# Copyright (C) 2010-2011 Chia-I Wu olva...@gmail.com
 +# Copyright (C) 2010-2011 LunarG Inc.
 +#
 +# Permission is hereby granted, free of charge, to any person obtaining a
 +# copy of this software and associated documentation files (the 
 Software),
 +# to deal in the Software without restriction, including without 
 limitation
 +# the rights to use, copy, modify, merge, publish, distribute, sublicense,
 +# and/or sell copies of the Software, and to permit persons to whom the
 +# Software is furnished to do so, subject to the following conditions:
 +#
 +# The above copyright notice and this permission notice shall be included
 +# in all copies or substantial portions of the Software.
 +#
 +# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS 
 OR
 +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 +# 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

Re: [Mesa-dev] [PATCH 16/18] android: build glsl

2011-08-18 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Great. Then the glsl makefile is
Reviewed-by: Chad Versace c...@chad-versace.us

On 08/17/2011 08:26 PM, Chia-I Wu wrote:
 On Thu, Aug 18, 2011 at 4:06 AM, Chad Versace c...@chad-versace.us wrote:
 On 08/16/2011 11:28 PM, Chia-I Wu wrote:
 This builds the static library libmesa_glsl and executable glsl_compiler
 from glsl.  glsl_compiler is only installed for engineering build.
 ---
  Android.mk  |1 +
  src/glsl/Android.gen.mk |   73 +
  src/glsl/Android.mk |  161 
 +++
  src/mesa/Android.mk |   25 +++
  4 files changed, 260 insertions(+), 0 deletions(-)
  create mode 100644 src/glsl/Android.gen.mk
  create mode 100644 src/glsl/Android.mk

 diff --git a/Android.mk b/Android.mk
 index 0dc8fe1..f05d54f 100644
 --- a/Android.mk
 +++ b/Android.mk
 @@ -42,6 +42,7 @@ DRM_GRALLOC_TOP := hardware/drm_gralloc
  MESA_COMMON_MK := $(MESA_TOP)/Android.common.mk

  SUBDIRS := \
 + $(LOCAL_PATH)/src/glsl/Android.mk \
   $(LOCAL_PATH)/src/mesa/Android.mk \
   $(LOCAL_PATH)/src/egl/Android.mk \
   $(LOCAL_PATH)/src/gallium/Android.mk
 diff --git a/src/glsl/Android.gen.mk b/src/glsl/Android.gen.mk
 new file mode 100644
 index 000..61b2e4d
 --- /dev/null
 +++ b/src/glsl/Android.gen.mk
 @@ -0,0 +1,73 @@
 +ifeq ($(LOCAL_MODULE_CLASS),)
 +LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 +endif
 +
 +intermediates := $(call local-intermediates-dir)
 +
 +sources := \
 + glsl_lexer.cpp \
 + glsl_parser.cpp \
 + glcpp/glcpp-lex.c \
 + glcpp/glcpp-parse.c
 +
 +ifneq ($(LOCAL_IS_HOST_MODULE),true)
 +sources += builtin_function.cpp
 +endif
 +
 +LOCAL_SRC_FILES := $(filter-out $(sources), $(LOCAL_SRC_FILES))
 +
 +LOCAL_C_INCLUDES += $(intermediates) $(intermediates)/glcpp 
 $(MESA_TOP)/src/glsl/glcpp
 +
 +sources := $(addprefix $(intermediates)/, $(sources))
 +LOCAL_GENERATED_SOURCES += $(sources)
 +
 +define local-l-or-ll-to-c-or-cpp
 + @mkdir -p $(dir $@)
 + @echo Mesa Lex: $(PRIVATE_MODULE) = $
 + $(hide) $(LEX) --nounistd -o$@ $
 +endef
 +
 +define local-y-to-c-and-h
 + @mkdir -p $(dir $@)
 + @echo Mesa Yacc: $(PRIVATE_MODULE) = $
 + $(hide) $(YACC) -o $@ $
 +endef
 +
 +define local-yy-to-cpp-and-h
 + @mkdir -p $(dir $@)
 + @echo Mesa Yacc: $(PRIVATE_MODULE) = $
 + $(hide) $(YACC) -p _mesa_glsl_ -o $@ $
 + touch $(@:$1=$(YACC_HEADER_SUFFIX))
 + echo '#ifndef '$(@F:$1=_h)  $(@:$1=.h)
 + echo '#define '$(@F:$1=_h)  $(@:$1=.h)
 + cat $(@:$1=$(YACC_HEADER_SUFFIX))  $(@:$1=.h)
 + echo '#endif'  $(@:$1=.h)
 + rm -f $(@:$1=$(YACC_HEADER_SUFFIX))
 +endef
 +
 +$(intermediates)/glsl_lexer.cpp: $(LOCAL_PATH)/glsl_lexer.ll
 + $(call local-l-or-ll-to-c-or-cpp)
 +
 +$(intermediates)/glsl_parser.cpp: $(LOCAL_PATH)/glsl_parser.yy
 + $(call local-yy-to-cpp-and-h,.cpp)
 +
 +$(intermediates)/glcpp/glcpp-lex.c: $(LOCAL_PATH)/glcpp/glcpp-lex.l
 + $(call local-l-or-ll-to-c-or-cpp)
 +
 +$(intermediates)/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glcpp/glcpp-parse.y
 + $(call local-y-to-c-and-h)
 +
 +BUILTIN_COMPILER := 
 $(BUILD_OUT_EXECUTABLES)/mesa_builtin_compiler$(BUILD_EXECUTABLE_SUFFIX)
 +
 +builtin_function_deps := \
 + $(LOCAL_PATH)/builtins/tools/generate_builtins.py \
 + $(LOCAL_PATH)/builtins/tools/texture_builtins.py \
 + $(BUILTIN_COMPILER) \
 + $(wildcard $(LOCAL_PATH)/builtins/profiles/*) \
 + $(wildcard $(LOCAL_PATH)/builtins/ir/*)
 +
 +$(intermediates)/builtin_function.cpp: PRIVATE_SCRIPT := $(MESA_PYTHON2) 
 $(LOCAL_PATH)/builtins/tools/generate_builtins.py
 +$(intermediates)/builtin_function.cpp: $(builtin_function_deps)
 + @mkdir -p $(dir $@)
 + @echo Gen GLSL: $(PRIVATE_MODULE) = $(notdir $@)
 + $(hide) $(PRIVATE_SCRIPT) $(BUILTIN_COMPILER)  $@ || rm -f $@
 diff --git a/src/glsl/Android.mk b/src/glsl/Android.mk
 new file mode 100644
 index 000..5f0c83c
 --- /dev/null
 +++ b/src/glsl/Android.mk
 @@ -0,0 +1,161 @@
 +# Mesa 3-D graphics library
 +# Version:  7.12
 
 Again, this version tag should be removed.
 Will do.
 +#
 +# Copyright (C) 2010-2011 Chia-I Wu olva...@gmail.com
 +# Copyright (C) 2010-2011 LunarG Inc.
 +#
 +# Permission is hereby granted, free of charge, to any person obtaining a
 +# copy of this software and associated documentation files (the 
 Software),
 +# to deal in the Software without restriction, including without 
 limitation
 +# the rights to use, copy, modify, merge, publish, distribute, sublicense,
 +# and/or sell copies of the Software, and to permit persons to whom the
 +# Software is furnished to do so, subject to the following conditions:
 +#
 +# The above copyright notice and this permission notice shall be included
 +# in all copies or substantial portions of the Software.
 +#
 +# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS 
 OR
 +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY

Re: [Mesa-dev] [RFC-PATCH 0/2] share source lists between scons and make

2011-08-18 Thread Chad Versace
Thanks for doing this, Chia-I. I like this approach.

Chad Versace
c...@chad-versace.us

On 08/18/2011 03:33 AM, Jose Fonseca wrote:
 I think this is great. Thanks for stepping up and doing this, Olv!
 
 Concerning the implementation, my only suggestion is that it might be useful 
 to have the ability to specify the include name (but maybe leave 
 'sources.mak' as default value). 
 
 Otherwise looks great IMO. I think we should expand on this as much as we can.
 
 Jose
 
 - Original Message -
 The goal of this RFC series is to allow scons and make to share the
 source lists.  The source lists of Makefile's are constantly changing
 and we have had enough fix SCons build in the git log.

 For that to be possible, source lists in Makefile's are expected to
 be
 factored out to sources.mak.  Makefile can include sources.mak
 directly.
 The first patch allows SConscript to include sources.mak through the
 ParseSourcesMak method.  The second patch converts gallium/auxiliary
 to
 make use of the new method, as an example.

 The syntax of sources.mak is a very small subset of GNU Make.
 Currently, only :=, +=, and simple variable dereference are
 supported.
 While being small, it already allows us to do something like

   C_SOURCES := \
 foo.c \
 bar.c

   # these files are generated
   GENERATED_SOURCES := gen.c

   C_SOURCES += $(GENERATED_SOURCES)

 I could not find a Makefile parser for python so I have to write
 one (simple, less than 100 lines) from scratch.

 Ideas?


-- 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC-PATCH 00/18] add Android support

2011-08-18 Thread Chad Versace


On 08/17/2011 08:37 PM, Chia-I Wu wrote:
 On Thu, Aug 18, 2011 at 4:14 AM, Chad Versace c...@chad-versace.us wrote:
 
 
 On 08/16/2011 11:28 PM, Chia-I Wu wrote:
 Hi list,

 This patch series adds Android Gingerbread support to Mesa.  To begin
 with, it only supports software rendering with softpipe.  I've tested
 it with VirtualBox.  There are pending series that enable all other
 gallium pipe drivers and the classic i915/i965.  I would like to see
 how this series goes before sending them out.

 If you are familiar with Android-x86, you can replace external/mesa by
 the master branch plus this series, and build the image like this

  $ make -j2 iso_img BOARD_GPU_DRIVERS=swrast

 The first five patches fix build issues with Android's toolchain and
 libc.  They are generally pretty small.

 Patch 6-8 adds Android Gingerbread support to core EGL and st/egl.
 They are quite isolated and should be interesting to EGL developers.

 Patch 9-18 adds Android.mk's to the source tree.  The Android build
 system will include them and build mesa when BOARD_GPU_DRIVERS is
 defined.

 This series is RFC because Android.mk's duplicate the source lists in
 Makefile's.  It means it will suffer from the same pain as SCons does:
 it needs to be updated if a new file is added.  Chad has concerns
 about this.  Since he also needs to work on that for his series, I
 will join him and update Android.mk's accordingly.

 Other than that, please review.
 
 Chia-I,
 
 I'm glad to see your Android patches on the list. Now the Mesa
 and Android-x86 communities can begin to fold Android support into
 master and make progress towards a stable Mesa on Android.
 
 I've commented, acked, or rb'd all the patches that are within my
 domain. I've avoided commenting on patches specific to Gallium.
 Thanks.
 
 Do you suggest we factor out the source lists before or after this
 patch series?  Outside Gallium, there are only src/egl/main and
 src/glsl that need factoring out.  When later support for non-Gallium
 drivers[1] is supported, there will also be
 src/mesa/drivers/dri/{i915,i965}.

I think it is best if you go ahead and commit the patches that you have posted 
to the list
(but after we resolve the issue of how libGLES_mesa is built, of course).
They will have already been reviewed, and the makefile cleanups required for 
src/glsl and
src/mesa are minimal. It will be simple to do the refactoring after your 
patches land.

Now that I see how you intend to proceed with sharing sources.mak, tomorrow
I will create sources.mak for the i915 and i965 directories. That way,
src/mesa/drivers/dri/Android.mk will not require extensive (if any) refactoring.

-- 
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glsl: Do not link builtin_stubs.o into glsl_compiler

2011-08-18 Thread Chad Versace
[Ian, I want your Tested-by.]

Before this commit, both builtin_stubs.o and builtin_functions.o (via
libglsl.a) were linked into glsl_compiler. It is surprising that this
worked at all, since builtin_functions.o redefines some symbols in
builtin_stubs.o.

CC: Ian Romanick i...@freedesktop.org
Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/glsl/Makefile |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/glsl/Makefile b/src/glsl/Makefile
index c20a6c9..00b7b91 100644
--- a/src/glsl/Makefile
+++ b/src/glsl/Makefile
@@ -188,11 +188,11 @@ install-dricore: default
 
 # RULES #
 
-glsl_compiler: $(GLSL2_OBJECTS) libglsl.a builtin_stubs.o
-   $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLSL2_OBJECTS) 
builtin_stubs.o $(LIBS) -o $@
+glsl_compiler: $(GLSL2_OBJECTS) libglsl.a
+   $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLSL2_OBJECTS) $(LIBS) -o 
$@
 
-glsl_test: $(TEST_OBJECTS) libglsl.a builtin_stubs.o
-   $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(TEST_OBJECTS) 
builtin_stubs.o $(LIBS) -o $@
+glsl_test: $(TEST_OBJECTS) libglsl.a
+   $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(TEST_OBJECTS) $(LIBS) -o 
$@
 
 glcpp: glcpp/glcpp
 glcpp/glcpp: $(GLCPP_OBJECTS)
-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa: Declare _mesa_meta_begin()/end() as public

2011-08-18 Thread Chad Versace
Declare _mesa_meta_begin()/end() in meta.h so that drivers can write
custom meta-ops (such as HiZ resolves for i965).

This necessitates moving the the META_* macros into meta.h. To prevent
naming collisions, this commit renames each macro to be MESA_META_*.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/common/meta.c |  256 ++--
 src/mesa/drivers/common/meta.h |   33 +
 2 files changed, 147 insertions(+), 142 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index f9b4755..e37b78a 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -73,64 +73,36 @@
 /** Return offset in bytes of the field within a vertex struct */
 #define OFFSET(FIELD) ((void *) offsetof(struct vertex, FIELD))
 
-
-/**
- * Flags passed to _mesa_meta_begin().
- */
-/*@{*/
-#define META_ALL  ~0x0
-#define META_ALPHA_TEST0x1
-#define META_BLEND 0x2  /** includes logicop */
-#define META_COLOR_MASK0x4
-#define META_DEPTH_TEST0x8
-#define META_FOG  0x10
-#define META_PIXEL_STORE  0x20
-#define META_PIXEL_TRANSFER   0x40
-#define META_RASTERIZATION0x80
-#define META_SCISSOR 0x100
-#define META_SHADER  0x200
-#define META_STENCIL_TEST0x400
-#define META_TRANSFORM   0x800 /** modelview/projection matrix state */
-#define META_TEXTURE0x1000
-#define META_VERTEX 0x2000
-#define META_VIEWPORT   0x4000
-#define META_CLAMP_FRAGMENT_COLOR 0x8000
-#define META_CLAMP_VERTEX_COLOR 0x1
-#define META_CONDITIONAL_RENDER 0x2
-#define META_CLIP  0x4
-/*@}*/
-
-
 /**
  * State which we may save/restore across meta ops.
  * XXX this may be incomplete...
  */
 struct save_state
 {
-   GLbitfield SavedState;  /** bitmask of META_* flags */
+   GLbitfield SavedState;  /** bitmask of MESA_META_* flags */
 
-   /** META_ALPHA_TEST */
+   /** MESA_META_ALPHA_TEST */
GLboolean AlphaEnabled;
GLenum AlphaFunc;
GLclampf AlphaRef;
 
-   /** META_BLEND */
+   /** MESA_META_BLEND */
GLbitfield BlendEnabled;
GLboolean ColorLogicOpEnabled;
 
-   /** META_COLOR_MASK */
+   /** MESA_META_COLOR_MASK */
GLubyte ColorMask[MAX_DRAW_BUFFERS][4];
 
-   /** META_DEPTH_TEST */
+   /** MESA_META_DEPTH_TEST */
struct gl_depthbuffer_attrib Depth;
 
-   /** META_FOG */
+   /** MESA_META_FOG */
GLboolean Fog;
 
-   /** META_PIXEL_STORE */
+   /** MESA_META_PIXEL_STORE */
struct gl_pixelstore_attrib Pack, Unpack;
 
-   /** META_PIXEL_TRANSFER */
+   /** MESA_META_PIXEL_TRANSFER */
GLfloat RedBias, RedScale;
GLfloat GreenBias, GreenScale;
GLfloat BlueBias, BlueScale;
@@ -138,17 +110,17 @@ struct save_state
GLfloat DepthBias, DepthScale;
GLboolean MapColorFlag;
 
-   /** META_RASTERIZATION */
+   /** MESA_META_RASTERIZATION */
GLenum FrontPolygonMode, BackPolygonMode;
GLboolean PolygonOffset;
GLboolean PolygonSmooth;
GLboolean PolygonStipple;
GLboolean PolygonCull;
 
-   /** META_SCISSOR */
+   /** MESA_META_SCISSOR */
struct gl_scissor_attrib Scissor;
 
-   /** META_SHADER */
+   /** MESA_META_SHADER */
GLboolean VertexProgramEnabled;
struct gl_vertex_program *VertexProgram;
GLboolean FragmentProgramEnabled;
@@ -158,19 +130,19 @@ struct save_state
struct gl_shader_program *FragmentShader;
struct gl_shader_program *ActiveShader;
 
-   /** META_STENCIL_TEST */
+   /** MESA_META_STENCIL_TEST */
struct gl_stencil_attrib Stencil;
 
-   /** META_TRANSFORM */
+   /** MESA_META_TRANSFORM */
GLenum MatrixMode;
GLfloat ModelviewMatrix[16];
GLfloat ProjectionMatrix[16];
GLfloat TextureMatrix[16];
 
-   /** META_CLIP */
+   /** MESA_META_CLIP */
GLbitfield ClipPlanesEnabled;
 
-   /** META_TEXTURE */
+   /** MESA_META_TEXTURE */
GLuint ActiveUnit;
GLuint ClientActiveUnit;
/** for unit[0] only */
@@ -180,21 +152,21 @@ struct save_state
GLbitfield TexGenEnabled[MAX_TEXTURE_UNITS];
GLuint EnvMode;  /* unit[0] only */
 
-   /** META_VERTEX */
+   /** MESA_META_VERTEX */
struct gl_array_object *ArrayObj;
struct gl_buffer_object *ArrayBufferObj;
 
-   /** META_VIEWPORT */
+   /** MESA_META_VIEWPORT */
GLint ViewportX, ViewportY, ViewportW, ViewportH;
GLclampd DepthNear, DepthFar;
 
-   /** META_CLAMP_FRAGMENT_COLOR */
+   /** MESA_META_CLAMP_FRAGMENT_COLOR */
GLenum ClampFragmentColor;
 
-   /** META_CLAMP_VERTEX_COLOR */
+   /** MESA_META_CLAMP_VERTEX_COLOR */
GLenum ClampVertexColor;
 
-   /** META_CONDITIONAL_RENDER */
+   /** MESA_META_CONDITIONAL_RENDER */
struct gl_query_object *CondRenderQuery;
GLenum CondRenderMode;
 
@@ -342,10 +314,10 @@ _mesa_meta_free(struct gl_context *ctx)
  * Enter meta state.  This is like a light-weight version of glPushAttrib
  * but it also resets most GL state back to default values.
  *
- * \param state  bitmask of META_* flags

[Mesa-dev] [PATCH] intel: Emit assertion failure ASAP when DRI2 separate stencil handshake fails

2011-08-18 Thread Chad Versace
When intel_verify_dri2_has_hiz() discovers that DRI2 (that is, the DDX
driver) cannot provide a separate stencil buffer, but
intel_context::hw_must_use_separate_stencil is set, then emit an
informative assertion failure as soon as possible.

Currently, we do emit an assertion failure, but the its location is
sufficiently unrelated to the DRI2 HiZ handshake as to be uninformative.
In experimenting with HiZ, Anholt encountered this assertion failure and
was unable to understand its cause.

CC: Eric Anholt e...@anholt.net
Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/intel/intel_context.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
b/src/mesa/drivers/dri/intel/intel_context.c
index fe8be08..b9d2579 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -1454,6 +1454,10 @@ intel_verify_dri2_has_hiz(struct intel_context *intel,
  * a combined depth/stencil buffer. Discard the hiz buffer too.
  */
 intel-intelScreen-dri2_has_hiz = INTEL_DRI2_HAS_HIZ_FALSE;
+if (intel-must_use_separate_stencil) {
+   assert(!intel_context requires separate stencil, but the 
+   DRIscreen does not support it);
+}
 
 /* 1. Discard depth and stencil renderbuffers. */
 _mesa_remove_renderbuffer(fb, BUFFER_DEPTH);
-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCHv2 05/21] mesa: android has no log2f nor ffs

2011-08-19 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Reviewed-by: Chad Versace c...@chad-versace.us

On 08/18/2011 07:37 PM, Chia-I Wu wrote:
 Define log2f(v) to be logf(v) / M_LN2 and ffs to __builtin_ffs.
 ---
  src/mesa/main/imports.h |8 +++-
  1 files changed, 7 insertions(+), 1 deletions(-)
 
 diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
 index 3fa1db0..70defdc 100644
 --- a/src/mesa/main/imports.h
 +++ b/src/mesa/main/imports.h
 @@ -134,7 +134,13 @@ typedef union { GLfloat f; GLint i; } fi_type;
  #define exp2f(f) ((float) exp2(f))
  #define floorf(f) ((float) floor(f))
  #define logf(f) ((float) log(f))
 +
 +#ifdef ANDROID
 +#define log2f(f) (logf(f) * (float) (1.0 / M_LN2))
 +#else
  #define log2f(f) ((float) log2(f))
 +#endif
 +
  #define powf(x,y) ((float) pow(x,y))
  #define sinf(f) ((float) sin(f))
  #define sinhf(f) ((float) sinh(f))
 @@ -562,7 +568,7 @@ _mesa_init_sqrt_table(void);
  
  #ifdef __GNUC__
  
 -#ifdef __MINGW32__
 +#if defined(__MINGW32__) || defined(ANDROID)
  #define ffs __builtin_ffs
  #define ffsll __builtin_ffsll
  #endif
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOTpoEAAoJEAIvNt057x8iJTwQAMBTR94B27F4oFw/HqGfmUcl
1bxYZK1/wbcBigxpmRC0FH3LHMzSQVSvYw8A/NtPNJ0MYYeHDa2/QpvBc5aWge4J
bph/4Tm5ByAiyY1w4Hi+t9i+m4x5KBTvl8wZVZ8QCmV/wJDCjsr4bebAoEyFj0jY
IlmrWTH6hppcy9Y+DwTdAsPhdQcLoOfHH4lzT0Uv8FOjSqOW87IBAtEmn4iETlaE
hnpfLmwLA5Qha+f0Y5m+9gQ1qhKg0qkRUbwm6n46hAk8FW1Cw80/VtEvKQhNe2hM
Xy/Ns3i6dVBIc2E+AIvwTDG3+FGTxu4gfgvHidNwXjjr8QJ2oed5Tj4Sroqk50nZ
Ipx5NCdtoIeoNBgI9Knys94QXiiNkaCftjvBGigdNL+5kVqWr37HY9mo+o/A5p2g
/RlXG5aevHHQufxqKwXTkvXeIk3mkia16+0LxiW+8P2otwzVzTV3ChQMy1WrayfK
5LoxvnQjBhPxPKboMzMTMvtZVdaVXa8Ar/dHfqk5XiQYquB2liKa6tYJNn4weUDd
ADRb3bDVbYER7S+x56MDHmU+By21gtLFgiB/YY1i01D57QGkP4NZCM+s65baRM1N
2Zs+D87G0mD9RtGnu7Bc9FWOmS6lu9dcpy9VvBeEmRnmMhs4mYNUHFCjk9uS85Da
nLBzXu4/7OsgdWXtHCd/
=wJE0
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCHv2 21/21] android: make libGLES_mesa real

2011-08-19 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Reviewed-by: Chad Versace c...@chad-versace.us

On 08/18/2011 07:37 PM, Chia-I Wu wrote:
 libGLES_mesa with swrast should link in these libraries
 
   libmesa_egl
   libmesa_egl_gallium
   libmesa_st_egl
   libmesa_st_mesa
   libmesa_glsl
   libmesa_glsl_utils
   libmesa_pipe_softpipe
   libmesa_winsys_sw_android
   libmesa_gallium
 ---
  Android.mk |   37 +
  1 files changed, 37 insertions(+), 0 deletions(-)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOTp6TAAoJEAIvNt057x8idx4P/RzZC/43xPdwbb2aBp2qEuyB
ZFm9h0sel+2RoTD9yBmVmq0us6X4MiyUmv4mm38yKacMaqqDncDDsOpDrHAkOh9U
MkQhrdjeLg1GIOxSJ6p0mD4YDzgyDTt5qraS+pg8wu860kmj9nitTIdTnSwiYsNS
8wtyWIHapiOaRmn9NModiDHUqQINf8kBCTKxePsc7LGaE3GZ6HIBh48QHjZasWgh
pUa/LgQd/ZElX1FWQHjjWcojQyqWiyT5OO1xXxj/NFPi5csgCzye7RBGNgcDYdLz
i5pAwm/a/r0d/6sK/wwnOUw1OsCA8X745fDu+GFuDm4f5w0P4uC8/opcUURDKexm
j3dg2upFJG+nQhCMQkRcLabXAeftiGa1M7kzsFBZnm1kf79UHqNnixeZlkxiabhJ
WyfcD+1yYp3skvUYD4QWMeCt2UAICLlsXd8eUUtPTlPsdSkHft8nuPGSHZI3n1cP
OO23OivFH3XpckcbkkAUE0QxtMrOZBTC4OUCBjn0Z2aGFWOBBVPjkmGMzGz8qCRn
+ifxGQZJW6ZxAQtaH91f3lFOzKk02uRz7znz0PpFpKsbsWqAnv+dMiF1yfcb2Bt1
7FU9b61SW4G/Y9WvrcdNJ+Th2aP1BNiL89JLCPCO8HqpX7XQIp9zuqxS576Q6LzM
jZJS24G0IxLBRnMdBngO
=/oTO
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCHv2 00/21] initial Android support, try 2

2011-08-19 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/19/2011 03:46 AM, Chia-I Wu wrote:
 On Fri, Aug 19, 2011 at 10:37 AM, Chia-I Wu olva...@gmail.com wrote:
 Changes from v1 are

  - build libGLES_mesa in top-level Android.mk
  - split changes to st/egl into 3 patches
  - use logf for log2f
  - misc changes and added comments

 Tests are done using VirtualBox.
 If there is no issues that require another iteration to resolve, I
 plan to incorporate the feedbacks and merge over the weekend, without
 doing a v3.  If you feel like a v3 or think this series needs more
 time, please let me know.

Looks good to me. Thanks olv.

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOTp9zAAoJEAIvNt057x8iYB0P/07r/fxAjTe8pOWhqP6lZS4M
fMDRtRSwSrHDRISWO+bGjcbvZ45SqsbAA/hJ3XpeCvPP8BiXjxdI/rfzyf4b1FP/
2j2P/ThyNVjuX23HKiq9YJ7HGKmNs4tcKNCXtGQ8M1bIRbxKFGBtWa4lEnGZfynd
HPBbr0pc6EimjAkBDOwdwxzWis6g88r/SjRmI8LQjCHy/JlvyutFidWouqo+6gGW
aYnhUPQyS3sb8te+wsQjKxdSwI6npqhfJqZI2A0qj8O7n+VTIb2NLoDz/o43qnf9
cDKshwL3n2n/6RjRh72x7eORNGSO/dQVUd/qLZdILbrC4k+ZE0CvgSJTMBYJaKrI
y2Ll4o03GKLuHuVJcTCzqHTPOHCXH2rguGgNY2ngLao1tYO29nqhfwNW1QVrejdE
nBQxQFFnbc/5jpWk9mHjeEff6e5LHe1VxXdp/OpOJaqaQDSKqAnbWExQvuM7IPkg
uRlJC+T5GclCwiTieo5SbrLh0Yl5a/NZVRpL1v+x3ziN8BdRFabs6aLmSgv2lEfB
1vLwBp8JVRSoFI9NcZS7RUioAYqwESFgsXzEcxA7MxFiVrkF3JzoYML/YtFHZ+Sj
ibe85/YtZWsMyTt4IP1UFUX2Kuf6A5pr/2H5+Sceu47pemTsZHsbESc2ynCx1AMM
c19XdfGoGXpO2wbODxEe
=7gkK
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] intel: Emit assertion failure ASAP when DRI2 separate stencil handshake fails

2011-08-19 Thread Chad Versace
On 08/19/2011 10:35 AM, Eric Anholt wrote:
 On Thu, 18 Aug 2011 14:02:46 -0700, Chad Versace c...@chad-versace.us wrote:
 When intel_verify_dri2_has_hiz() discovers that DRI2 (that is, the DDX
 driver) cannot provide a separate stencil buffer, but
 intel_context::hw_must_use_separate_stencil is set, then emit an
 informative assertion failure as soon as possible.

 Currently, we do emit an assertion failure, but the its location is
 sufficiently unrelated to the DRI2 HiZ handshake as to be uninformative.
 In experimenting with HiZ, Anholt encountered this assertion failure and
 was unable to understand its cause.

 CC: Eric Anholt e...@anholt.net
 Signed-off-by: Chad Versace c...@chad-versace.us
 ---
  src/mesa/drivers/dri/intel/intel_context.c |4 
  1 files changed, 4 insertions(+), 0 deletions(-)

 diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
 b/src/mesa/drivers/dri/intel/intel_context.c
 index fe8be08..b9d2579 100644
 --- a/src/mesa/drivers/dri/intel/intel_context.c
 +++ b/src/mesa/drivers/dri/intel/intel_context.c
 @@ -1454,6 +1454,10 @@ intel_verify_dri2_has_hiz(struct intel_context *intel,
* a combined depth/stencil buffer. Discard the hiz buffer too.
*/
   intel-intelScreen-dri2_has_hiz = INTEL_DRI2_HAS_HIZ_FALSE;
 + if (intel-must_use_separate_stencil) {
 +assert(!intel_context requires separate stencil, but the 
 +DRIscreen does not support it);
 + }
  
 
 If it's something we think people can actually hit (and in this case we
 do), just use _mesa_problem so people see it even if they aren't
 building with assertions.

I would also like to throw an assertion immediately after _mesa_problem(), like 
below.
Since an assertion will eventually fail anyway, we might as well die ASAP.

_mesa_probelm(ctx, intel_context requires separate stencil, but the 
   DRIscreen does no support it. You may need to upgrade 
   the Intel X driver to 2.16.0);
assert(0);

-- 
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] intel: Emit assertion failure ASAP when DRI2 separate stencil handshake fails

2011-08-19 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/19/2011 03:18 PM, Kenneth Graunke wrote:
 On 08/19/2011 10:44 AM, Chad Versace wrote:
 On 08/19/2011 10:35 AM, Eric Anholt wrote:
 On Thu, 18 Aug 2011 14:02:46 -0700, Chad Versace c...@chad-versace.us 
 wrote:
 When intel_verify_dri2_has_hiz() discovers that DRI2 (that is, the DDX
 driver) cannot provide a separate stencil buffer, but
 intel_context::hw_must_use_separate_stencil is set, then emit an
 informative assertion failure as soon as possible.

 Currently, we do emit an assertion failure, but the its location is
 sufficiently unrelated to the DRI2 HiZ handshake as to be uninformative.
 In experimenting with HiZ, Anholt encountered this assertion failure and
 was unable to understand its cause.

 CC: Eric Anholt e...@anholt.net
 Signed-off-by: Chad Versace c...@chad-versace.us
 ---
  src/mesa/drivers/dri/intel/intel_context.c |4 
  1 files changed, 4 insertions(+), 0 deletions(-)

 diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
 b/src/mesa/drivers/dri/intel/intel_context.c
 index fe8be08..b9d2579 100644
 --- a/src/mesa/drivers/dri/intel/intel_context.c
 +++ b/src/mesa/drivers/dri/intel/intel_context.c
 @@ -1454,6 +1454,10 @@ intel_verify_dri2_has_hiz(struct intel_context 
 *intel,
  * a combined depth/stencil buffer. Discard the hiz buffer too.
  */
 intel-intelScreen-dri2_has_hiz = INTEL_DRI2_HAS_HIZ_FALSE;
 +   if (intel-must_use_separate_stencil) {
 +  assert(!intel_context requires separate stencil, but the 
 +  DRIscreen does not support it);
 +   }
  

 If it's something we think people can actually hit (and in this case we
 do), just use _mesa_problem so people see it even if they aren't
 building with assertions.

 I would also like to throw an assertion immediately after _mesa_problem(), 
 like below.
 Since an assertion will eventually fail anyway, we might as well die ASAP.

 _mesa_probelm(ctx, intel_context requires separate stencil, but the 
DRIscreen does no support it. You may need to upgrade 
the Intel X driver to 2.16.0);
 assert(0);
 
 Not assert(0)...abort().  assertions get compiled away to nothing in
 release mode.

Thanks. I have never used abort() before... I forgot it was in the toolbox.

If I replace the assert with abort, is everyone happy?

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOTusDAAoJEAIvNt057x8ieXkP/j3xPmcu2DobddyEQ5uTsbpQ
crY8Qt6bIRASv0mwe4Jg3SBDWrQtwpAQbI5XJPz6xrm7JRw71ioAyAwKFXf5Gh/2
LXK8pDKGl7VqOQzJRHxzkrfgppjB4rK2EGy1E9pvly5asj2/pC1SEhfxEeWXhWc0
CTytqD/figOcsyk432MrUpLw7iUXcwgQH+P4Bk0HedCdZ7ByhHu8tDZwAzoVwb0W
kNV/W2D6xB39zwMjdRphZaLvkvYbp3BVsQwAhKZdvavBk/Mb4N8rZ6zcjLHygvyk
0tEtg0Es89PiCn2oxsirE9w3mPNtq4viZOwL0YnunaxSA8LuVjbWFXHymTrrAHLU
+J4L17K7y1Avllrmi6S5B0k8y/DxPZMVRHYHXB1bwYhKy2NmWWGtjISG1+wJA8Pj
in+SLwuRvHK34aqmF5g735DQpdf4fXYNO24NNU+18L+gpWcxM2KIFCgRiHI8qTQw
9cFvfLw2INP8QYFo6Lf0nu2J56T7yVyShFseaRryQ9Gj2g4tOmpxJARV/zjfJh81
J+tEMX+rEm/muL2EIRdht+ignimaAYXT6HuxjJ4WQ1E3//ATZlL4M7+jVKRTDeUI
fK116DRHqmy6vn9jZyLAA80Y3jRrWD1FhAaUi6ZxmvDf2VQhnII+G8c84kl++5A5
cjso81b6b79N0dOXD2aA
=UdQL
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/2] share source lists between build systems

2011-08-22 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/20/2011 11:54 AM, Chia-I Wu wrote:
 This patch series enables Makefile, SConscript, and Android.mk to
 share their source lists.  The idea is to first factor out source
 lists from Makefile to Makefile.sources.  Then by adding the ability
 to parse Makefile.sources to SConscript, all three build systems can
 share it.
 
 In this series, only gallium/auxiliary is updated, mainly to serve as
 an example.  There is no plan to update _every_ directory at the
 moment.  Directories will be updated as needed.
 
 Comparing to the RFC version of the series,
 
  - sources.mak is renamed to Makefile.sources
  - the SCons method to parse Makefile.sources is now called
ParseSourceList and the input file name must be specified
  - better error reporting for the parser

I didn't check the details, but the approach looks good.
Acked-by: Chad Versace c...@chad-versace.us

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOUoNYAAoJEAIvNt057x8icuQQAKHW2IF6BRv8RsOmsK4TSzuQ
vwi8AhYLo1eIUTVTApFT/4Wj6otBrUXif8F0dXOvA9HXbqBO2oK8MqALTPJBqsgV
Eltl3BnHaasHsNvY5L0276rNBc6CacN04+aBs1RrvbXr0SyvRIUXzAFdRj1uhHpN
nx2YNQX5nX7Pkau+mbAQOfBcbSCUHWXrfUon0DV7PznXUkckcfm4p5t0MazOrKOp
/9M5ne6DklNerKxwOCwCR59c3cJUuyt0Gms8McubI+6yB+bbw4SDL4NdZ3dJEtYv
R2WY/g6rtqG9/eEJxJ845vKO3k7XL9eLi4UropC3aOLl21oZaWaZWsv+SuiEEpcE
Dqk6joNDVax5eQ1vnLkFgLfr428woU4n0+x6zmuc6k7SV/sLQpEJfnvacUOrPoWn
hVeIQIb310fX7uyBdpusroIUHxOpYoKdBM68jbDyL3Tyb5tl1pqTtkXAgqy634LR
8WzMpW0rFSGHRaWA618DypMmuu7j7hD7nrv1n5MnSV53szrjk2f96TRvLlIr7xG/
XNjQREiUqLAiQ2B+REozd8nyB15ZxLb1B6wOTVpxC6XWXAz38HwtRWpX51GN9dIQ
ISgMdyYGMbKJNgwoAlzxv6rvJ/SU6AZ1zfl3OU+jcVhrHa1tRY3iMpPiZ5kiwaLT
D4+rksahUlZENVaQrvAr
=3yhn
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] i965: Factor source lists into Makefile.sources

2011-08-23 Thread Chad Versace
In preparation for porting i965 to Android, factor its source lists into
a shared makefile. This prevents duplication of source lists, and hence
prevents the Android from breaking as often.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i965/Makefile |  132 ++--
 src/mesa/drivers/dri/i965/Makefile.sources |  119 +
 2 files changed, 127 insertions(+), 124 deletions(-)
 create mode 100644 src/mesa/drivers/dri/i965/Makefile.sources

diff --git a/src/mesa/drivers/dri/i965/Makefile 
b/src/mesa/drivers/dri/i965/Makefile
index d9c885d..b64b95a 100644
--- a/src/mesa/drivers/dri/i965/Makefile
+++ b/src/mesa/drivers/dri/i965/Makefile
@@ -1,136 +1,20 @@
 
 TOP = ../../../../..
+MESA_TOP := $(TOP)
+
 include $(TOP)/configs/current
 
 LIBNAME = i965_dri.so
 
+include Makefile.sources
 include ../Makefile.defines
 
-DRIVER_SOURCES = \
-   intel_batchbuffer.c \
-   intel_blit.c \
-   intel_buffer_objects.c \
-   intel_buffers.c \
-   intel_clear.c \
-   intel_context.c \
-   intel_decode.c \
-   intel_extensions.c \
-   intel_extensions_es2.c \
-   intel_fbo.c \
-   intel_mipmap_tree.c \
-   intel_regions.c \
-   intel_screen.c \
-   intel_span.c \
-   intel_pixel.c \
-   intel_pixel_bitmap.c \
-   intel_pixel_copy.c \
-   intel_pixel_draw.c \
-   intel_pixel_read.c \
-   intel_state.c \
-   intel_syncobj.c \
-   intel_tex.c \
-   intel_tex_copy.c \
-   intel_tex_format.c \
-   intel_tex_image.c \
-   intel_tex_layout.c \
-   intel_tex_subimage.c \
-   intel_tex_validate.c \
-   brw_cc.c \
-   brw_clip.c \
-   brw_clip_line.c \
-   brw_clip_point.c \
-   brw_clip_state.c \
-   brw_clip_tri.c \
-   brw_clip_unfilled.c \
-   brw_clip_util.c \
-   brw_context.c \
-   brw_curbe.c \
-   brw_disasm.c \
-   brw_draw.c \
-   brw_draw_upload.c \
-   brw_eu.c \
-   brw_eu_debug.c \
-   brw_eu_emit.c \
-   brw_eu_util.c \
-   brw_fallback.c \
-   brw_gs.c \
-   brw_gs_emit.c \
-   brw_gs_state.c \
-   brw_misc_state.c \
-   brw_optimize.c \
-   brw_program.c \
-   brw_queryobj.c \
-   brw_sf.c \
-   brw_sf_emit.c \
-   brw_sf_state.c \
-   brw_state_batch.c \
-   brw_state_cache.c \
-   brw_state_dump.c \
-   brw_state_upload.c \
-   brw_tex.c \
-   brw_tex_layout.c \
-   brw_urb.c \
-   brw_util.c \
-   brw_vs.c \
-   brw_vs_constval.c \
-   brw_vs_emit.c \
-   brw_vs_state.c \
-   brw_vs_surface_state.c \
-   brw_vtbl.c \
-   brw_wm.c \
-   brw_wm_debug.c \
-   brw_wm_emit.c \
-   brw_wm_fp.c \
-   brw_wm_iz.c \
-   brw_wm_pass0.c \
-   brw_wm_pass1.c \
-   brw_wm_pass2.c \
-   brw_wm_sampler_state.c \
-   brw_wm_state.c \
-   brw_wm_surface_state.c \
-   gen6_cc.c \
-   gen6_clip_state.c \
-   gen6_depthstencil.c \
-   gen6_gs_state.c \
-   gen6_sampler_state.c \
-   gen6_scissor_state.c \
-   gen6_sf_state.c \
-   gen6_urb.c \
-   gen6_viewport_state.c \
-   gen6_vs_state.c \
-   gen6_wm_state.c \
-   gen7_cc_state.c \
-   gen7_clip_state.c \
-   gen7_disable.c \
-   gen7_misc_state.c \
-   gen7_sampler_state.c \
-   gen7_sf_state.c \
-   gen7_urb.c \
-   gen7_viewport_state.c \
-   gen7_vs_state.c \
-   gen7_wm_state.c \
-   gen7_wm_surface_state.c \
-
-C_SOURCES = \
-   $(COMMON_SOURCES) \
-   $(DRIVER_SOURCES)
-
-CXX_SOURCES = \
-   brw_cubemap_normalize.cpp \
-   brw_fs.cpp \
-   brw_fs_emit.cpp \
-   brw_fs_visitor.cpp \
-   brw_fs_channel_expressions.cpp \
-   brw_fs_reg_allocate.cpp \
-   brw_fs_schedule_instructions.cpp \
-   brw_fs_vector_splitting.cpp \
-   brw_shader.cpp \
-   brw_vec4.cpp \
-   brw_vec4_emit.cpp \
-   brw_vec4_reg_allocate.cpp \
-   brw_vec4_visitor.cpp
+C_SOURCES := \
+   $(i965_C_SOURCES) \
+   $(COMMON_SOURCES)
 
-ASM_SOURCES = 
+CXX_SOURCES := $(i965_CXX_SOURCES)
+ASM_SOURCES :=
 
 DRIVER_DEFINES = -I../intel
 
diff --git a/src/mesa/drivers/dri/i965/Makefile.sources 
b/src/mesa/drivers/dri/i965/Makefile.sources
new file mode 100644
index 000..e65be42
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -0,0 +1,119 @@
+i965_C_SOURCES := \
+   intel_batchbuffer.c \
+   intel_blit.c \
+   intel_buffer_objects.c \
+   intel_buffers.c \
+   intel_clear.c \
+   intel_context.c \
+   intel_decode.c \
+   intel_extensions.c \
+   intel_extensions_es2.c \
+   intel_fbo.c \
+   intel_mipmap_tree.c \
+   intel_regions.c \
+   intel_screen.c \
+   intel_span.c \
+   intel_pixel.c \
+   intel_pixel_bitmap.c \
+   intel_pixel_copy.c \
+   intel_pixel_draw.c

[Mesa-dev] [PATCH 2/2] i915: Factor source lists into Makefile.sources

2011-08-23 Thread Chad Versace
In preparation for porting i915 to Android, factor its source lists into
a shared makefile. This prevents duplication of source lists, and hence
prevents the Android from breaking as often.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i915/Makefile |   49 +--
 src/mesa/drivers/dri/i915/Makefile.sources |   45 +
 2 files changed, 47 insertions(+), 47 deletions(-)
 create mode 100644 src/mesa/drivers/dri/i915/Makefile.sources

diff --git a/src/mesa/drivers/dri/i915/Makefile 
b/src/mesa/drivers/dri/i915/Makefile
index 79e03f2..548d7e8 100644
--- a/src/mesa/drivers/dri/i915/Makefile
+++ b/src/mesa/drivers/dri/i915/Makefile
@@ -4,57 +4,12 @@ include $(TOP)/configs/current
 
 LIBNAME = i915_dri.so
 
+include Makefile.sources
 include ../Makefile.defines
 
-DRIVER_SOURCES = \
-   i830_context.c \
-   i830_state.c \
-   i830_texblend.c \
-   i830_texstate.c \
-   i830_vtbl.c \
-   intel_render.c \
-   intel_regions.c \
-   intel_buffer_objects.c \
-   intel_batchbuffer.c \
-   intel_clear.c \
-   intel_extensions.c \
-   intel_extensions_es2.c \
-   intel_mipmap_tree.c \
-   intel_tex_layout.c \
-   intel_tex_image.c \
-   intel_tex_subimage.c \
-   intel_tex_copy.c \
-   intel_tex_validate.c \
-   intel_tex_format.c \
-   intel_tex.c \
-   intel_pixel.c \
-   intel_pixel_bitmap.c \
-   intel_pixel_copy.c \
-   intel_pixel_draw.c \
-   intel_pixel_read.c \
-   intel_buffers.c \
-   intel_blit.c \
-   i915_tex_layout.c \
-   i915_texstate.c \
-   i915_context.c \
-   i915_debug.c \
-   i915_debug_fp.c \
-   i915_fragprog.c \
-   i915_program.c \
-   i915_state.c \
-   i915_vtbl.c \
-   intel_context.c \
-   intel_decode.c \
-   intel_screen.c \
-   intel_span.c \
-   intel_state.c \
-   intel_syncobj.c \
-   intel_tris.c \
-   intel_fbo.c
-
 C_SOURCES = \
$(COMMON_SOURCES) \
-   $(DRIVER_SOURCES)
+   $(i915_C_SOURCES)
 
 ASM_SOURCES = 
 
diff --git a/src/mesa/drivers/dri/i915/Makefile.sources 
b/src/mesa/drivers/dri/i915/Makefile.sources
new file mode 100644
index 000..1336fff
--- /dev/null
+++ b/src/mesa/drivers/dri/i915/Makefile.sources
@@ -0,0 +1,45 @@
+i915_C_SOURCES := \
+   i830_context.c \
+   i830_state.c \
+   i830_texblend.c \
+   i830_texstate.c \
+   i830_vtbl.c \
+   intel_render.c \
+   intel_regions.c \
+   intel_buffer_objects.c \
+   intel_batchbuffer.c \
+   intel_clear.c \
+   intel_extensions.c \
+   intel_extensions_es2.c \
+   intel_mipmap_tree.c \
+   intel_tex_layout.c \
+   intel_tex_image.c \
+   intel_tex_subimage.c \
+   intel_tex_copy.c \
+   intel_tex_validate.c \
+   intel_tex_format.c \
+   intel_tex.c \
+   intel_pixel.c \
+   intel_pixel_bitmap.c \
+   intel_pixel_copy.c \
+   intel_pixel_draw.c \
+   intel_pixel_read.c \
+   intel_buffers.c \
+   intel_blit.c \
+   i915_tex_layout.c \
+   i915_texstate.c \
+   i915_context.c \
+   i915_debug.c \
+   i915_debug_fp.c \
+   i915_fragprog.c \
+   i915_program.c \
+   i915_state.c \
+   i915_vtbl.c \
+   intel_context.c \
+   intel_decode.c \
+   intel_screen.c \
+   intel_span.c \
+   intel_state.c \
+   intel_syncobj.c \
+   intel_tris.c \
+   intel_fbo.c
-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] i965: Factor source lists into Makefile.sources

2011-08-23 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

The first two lines of the diff,
+ MESA_TOP := $(TOP)
+
ignore them. They slipped in by accident.

- -- 
Chad Versace
c...@chad-versace.us

On 08/23/2011 05:04 PM, Chad Versace wrote:
 In preparation for porting i965 to Android, factor its source lists into
 a shared makefile. This prevents duplication of source lists, and hence
 prevents the Android from breaking as often.
 
 Signed-off-by: Chad Versace c...@chad-versace.us
 ---
  src/mesa/drivers/dri/i965/Makefile |  132 
 ++--
  src/mesa/drivers/dri/i965/Makefile.sources |  119 +
  2 files changed, 127 insertions(+), 124 deletions(-)
  create mode 100644 src/mesa/drivers/dri/i965/Makefile.sources
 
 diff --git a/src/mesa/drivers/dri/i965/Makefile 
 b/src/mesa/drivers/dri/i965/Makefile
 index d9c885d..b64b95a 100644
 --- a/src/mesa/drivers/dri/i965/Makefile
 +++ b/src/mesa/drivers/dri/i965/Makefile
 @@ -1,136 +1,20 @@
  
  TOP = ../../../../..
 +MESA_TOP := $(TOP)
 +
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOVESXAAoJEAIvNt057x8iwnQP/14ERbDo8TGwBCOQWbRxmmfl
SPlUd34AC2ASXC7H+Vs+ECEBc9YMnlOtthSVq408m9V9G5c3HreyVyqSj2wg1ev/
mQbsuIJ45FW2iGluF42xDdgopvCsIxrIqdnBh/nC3L1zEweyFPNiVboz0FSa4Vx8
ymvlFbg/o85OOh/YZY1enla3zHKptdjY5FmW58qIXwAMuEWB4Zfkr0jRuv3whrNo
xpT27G9gYMPfyAbg/vGjhcxzJknVFg6B0I5unQ7nLKeqk19DTBE+Ncs5N2jlnlyg
yr6fujGy8pNcXQRHrsRkoUzjgsYZRoLBNmWVwQzlxSSo4iS0COlzdSsRLMlbyL0q
wGWclFZrOtTiBuRtzHhzo7FpZAUcxlFKX+4S1HxXASdNF58rkchCb1U2KPsRTGOM
vuXVCX0zymI9YnKJvaiZS/UAN5uM5+8ZZaHfJjGTf0US+H5K9/Ko/sG3X6LYmNok
SueVLLD3DFyg+jvGAWZpfx9fJEGGQvnr5HS8+ZBqg/f7EDniVeInyxMPtMYrX88q
qGVi7BdWhFhLi07wLgD6GLRU6C8qNb5ZS4wGfyHP8kR4Wj27uLLF85qtFEqt6bdC
8tVhogeRuvD6WL4SWajNLdbYc02gkfB3po8JSyNa+ZKQhyA3i/szqfkaghk9/2we
HwxSyXaS9Xg/B1ddl32v
=zQwn
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] egl_dri2: allow RGBA masks to be specified for matching

2011-08-24 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I see why it's necessary, and can think of no cleaner way of doing it. So this 
is
Reviewed-by: Chad Versace c...@chad-versace.us

On 08/23/2011 08:10 PM, Chia-I Wu wrote:
 Add rgba_masks to dri2_add_config.  When it is non-NULL, the DRI config
 is accepted only when the offsets and sizes of the its channels match
 rgba_mask.
 ---
  src/egl/drivers/dri2/egl_dri2.c |   23 ++-
  src/egl/drivers/dri2/egl_dri2.h |3 ++-
  src/egl/drivers/dri2/platform_drm.c |2 +-
  src/egl/drivers/dri2/platform_wayland.c |2 +-
  src/egl/drivers/dri2/platform_x11.c |2 +-
  5 files changed, 27 insertions(+), 5 deletions(-)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOVZlYAAoJEAIvNt057x8iRIAQALXHkSr0ui8DTTRtwykDhTpA
bWqcVr+lW7YXUaAtl+LTkWu8171h0uTAS67EyAm6S+MMfbWOz2fYYIm1Qtd/IPs1
G5nj2Q6zuOWxcga41ixylcRLD6Br8kttEU6hUC/q/7wzJmAFg35WbBcVZJpBzTM0
iTkUTYRofj3yHWdO+UBdT6duU7Onz191ENi2ZdtXrx84sPXEog7zaTkY9rbQXB9X
ycM+ZRTkUxb8UbMCQZA0vzArfW5jRlYDXMRymtQSn9Mp2xho9sBFK6IFblV13zYf
rl1tJH4Y4S6XP4TzVgnvESzBS+E4ylq96o9VlbvOktlG1SAAUVIuaC+pwkeTZZ7z
bX7OYCVHYFmEI+Pa2SMsThnK4JAkK3X3owkxurktt9opQuzqqMI99/2Lg9jorjRs
zaACjW6zSY2LuDgDeXbNSgmaMXKaVu29R1L/UjCUZi/diPra4WOw0BUplYJ6b2Bh
bNb1OURp/8msVNmDfwEC5tL6Yeg5g06TKqygjIGEQ3TcDf0BG71cr8zf/7QeyPe1
BKvHQsgWSHZ/RiZlYNCqwiSzbw/gAYsi4o7NfS4B4xW+FOimp120B/bMJKeWlL3Q
S0oFtZSWsZ4kRrqJokGYAEIUmqS5FBdrytGbzS7UkysYNYNV9H8KptJMKR3kuc87
VMY6mAVKho/zSOBTeseP
=zoCE
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/3] android: add support for egl_dri2

2011-08-24 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/23/2011 08:10 PM, Chia-I Wu wrote:
 Add rules to build egl_dri2 and make it a built-in EGL driver of
 libGLES_mesa.
 ---
  Android.mk  |   11 +++-
  src/egl/drivers/dri2/Android.mk |   50 
 +++
  src/egl/main/Android.mk |3 ++
  3 files changed, 63 insertions(+), 1 deletions(-)
  create mode 100644 src/egl/drivers/dri2/Android.mk

Reviewed-by: Chad Versace c...@chad-versace.us

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOVZmPAAoJEAIvNt057x8ic0AP/3pVm0LQY3PiEkka0QIVuc8x
r2LpkR+ju5Osk78FYwvTIc2SvNQhni+hfCKYeHmlzhwqqZfbJBhpnaVi/O3VM65J
vJ7VQ067/iLKpnJTZWClRoqJf8Gl3mg1oKwyzngAuouU3PSxL7QnARJwqx0J1uIy
UOxQTNd7RdMX9Nj3fX0WODc1pEtAKBM6Yd3InM1IvYGg/riR7PwMCJcXhljzy/nv
x2meCp4ut/5lLpKx/NFkhyMe9tNIZDgubBcmP9QdKWlKd6HfrLsYJZ0Jz67BvR+f
xKnyrLTMSHh/0SOiTRAUauhUS3C7N8zjZxcgznc5fhoaMMNROa5lm9ThixYtp8yk
c4pBLSeliNTXATE2Kf6x4MGwgKo3ws4J8JRd5vCtUeDA1pb2SeP5DGsz6Oudarxl
o0bL6PI58CnyKkU/dMToaKbU7hm+sSmZwR1aWu5I+tvxVXt1IpKgha5ppX1DDFrt
UhFsxHrMd7nea5NqDj1g4Qf4M204hX/usYKL2bsyK7o6hnqv9q/5qZorBQQk2k/z
GMm1yl5FeJ01esF6yT9q5XI1103CFtvyVQjVckCu03um54nva2BO+mua6Vywgowd
Y0hekS+ZggGvtJpd06ZZTxn1hvjS2PsIAJSJUxatyGdxbZU9r7cfREfS5ViZJT2R
c/S4LoU/1YexRCGsPHEG
=Hf+B
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/3] egl_dri2: add support for Android

2011-08-24 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Comments below.

On 08/23/2011 08:10 PM, Chia-I Wu wrote:
 Add platform_android.c that supports _EGL_PLAFORM_ANDROID.  It works
 with drm_gralloc, where back buffers of windows are backed by GEM
 objects.
 
 In Android a native window has a queue of back buffers allocated by the
 server, through drm_gralloc.  For each frame, EGL needs to
 
   dequeue the next back buffer
   render to the buffer
   enqueue the buffer
 
 After enqueuing, the buffer is no longer valid to EGL.  A window has no
 depth buffer or other aux buffers.  They need to be allocated locally by
 EGL.
 ---
  src/egl/drivers/dri2/egl_dri2.c |   89 +
  src/egl/drivers/dri2/egl_dri2.h |   18 +
  src/egl/drivers/dri2/platform_android.c |  588 
 +++
  3 files changed, 695 insertions(+), 0 deletions(-)
  create mode 100644 src/egl/drivers/dri2/platform_android.c
 
 diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
 index ba728a1..33c2330 100644
 --- a/src/egl/drivers/dri2/egl_dri2.c
 +++ b/src/egl/drivers/dri2/egl_dri2.c

[snip]

 +static _EGLImage *
 +dri2_create_image_android_native_buffer(_EGLDisplay *disp,
 +EGLClientBuffer buffer)

To reiterate Benjamin, I think dri2_create_image_android_native_buffer should go
in android_platform.c.

[snip] 

 diff --git a/src/egl/drivers/dri2/platform_android.c 
 b/src/egl/drivers/dri2/platform_android.c
 new file mode 100644
 index 000..d0de94c
 --- /dev/null
 +++ b/src/egl/drivers/dri2/platform_android.c

[snip]

 +static _EGLSurface *
 +droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
 + _EGLConfig *conf, EGLNativeWindowType window,
 + const EGLint *attrib_list)
 +{
 +   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
 +   struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
 +   struct dri2_egl_surface *dri2_surf;
 +   int format;
 +
 +   (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;
 +   }
 +   if (format != dri2_conf-base.NativeVisualID) {
 +  _eglLog(_EGL_WARNING, Native format mismatch: 0x%x != 0x%x,
 +format, dri2_conf-base.NativeVisualID);
 +   }
 +
 +   dri2_surf = calloc(1, sizeof *dri2_surf);
 +   if (!dri2_surf) {
 +  _eglError(EGL_BAD_ALLOC, droid_create_surface);
 +  return NULL;
 +   }
 +
 +   if (!_eglInitSurface(dri2_surf-base, disp, type, conf, attrib_list))
 +  goto cleanup_surf;

It seems that droid_get_buffers_with_format() only supports single-buffered
surfaces. So eglCreateWindowSurface should reject requests for which
EGL_RENDER_BUFFER != EGL_SINGLE_BUFFER.

  if (dri2_surf-base.RenderBuffer != EGL_SINGLE_BUFFER)
 goto cleanup_surf;

I think the DRI2 surface type needs to be set here too.

  dri2_surf-type = DRI2_WINDOW_SURFACE;

 +
 +   dri2_surf-dri_drawable =
 +  (*dri2_dpy-dri2-createNewDrawable)(dri2_dpy-dri_screen,
 +dri2_conf-dri_double_config,
 +   dri2_surf);
 +   if (dri2_surf-dri_drawable == NULL) {
 +  _eglError(EGL_BAD_ALLOC, dri2-createNewDrawable);
 +  goto cleanup_surf;
 +   }
 +
 +   window-common.incRef(window-common);
 +   window-query(window, NATIVE_WINDOW_WIDTH, dri2_surf-base.Width);
 +   window-query(window, NATIVE_WINDOW_HEIGHT, dri2_surf-base.Height);
 +
 +   dri2_surf-window = window;
 +
 +   return dri2_surf-base;
 +
 +cleanup_surf:
 +   free(dri2_surf);
 +
 +   return NULL;
 +}

[snip]

 +#include xf86drm.h
 +/* for i915 */
 +#include i915_drm.h
 +/* for radeon */
 +#include radeon_drm.h

These includes should be moved to the top of the file.

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOVZ4oAAoJEAIvNt057x8ibNwP/R+Y7zo3yhh0v4sLlrkbKiox
GbuVRg4L00vi7IZk9ia/YZK4yHJIfku8f5Kf62lnNGL+8XwiqPc+fLFsTqLgg8yy
b0lTlHcUbvqyGokpwpECATvmXQ/eUupHbN3F7LN4fT7DUyuONmAmUHM6DFgcAu8C
rrywDtZqqigCxvPwJ8WGqtebfBtn0893tneem4t4fS13C+jgxns9RuZ4x1f+5OxA
+jlQz207M7YLT7FZZSBRBq8KGlik+0rp3CNTJ9OWu3YrQaqQxt24Dn9deopw3SeZ
jzKxQfuDqZbMVY9z91kjlo/N+CnmmAi8OV56Y7XVOdlwOw70vbvdD6olirIE7JK6
JOCvKqJucFf1cR/4dUXFOPLCl1V4UymHc3m5+KMSeqK5sp1UGjFGZCpsGlsbnWuP
Ygtbmw0lOqg0Gk15D2Xs8moAr8YI414aGCCyTXftxyf7qHR5OxxeD28cS3RIXq/o
fYvB37TKmkPyQ4dZxWZSfx/Rhqs8b0ZGFLswZpTa08AjFRnSLYUggsBy/zgqSEI8
ZoAwV8dMidyi2hdfEfIbUA0wIY56QbZ5Lrw5R1iGl7lk1HOPe6r+d17V52h94Jvm
AZChsK5SEKuONmtpcn9Cqgs26URWakJ92oXP/eNY9x7HdGykr61LCMkrKWGV6eUn
kN3X/Gil4t/CJrc0xKHi
=+Lyq
-END PGP SIGNATURE

Re: [Mesa-dev] [PATCH 2/3] egl_dri2: add support for Android

2011-08-25 Thread Chad Versace
On 08/24/2011 06:20 PM, Chia-I Wu wrote:
 On Thu, Aug 25, 2011 at 8:58 AM, Chad Versace c...@chad-versace.us wrote:
 Comments below.
 
 On 08/23/2011 08:10 PM, Chia-I Wu wrote:
 Add platform_android.c that supports _EGL_PLAFORM_ANDROID.  It works
 with drm_gralloc, where back buffers of windows are backed by GEM
 objects.

 In Android a native window has a queue of back buffers allocated by the
 server, through drm_gralloc.  For each frame, EGL needs to

   dequeue the next back buffer
   render to the buffer
   enqueue the buffer

 After enqueuing, the buffer is no longer valid to EGL.  A window has no
 depth buffer or other aux buffers.  They need to be allocated locally by
 EGL.
 ---
  src/egl/drivers/dri2/egl_dri2.c |   89 +
  src/egl/drivers/dri2/egl_dri2.h |   18 +
  src/egl/drivers/dri2/platform_android.c |  588 
 +++
  3 files changed, 695 insertions(+), 0 deletions(-)
  create mode 100644 src/egl/drivers/dri2/platform_android.c

 diff --git a/src/egl/drivers/dri2/egl_dri2.c 
 b/src/egl/drivers/dri2/egl_dri2.c
 index ba728a1..33c2330 100644
 --- a/src/egl/drivers/dri2/egl_dri2.c
 +++ b/src/egl/drivers/dri2/egl_dri2.c
 
 [snip]
 
 +static _EGLImage *
 +dri2_create_image_android_native_buffer(_EGLDisplay *disp,
 +EGLClientBuffer buffer)
 
 To reiterate Benjamin, I think dri2_create_image_android_native_buffer should 
 go
 in android_platform.c.
 
 [snip]
 
 diff --git a/src/egl/drivers/dri2/platform_android.c 
 b/src/egl/drivers/dri2/platform_android.c
 new file mode 100644
 index 000..d0de94c
 --- /dev/null
 +++ b/src/egl/drivers/dri2/platform_android.c
 
 [snip]
 
 +static _EGLSurface *
 +droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
 + _EGLConfig *conf, EGLNativeWindowType window,
 + const EGLint *attrib_list)
 +{
 +   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
 +   struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
 +   struct dri2_egl_surface *dri2_surf;
 +   int format;
 +
 +   (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;
 +   }
 +   if (format != dri2_conf-base.NativeVisualID) {
 +  _eglLog(_EGL_WARNING, Native format mismatch: 0x%x != 0x%x,
 +format, dri2_conf-base.NativeVisualID);
 +   }
 +
 +   dri2_surf = calloc(1, sizeof *dri2_surf);
 +   if (!dri2_surf) {
 +  _eglError(EGL_BAD_ALLOC, droid_create_surface);
 +  return NULL;
 +   }
 +
 +   if (!_eglInitSurface(dri2_surf-base, disp, type, conf, attrib_list))
 +  goto cleanup_surf;
 
 It seems that droid_get_buffers_with_format() only supports single-buffered
 surfaces. So eglCreateWindowSurface should reject requests for which
 EGL_RENDER_BUFFER != EGL_SINGLE_BUFFER.
 
  if (dri2_surf-base.RenderBuffer != EGL_SINGLE_BUFFER)
 goto cleanup_surf;
 [CC Benjamin]
 EGL_RENDER_BUFFER is a hint here.  It is fine if the native window
 does not support EGL_SINGLE_BUFFER.


You're right, specifying EGL_RENDER_BUFFER in eglCreateWindowSurface is just
a hint. And since the spec says this about eglQuerySurface,
Querying EGL_RENDER_BUFFER returns the buffer which client API rendering
is requested to use. For a window surface, this is the same attribute value 
specified
when the surface was created.
we shouldn't alter the requested value of dri2_surf-base.RenderBuffer.
 
 On the other hand, ctx-WindowRenderBuffer should be set.  It is
 queried by eglQueryContext.  I think it can be set in
 dri2_create_context: to EGL_BACK_BUFFER when there is
 dri_double_config and EGL_SINGLE_BUFFER when there is only
 dri_single_config.  Idea?

I agree that it seems safe to set ctx-WindowRenderBuffer when there is only a
dri_single_config. So, to ensure that the EGLConfig passed to
eglCreateContext does not have a dri_double_config, I think you need
to add this snippet in droid_add_configs_for_visuals:
   for (i = 0; visuals[i].format; i++) {
  ...
  for (j = 0; dri2_dpy-driver_configs[j]; j++) {
 ...
 /* Maybe this? */
 if (dri2_dpy-driver_configs[j]-modes.doubleBufferMode)
continue;
 /* end suggestion */

 dri2_conf = dri2_add_config(dpy, dri2_dpy-driver_configs[j],
   count + 1, visuals[i].size, EGL_WINDOW_BIT, NULL,
   visuals[i].rgba_masks);
Also, the call to dri2_dpy-dri2-createNewDrawable should be passed
dri2_conf-dri_single_config.

But I am hesitant to set it to EGL_BACK_BUFFER when there is a
dri2_double_config. If the driver supports rendering to a single buffered
surface under a context that supports double-buffering, then, if we had set
ctx-WindowRenderBuffer

Re: [Mesa-dev] [PATCH] glsl: Bail after reporting an error for non-constant const_in parameters.

2011-08-25 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Simple enough.
Reviewed-by: Chad Versace c...@chad-versace.us


On 08/25/2011 09:43 AM, Kenneth Graunke wrote:
 Otherwise we continue and hit the Illegal formal parameter mode
 assertion.
 
 Fixes negative compile test texelFetchOffset.frag in piglit.
 
 Signed-off-by: Kenneth Graunke kenn...@whitecape.org
 ---
  src/glsl/ast_function.cpp |1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
 
 diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
 index c49a33d..8b79d85 100644
 --- a/src/glsl/ast_function.cpp
 +++ b/src/glsl/ast_function.cpp
 @@ -164,6 +164,7 @@ match_function_by_name(exec_list *instructions, const 
 char *name,
   _mesa_glsl_error(loc, state,
parameter `%s' must be a constant expression,
formal-name);
 + return ir_call::get_error_instruction(ctx);
}
  
if ((formal-mode == ir_var_out)


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOVq4dAAoJEAIvNt057x8ieIUP/jcLkthEM8Stc2nrnE7n4xB/
6//2q5f/JawRkDuty1QbKKRMDv6gSdZq+Y5AnR2e+MiUcX4zRAdNNP7llVs44n7t
hmBBrSdyu8+TUUTKokhagFLELVr5br+DMk90/7LFKQFRy0VViFWQ8DCSmt3NO0ku
FhdF99ayze7xi9UOJMftcWI6Cj3gl4rt6or+kfw/PVRMMJytZBfEMBsbeVyrCMJo
qyl0eagJUbK8FyycdEO4xDHTchP2gl+15mTBVna/2P6Rc4PcfSkosGZLKrgCuxsA
KzrhAH4QJaVHFyI4XKi+AG2FmKHjR7G8sKcgnOxLvTnAT+ZB5vlO1K07JShjLdlF
9qhLiVVKmgwM+C1OS1yfZR5sB3vpO8/7CyDiHpXmeyA6K2PIpTlYp5eXhoTiwmu9
QFW8M5fCY8T9e89d2VSuAP4/pdtW7mv5UCszHTol0Z5s6OCYvYi1/D++6TZJLxRj
FRCUi7+sMt/QspD0rdyEHAFf1rMOeuQs29O8gMYBAXKk93nl3XAs+I06m7f6GIbo
mp9teMUIGu51cecM11DrqQOm/qEXTGoo+jc/fGUntrAUMHgiZ4jf+2QLEgsrtJ9E
OTfQyug5pofS4u82yiKtlSeSnxYHkpp+li9ZzUv0nvbGFxfPiU63lBx06PiAxP/H
mxBjTJDM/cLcTrN9vFfm
=4l/X
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl: Fail linking if a global is both a uniform and non-uniform.

2011-08-25 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

We weren't catching this? Embarrassing.

Reviewed-by: Chad Versace c...@chad-versace.us

We may also want to emit an error when a variable is declared as 'in'
a VS and as 'out' in a FS. But I'm not sure that's actually illegal.

On 08/25/2011 08:26 AM, Kenneth Graunke wrote:
 Signed-off-by: Kenneth Graunke kenn...@whitecape.org
 ---
  src/glsl/linker.cpp |7 +++
  1 files changed, 7 insertions(+), 0 deletions(-)
 
 diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
 index f970bce..7337c11 100644
 --- a/src/glsl/linker.cpp
 +++ b/src/glsl/linker.cpp
 @@ -366,6 +366,13 @@ cross_validate_globals(struct gl_shader_program *prog,
  }
   }
  
 + if ((var-mode == ir_var_uniform) != (existing-mode == 
 ir_var_uniform)) {
 +linker_error_printf(prog, %s is declared both as %s and %s\n,
 +var-name,
 +mode_string(var), mode_string(existing));
 +return false;
 + }
 +
   if (var-explicit_location) {
  if (existing-explicit_location
   (var-location != existing-location)) {
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOVrDPAAoJEAIvNt057x8i7oUP/2YytmNkcK4UVadoKIPGG+vs
5f9tinklD3g4yN+daWa3xpwL9kKQCSu4t5mPtuoKzzUdMyy4V71e1rGgCiYJu5B4
sFhjD5I1MrTpi/HpnRMSET1uRuZUypD0UFzTW7YjKPBnMf7LAvt506eRfEnhraO9
hZyTLHF5wLq75ktuITdflQlCVQBbv+NGlUC0QjbKT4tta+fXobd0kVIx90W0u9KQ
5UJgbCUphjPJ02anh9Dzf3q0Pmw8sCGXtd56aM/7Rq4thGKGb1rCaA4h4FNpJB/p
lzb9XDq4Fzfe2eauf6fQwrEr15oJdROI2ll5TNRPDePQ2qPnNi2ScpfahZXM71+U
FqsjqFjOAAYWuP0Of0yX4rKybb4dVfAeHbUoBVvkp0WdOvE8iLy+Esf8ZGpkn+VO
/66C24//eKJ7+M0ODJ811olmFg3n1ymk2umq314QbuqsqWu0lSe7dvIxtaQHd04o
wh2AjpbuwyC76nBw7oznvRBs5ymhb6kNVJ78/GJr74zZKq1bJuVZUs1sgD77/s8u
8ETHuzsyRUlZ8padCY1OagYp7J8leVTLPvp3UP/D7ZR/3at5vlSKYqFGCTuPdexf
bbixLenx1+LBGQOXzYyw/9OWDn04Sx6kgoN4ldQdzj/TmfeLMtEE3W4nfwSDdKzs
Q+yV76qrGR1jyjXaoc95
=QNXa
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/3] egl_dri2: add support for Android

2011-08-25 Thread Chad Versace
[CC'ing krh because I learned much of this from him, so may have some
insight to share with us.]

On 08/25/2011 08:14 PM, Chia-I Wu wrote:
 On Fri, Aug 26, 2011 at 4:09 AM, Chad Versace c...@chad-versace.us wrote:
 On 08/24/2011 06:20 PM, Chia-I Wu wrote:
 On Thu, Aug 25, 2011 at 8:58 AM, Chad Versace c...@chad-versace.us wrote:
 Comments below.

 On 08/23/2011 08:10 PM, Chia-I Wu wrote:
 Add platform_android.c that supports _EGL_PLAFORM_ANDROID.  It works
 with drm_gralloc, where back buffers of windows are backed by GEM
 objects.

 In Android a native window has a queue of back buffers allocated by the
 server, through drm_gralloc.  For each frame, EGL needs to

   dequeue the next back buffer
   render to the buffer
   enqueue the buffer

 After enqueuing, the buffer is no longer valid to EGL.  A window has no
 depth buffer or other aux buffers.  They need to be allocated locally by
 EGL.
 ---
  src/egl/drivers/dri2/egl_dri2.c |   89 +
  src/egl/drivers/dri2/egl_dri2.h |   18 +
  src/egl/drivers/dri2/platform_android.c |  588 
 +++
  3 files changed, 695 insertions(+), 0 deletions(-)
  create mode 100644 src/egl/drivers/dri2/platform_android.c

 diff --git a/src/egl/drivers/dri2/platform_android.c 
 b/src/egl/drivers/dri2/platform_android.c
 new file mode 100644
 index 000..d0de94c
 --- /dev/null
 +++ b/src/egl/drivers/dri2/platform_android.c

 [snip]

 +static _EGLSurface *
 +droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
 + _EGLConfig *conf, EGLNativeWindowType window,
 + const EGLint *attrib_list)
 +{
 +   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
 +   struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
 +   struct dri2_egl_surface *dri2_surf;
 +   int format;
 +
 +   (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;
 +   }
 +   if (format != dri2_conf-base.NativeVisualID) {
 +  _eglLog(_EGL_WARNING, Native format mismatch: 0x%x != 0x%x,
 +format, dri2_conf-base.NativeVisualID);
 +   }
 +
 +   dri2_surf = calloc(1, sizeof *dri2_surf);
 +   if (!dri2_surf) {
 +  _eglError(EGL_BAD_ALLOC, droid_create_surface);
 +  return NULL;
 +   }
 +
 +   if (!_eglInitSurface(dri2_surf-base, disp, type, conf, 
 attrib_list))
 +  goto cleanup_surf;

 It seems that droid_get_buffers_with_format() only supports single-buffered
 surfaces. So eglCreateWindowSurface should reject requests for which
 EGL_RENDER_BUFFER != EGL_SINGLE_BUFFER.

  if (dri2_surf-base.RenderBuffer != EGL_SINGLE_BUFFER)
 goto cleanup_surf;
 [CC Benjamin]
 EGL_RENDER_BUFFER is a hint here.  It is fine if the native window
 does not support EGL_SINGLE_BUFFER.


 You're right, specifying EGL_RENDER_BUFFER in eglCreateWindowSurface is just
 a hint. And since the spec says this about eglQuerySurface,
Querying EGL_RENDER_BUFFER returns the buffer which client API rendering
is requested to use. For a window surface, this is the same attribute 
 value specified
when the surface was created.
 we shouldn't alter the requested value of dri2_surf-base.RenderBuffer.

 On the other hand, ctx-WindowRenderBuffer should be set.  It is
 queried by eglQueryContext.  I think it can be set in
 dri2_create_context: to EGL_BACK_BUFFER when there is
 dri_double_config and EGL_SINGLE_BUFFER when there is only
 dri_single_config.  Idea?

 I agree that it seems safe to set ctx-WindowRenderBuffer when there is only 
 a
 dri_single_config. So, to ensure that the EGLConfig passed to
 eglCreateContext does not have a dri_double_config, I think you need
 to add this snippet in droid_add_configs_for_visuals:
   for (i = 0; visuals[i].format; i++) {
  ...
  for (j = 0; dri2_dpy-driver_configs[j]; j++) {
 ...
 /* Maybe this? */
 if (dri2_dpy-driver_configs[j]-modes.doubleBufferMode)
continue;
 /* end suggestion */

 dri2_conf = dri2_add_config(dpy, dri2_dpy-driver_configs[j],
   count + 1, visuals[i].size, EGL_WINDOW_BIT, NULL,
   visuals[i].rgba_masks);
 Also, the call to dri2_dpy-dri2-createNewDrawable should be passed
 dri2_conf-dri_single_config.

 But I am hesitant to set it to EGL_BACK_BUFFER when there is a
 dri2_double_config. If the driver supports rendering to a single buffered
 surface under a context that supports double-buffering, then, if we had set
 ctx-WindowRenderBuffer = EGL_BACK_BUFFER, that would force
 eglQueryContext(EGL_RENDER_BUFFER) to always return EGL_BACK_BUFFER, even
 when rendering to the single buffered surface.
 A client can only see the back buffer(s) on Android.  There is no
 single-buffered surface on Android

Re: [Mesa-dev] [PATCH 1/2] i965: Factor source lists into Makefile.sources

2011-08-25 Thread Chad Versace
Any comments from the Intel guys? I plan on pushing this Friday if
no one objects.

-- 
Chad Versace
c...@chad-versace.us

On 08/23/2011 05:04 PM, Chad Versace wrote:
 In preparation for porting i965 to Android, factor its source lists into
 a shared makefile. This prevents duplication of source lists, and hence
 prevents the Android from breaking as often.
 
 Signed-off-by: Chad Versace c...@chad-versace.us
 ---
  src/mesa/drivers/dri/i965/Makefile |  132 
 ++--
  src/mesa/drivers/dri/i965/Makefile.sources |  119 +
  2 files changed, 127 insertions(+), 124 deletions(-)
  create mode 100644 src/mesa/drivers/dri/i965/Makefile.sources
 
 diff --git a/src/mesa/drivers/dri/i965/Makefile 
 b/src/mesa/drivers/dri/i965/Makefile
 index d9c885d..b64b95a 100644
 --- a/src/mesa/drivers/dri/i965/Makefile
 +++ b/src/mesa/drivers/dri/i965/Makefile
 @@ -1,136 +1,20 @@
  
  TOP = ../../../../..
 +MESA_TOP := $(TOP)
 +
  include $(TOP)/configs/current
  
  LIBNAME = i965_dri.so
  
 +include Makefile.sources
  include ../Makefile.defines
  
 -DRIVER_SOURCES = \
 - intel_batchbuffer.c \
 - intel_blit.c \
 - intel_buffer_objects.c \
 - intel_buffers.c \
 - intel_clear.c \
 - intel_context.c \
 - intel_decode.c \
 - intel_extensions.c \
 - intel_extensions_es2.c \
 - intel_fbo.c \
 - intel_mipmap_tree.c \
 - intel_regions.c \
 - intel_screen.c \
 - intel_span.c \
 - intel_pixel.c \
 - intel_pixel_bitmap.c \
 - intel_pixel_copy.c \
 - intel_pixel_draw.c \
 - intel_pixel_read.c \
 - intel_state.c \
 - intel_syncobj.c \
 - intel_tex.c \
 - intel_tex_copy.c \
 - intel_tex_format.c \
 - intel_tex_image.c \
 - intel_tex_layout.c \
 - intel_tex_subimage.c \
 - intel_tex_validate.c \
 - brw_cc.c \
 - brw_clip.c \
 - brw_clip_line.c \
 - brw_clip_point.c \
 - brw_clip_state.c \
 - brw_clip_tri.c \
 - brw_clip_unfilled.c \
 - brw_clip_util.c \
 - brw_context.c \
 - brw_curbe.c \
 - brw_disasm.c \
 - brw_draw.c \
 - brw_draw_upload.c \
 - brw_eu.c \
 - brw_eu_debug.c \
 - brw_eu_emit.c \
 - brw_eu_util.c \
 - brw_fallback.c \
 - brw_gs.c \
 - brw_gs_emit.c \
 - brw_gs_state.c \
 - brw_misc_state.c \
 - brw_optimize.c \
 - brw_program.c \
 - brw_queryobj.c \
 - brw_sf.c \
 - brw_sf_emit.c \
 - brw_sf_state.c \
 - brw_state_batch.c \
 - brw_state_cache.c \
 - brw_state_dump.c \
 - brw_state_upload.c \
 - brw_tex.c \
 - brw_tex_layout.c \
 - brw_urb.c \
 - brw_util.c \
 - brw_vs.c \
 - brw_vs_constval.c \
 - brw_vs_emit.c \
 - brw_vs_state.c \
 - brw_vs_surface_state.c \
 - brw_vtbl.c \
 - brw_wm.c \
 - brw_wm_debug.c \
 - brw_wm_emit.c \
 - brw_wm_fp.c \
 - brw_wm_iz.c \
 - brw_wm_pass0.c \
 - brw_wm_pass1.c \
 - brw_wm_pass2.c \
 - brw_wm_sampler_state.c \
 - brw_wm_state.c \
 - brw_wm_surface_state.c \
 - gen6_cc.c \
 - gen6_clip_state.c \
 - gen6_depthstencil.c \
 - gen6_gs_state.c \
 - gen6_sampler_state.c \
 - gen6_scissor_state.c \
 - gen6_sf_state.c \
 - gen6_urb.c \
 - gen6_viewport_state.c \
 - gen6_vs_state.c \
 - gen6_wm_state.c \
 - gen7_cc_state.c \
 - gen7_clip_state.c \
 - gen7_disable.c \
 - gen7_misc_state.c \
 - gen7_sampler_state.c \
 - gen7_sf_state.c \
 - gen7_urb.c \
 - gen7_viewport_state.c \
 - gen7_vs_state.c \
 - gen7_wm_state.c \
 - gen7_wm_surface_state.c \
 -
 -C_SOURCES = \
 - $(COMMON_SOURCES) \
 - $(DRIVER_SOURCES)
 -
 -CXX_SOURCES = \
 - brw_cubemap_normalize.cpp \
 - brw_fs.cpp \
 - brw_fs_emit.cpp \
 - brw_fs_visitor.cpp \
 - brw_fs_channel_expressions.cpp \
 - brw_fs_reg_allocate.cpp \
 - brw_fs_schedule_instructions.cpp \
 - brw_fs_vector_splitting.cpp \
 - brw_shader.cpp \
 - brw_vec4.cpp \
 - brw_vec4_emit.cpp \
 - brw_vec4_reg_allocate.cpp \
 - brw_vec4_visitor.cpp
 +C_SOURCES := \
 + $(i965_C_SOURCES) \
 + $(COMMON_SOURCES)
  
 -ASM_SOURCES = 
 +CXX_SOURCES := $(i965_CXX_SOURCES)
 +ASM_SOURCES :=
  
  DRIVER_DEFINES = -I../intel
  
 diff --git a/src/mesa/drivers/dri/i965/Makefile.sources 
 b/src/mesa/drivers/dri/i965/Makefile.sources
 new file mode 100644
 index 000..e65be42
 --- /dev/null
 +++ b/src/mesa/drivers/dri/i965/Makefile.sources
 @@ -0,0 +1,119 @@
 +i965_C_SOURCES := \
 + intel_batchbuffer.c \
 + intel_blit.c \
 + intel_buffer_objects.c \
 + intel_buffers.c \
 + intel_clear.c \
 + intel_context.c \
 + intel_decode.c \
 + intel_extensions.c \
 + intel_extensions_es2.c \
 + intel_fbo.c \
 + intel_mipmap_tree.c \
 + intel_regions.c \
 + intel_screen.c \
 + intel_span.c \
 + intel_pixel.c

Re: [Mesa-dev] [PATCH 2/3] egl_dri2: add support for Android

2011-08-26 Thread Chad Versace
On 08/25/2011 11:19 PM, Chia-I Wu wrote:
 On Fri, Aug 26, 2011 at 2:05 PM, Chia-I Wu olva...@gmail.com wrote:
 On Fri, Aug 26, 2011 at 12:55 PM, Chad Versace c...@chad-versace.us wrote:
 [CC'ing krh because I learned much of this from him, so may have some
 insight to share with us.]

 On 08/25/2011 08:14 PM, Chia-I Wu wrote:
 On Fri, Aug 26, 2011 at 4:09 AM, Chad Versace c...@chad-versace.us wrote:
 On 08/24/2011 06:20 PM, Chia-I Wu wrote:
 On Thu, Aug 25, 2011 at 8:58 AM, Chad Versace c...@chad-versace.us 
 wrote:
 Comments below.

 On 08/23/2011 08:10 PM, Chia-I Wu wrote:
 Add platform_android.c that supports _EGL_PLAFORM_ANDROID.  It works
 with drm_gralloc, where back buffers of windows are backed by GEM
 objects.

 In Android a native window has a queue of back buffers allocated by 
 the
 server, through drm_gralloc.  For each frame, EGL needs to

   dequeue the next back buffer
   render to the buffer
   enqueue the buffer

 After enqueuing, the buffer is no longer valid to EGL.  A window has 
 no
 depth buffer or other aux buffers.  They need to be allocated locally 
 by
 EGL.
 ---
  src/egl/drivers/dri2/egl_dri2.c |   89 +
  src/egl/drivers/dri2/egl_dri2.h |   18 +
  src/egl/drivers/dri2/platform_android.c |  588 
 +++
  3 files changed, 695 insertions(+), 0 deletions(-)
  create mode 100644 src/egl/drivers/dri2/platform_android.c

 diff --git a/src/egl/drivers/dri2/platform_android.c 
 b/src/egl/drivers/dri2/platform_android.c
 new file mode 100644
 index 000..d0de94c
 --- /dev/null
 +++ b/src/egl/drivers/dri2/platform_android.c

 [snip]

 +static _EGLSurface *
 +droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
 + _EGLConfig *conf, EGLNativeWindowType window,
 + const EGLint *attrib_list)
 +{
 +   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
 +   struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
 +   struct dri2_egl_surface *dri2_surf;
 +   int format;
 +
 +   (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;
 +   }
 +   if (format != dri2_conf-base.NativeVisualID) {
 +  _eglLog(_EGL_WARNING, Native format mismatch: 0x%x != 0x%x,
 +format, dri2_conf-base.NativeVisualID);
 +   }
 +
 +   dri2_surf = calloc(1, sizeof *dri2_surf);
 +   if (!dri2_surf) {
 +  _eglError(EGL_BAD_ALLOC, droid_create_surface);
 +  return NULL;
 +   }
 +
 +   if (!_eglInitSurface(dri2_surf-base, disp, type, conf, 
 attrib_list))
 +  goto cleanup_surf;

 It seems that droid_get_buffers_with_format() only supports 
 single-buffered
 surfaces. So eglCreateWindowSurface should reject requests for which
 EGL_RENDER_BUFFER != EGL_SINGLE_BUFFER.

  if (dri2_surf-base.RenderBuffer != EGL_SINGLE_BUFFER)
 goto cleanup_surf;
 [CC Benjamin]
 EGL_RENDER_BUFFER is a hint here.  It is fine if the native window
 does not support EGL_SINGLE_BUFFER.


 You're right, specifying EGL_RENDER_BUFFER in eglCreateWindowSurface is 
 just
 a hint. And since the spec says this about eglQuerySurface,
Querying EGL_RENDER_BUFFER returns the buffer which client API 
 rendering
is requested to use. For a window surface, this is the same attribute 
 value specified
when the surface was created.
 we shouldn't alter the requested value of dri2_surf-base.RenderBuffer.

 On the other hand, ctx-WindowRenderBuffer should be set.  It is
 queried by eglQueryContext.  I think it can be set in
 dri2_create_context: to EGL_BACK_BUFFER when there is
 dri_double_config and EGL_SINGLE_BUFFER when there is only
 dri_single_config.  Idea?

 I agree that it seems safe to set ctx-WindowRenderBuffer when there is 
 only a
 dri_single_config. So, to ensure that the EGLConfig passed to
 eglCreateContext does not have a dri_double_config, I think you need
 to add this snippet in droid_add_configs_for_visuals:
   for (i = 0; visuals[i].format; i++) {
  ...
  for (j = 0; dri2_dpy-driver_configs[j]; j++) {
 ...
 /* Maybe this? */
 if (dri2_dpy-driver_configs[j]-modes.doubleBufferMode)
continue;
 /* end suggestion */

 dri2_conf = dri2_add_config(dpy, dri2_dpy-driver_configs[j],
   count + 1, visuals[i].size, EGL_WINDOW_BIT, NULL,
   visuals[i].rgba_masks);
 Also, the call to dri2_dpy-dri2-createNewDrawable should be passed
 dri2_conf-dri_single_config.

 But I am hesitant to set it to EGL_BACK_BUFFER when there is a
 dri2_double_config. If the driver supports rendering to a single buffered
 surface under a context that supports double-buffering, then, if we had 
 set
 ctx-WindowRenderBuffer = EGL_BACK_BUFFER, that would force
 eglQueryContext

[Mesa-dev] [PATCH 0/8] i965, mesa: Build libmesa_dricore and i965_dri for Android

2011-08-26 Thread Chad Versace
This series builds libmesa_dricore.so and i965_dri.so for Android. Along the
way, a few cleanups are necessary.

This just gets the driver to build. I have not tested it yet.

Chad Versace (8):
  android: Remove -fvisibility=hidden from CFLAGS so that we can build
a shared dricore
  mesa: Build libmesa_dricore.so for Android
  make: Document imported variables
  make: Remove duplicate occurence of driverfuncs.c
  make: Factor out source lists from drivers/dri/common into
Makefile.sources
  dri: Build libmesa_dri_common for Android
  i965: Fix Android build by removing relative includes
  i965: Build i965_dri.so for Android

 Android.common.mk  |1 -
 Android.mk |4 +-
 src/mesa/Android.mk|   40 +
 src/mesa/drivers/dri/Android.mk|   61 
 src/mesa/drivers/dri/Makefile.defines  |   24 +++-
 src/mesa/drivers/dri/common/Android.mk |   49 
 src/mesa/drivers/dri/common/Makefile.sources   |   18 ++
 src/mesa/drivers/dri/i965/Android.mk   |   61 
 src/mesa/drivers/dri/i965/Makefile |1 +
 src/mesa/drivers/dri/i965/brw_clip.c   |2 +-
 src/mesa/drivers/dri/i965/brw_context.c|2 +-
 .../drivers/dri/i965/brw_cubemap_normalize.cpp |4 +-
 src/mesa/drivers/dri/i965/brw_eu.c |2 +-
 src/mesa/drivers/dri/i965/brw_eu_emit.c|2 +-
 src/mesa/drivers/dri/i965/brw_fs.cpp   |4 +-
 src/mesa/drivers/dri/i965/brw_fs.h |4 +-
 .../dri/i965/brw_fs_channel_expressions.cpp|6 +-
 src/mesa/drivers/dri/i965/brw_fs_emit.cpp  |2 +-
 src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp  |6 +-
 .../dri/i965/brw_fs_schedule_instructions.cpp  |6 +-
 .../drivers/dri/i965/brw_fs_vector_splitting.cpp   |   10 ++--
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   |6 +-
 src/mesa/drivers/dri/i965/brw_gs.c |2 +-
 src/mesa/drivers/dri/i965/brw_program.c|2 +-
 src/mesa/drivers/dri/i965/brw_sf.c |2 +-
 src/mesa/drivers/dri/i965/brw_shader.cpp   |4 +-
 src/mesa/drivers/dri/i965/brw_state_batch.c|2 +-
 src/mesa/drivers/dri/i965/brw_vec4.h   |2 +-
 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp|2 +-
 .../drivers/dri/i965/brw_vec4_reg_allocate.cpp |2 +-
 src/mesa/drivers/dri/i965/brw_vs.c |2 +-
 src/mesa/drivers/dri/i965/brw_vtbl.c   |2 +-
 src/mesa/drivers/dri/i965/brw_wm.c |2 +-
 33 files changed, 283 insertions(+), 56 deletions(-)
 create mode 100644 src/mesa/drivers/dri/Android.mk
 create mode 100644 src/mesa/drivers/dri/common/Android.mk
 create mode 100644 src/mesa/drivers/dri/common/Makefile.sources
 create mode 100644 src/mesa/drivers/dri/i965/Android.mk

-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/8] android: Remove -fvisibility=hidden from CFLAGS so that we can build a shared dricore

2011-08-26 Thread Chad Versace
If you attempt to link together libmesa_dricore.so from object files built with
visibility=hidden, then the library is useless. It exposes no symbols.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 Android.common.mk |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/Android.common.mk b/Android.common.mk
index 83177a0..6519cbf 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -26,7 +26,6 @@ LOCAL_C_INCLUDES += \
 
 LOCAL_CFLAGS += \
-DPTHREADS \
-   -fvisibility=hidden \
-Wno-sign-compare
 
 ifeq ($(strip $(MESA_ENABLE_ASM)),true)
-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/8] make: Document imported variables

2011-08-26 Thread Chad Versace
In src/mesa/Android.mk, it is non-trivial to determine which variables are
imported by `include sources.mak`. So document them.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/Android.mk |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/mesa/Android.mk b/src/mesa/Android.mk
index ff7d808..8329aa7 100644
--- a/src/mesa/Android.mk
+++ b/src/mesa/Android.mk
@@ -25,6 +25,11 @@
 
 LOCAL_PATH := $(call my-dir)
 
+# Import the following variables:
+# MESA_CXX_SOURCES
+# MESA_GALLIUM_CXX_SOURCES
+# MESA_GALLIUM_SOURCES
+# MESA_SOURCES
 include $(LOCAL_PATH)/sources.mak
 
 common_CFLAGS := \
-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/8] mesa: Build libmesa_dricore.so for Android

2011-08-26 Thread Chad Versace
libmesa_dricore is analogous to the libdricore built by the Autoconf
build.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/Android.mk |   35 +++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/src/mesa/Android.mk b/src/mesa/Android.mk
index 67808d4..ff7d808 100644
--- a/src/mesa/Android.mk
+++ b/src/mesa/Android.mk
@@ -83,6 +83,41 @@ include $(BUILD_STATIC_LIBRARY)
 endif # MESA_BUILD_GALLIUM
 
 # ---
+# Build libmesa_dricore for DRI modules
+# ---
+
+ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libmesa_dricore
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+
+LOCAL_CFLAGS := \
+   $(common_CFLAGS) \
+   -DFEATURE_GL=1
+
+LOCAL_C_INCLUDES := \
+   $(common_C_INCLUDES)
+
+LOCAL_SRC_FILES := \
+$(MESA_SOURCES) \
+$(MESA_CXX_SOURCES) \
+$(common_ASM)
+
+LOCAL_WHOLE_STATIC_LIBRARIES := \
+   libmesa_glsl
+
+LOCAL_SHARED_LIBRARIES := \
+   libglapi
+
+include $(LOCAL_PATH)/Android.gen.mk
+include $(MESA_COMMON_MK)
+include $(BUILD_SHARED_LIBRARY)
+
+endif # MESA_BUILD_CLASSIC
+
+# ---
 # Build libmesa_glsl_utils
 #
 # It is used to avoid circular dependency between core mesa and glsl.
-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 5/8] make: Factor out source lists from drivers/dri/common into Makefile.sources

2011-08-26 Thread Chad Versace
In order that the autoconf and Android build can share the same source
lists, move the lists from
  src/mesa/drivers/dri/Makefile.defines
into
  src/mesa/drivers/dri/common/Makefile.sources

I would like for Android to just reuse Makefile.defines, but the file is
unsuitable for Android.

Signed-off: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/Makefile.defines|   23 ++-
 src/mesa/drivers/dri/common/Makefile.sources |   18 ++
 2 files changed, 28 insertions(+), 13 deletions(-)
 create mode 100644 src/mesa/drivers/dri/common/Makefile.sources

diff --git a/src/mesa/drivers/dri/Makefile.defines 
b/src/mesa/drivers/dri/Makefile.defines
index 90ae551..536bcc6 100644
--- a/src/mesa/drivers/dri/Makefile.defines
+++ b/src/mesa/drivers/dri/Makefile.defines
@@ -1,14 +1,16 @@
 # -*-makefile-*-
 
+# MESA_TOP is relative the driver's directory.
+MESA_TOP := ../../../../..
+
+# Import mesa_dri_common_*
+include $(MESA_TOP)/src/mesa/drivers/dri/common/Makefile.sources
+
 COMMON_GALLIUM_SOURCES = \
-../common/utils.c \
-../common/vblank.c \
-../common/dri_util.c \
-../common/xmlconfig.c
+   $(addprefix ../common/, $(mesa_dri_common_gallium_SOURCES))
 
-COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
-../common/texmem.c \
-../common/drirenderbuffer.c
+COMMON_SOURCES = \
+   $(addprefix ../common/, $(mesa_dri_common_SOURCES))
 
 INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES)
 
@@ -20,13 +22,8 @@ OBJECTS = $(C_SOURCES:.c=.o) \
 ### Include directories
 SHARED_INCLUDES = \
-I. \
-   -I$(TOP)/src/mesa/drivers/dri/common \
-Iserver \
-   -I$(TOP)/include \
-   -I$(TOP)/src/mapi \
-   -I$(TOP)/src/mesa \
-   -I$(TOP)/src/egl/main \
-   -I$(TOP)/src/egl/drivers/dri \
+   $(addprefix -I, $(mesa_dri_common_INCLUDES)) \
$(LIBDRM_CFLAGS)
 
 INCLUDES += $(API_DEFINES)
diff --git a/src/mesa/drivers/dri/common/Makefile.sources 
b/src/mesa/drivers/dri/common/Makefile.sources
new file mode 100644
index 000..bdb6518
--- /dev/null
+++ b/src/mesa/drivers/dri/common/Makefile.sources
@@ -0,0 +1,18 @@
+mesa_dri_common_gallium_SOURCES := \
+   utils.c \
+   vblank.c \
+   dri_util.c \
+   xmlconfig.c
+
+mesa_dri_common_SOURCES := \
+   $(mesa_dri_common_gallium_SOURCES) \
+texmem.c \
+drirenderbuffer.c
+
+mesa_dri_common_INCLUDES := \
+   $(MESA_TOP)/include \
+   $(MESA_TOP)/src/egl/drivers/dri \
+   $(MESA_TOP)/src/egl/main \
+   $(MESA_TOP)/src/mapi \
+   $(MESA_TOP)/src/mesa \
+   $(MESA_TOP)/src/mesa/drivers/dri/common \
-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 4/8] make: Remove duplicate occurence of driverfuncs.c

2011-08-26 Thread Chad Versace
Stop building driverfuncs.c twice for each DRI driver. driverfuncs.c is
included in both libmesa.a and in
src/mesa/drivers/dri/Makefiles.defines:COMMON_SOURCES, so remove it from
COMMON_SOURCES.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/Makefile.defines |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/Makefile.defines 
b/src/mesa/drivers/dri/Makefile.defines
index 19b6de8..90ae551 100644
--- a/src/mesa/drivers/dri/Makefile.defines
+++ b/src/mesa/drivers/dri/Makefile.defines
@@ -7,7 +7,6 @@ COMMON_GALLIUM_SOURCES = \
 ../common/xmlconfig.c
 
 COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
-../../common/driverfuncs.c \
 ../common/texmem.c \
 ../common/drirenderbuffer.c
 
-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 7/8] i965: Fix Android build by removing relative includes

2011-08-26 Thread Chad Versace
Add $(TOP)/src/mesa to include paths and replace each occurence of
  #include ../glsl/*.h
with
  #include glsl/*.h

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i965/Makefile |1 +
 src/mesa/drivers/dri/i965/brw_clip.c   |2 +-
 src/mesa/drivers/dri/i965/brw_context.c|2 +-
 .../drivers/dri/i965/brw_cubemap_normalize.cpp |4 ++--
 src/mesa/drivers/dri/i965/brw_eu.c |2 +-
 src/mesa/drivers/dri/i965/brw_eu_emit.c|2 +-
 src/mesa/drivers/dri/i965/brw_fs.cpp   |4 ++--
 src/mesa/drivers/dri/i965/brw_fs.h |4 ++--
 .../dri/i965/brw_fs_channel_expressions.cpp|6 +++---
 src/mesa/drivers/dri/i965/brw_fs_emit.cpp  |2 +-
 src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp  |6 +++---
 .../dri/i965/brw_fs_schedule_instructions.cpp  |6 +++---
 .../drivers/dri/i965/brw_fs_vector_splitting.cpp   |   10 +-
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   |6 +++---
 src/mesa/drivers/dri/i965/brw_gs.c |2 +-
 src/mesa/drivers/dri/i965/brw_program.c|2 +-
 src/mesa/drivers/dri/i965/brw_sf.c |2 +-
 src/mesa/drivers/dri/i965/brw_shader.cpp   |4 ++--
 src/mesa/drivers/dri/i965/brw_state_batch.c|2 +-
 src/mesa/drivers/dri/i965/brw_vec4.h   |2 +-
 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp|2 +-
 .../drivers/dri/i965/brw_vec4_reg_allocate.cpp |2 +-
 src/mesa/drivers/dri/i965/brw_vs.c |2 +-
 src/mesa/drivers/dri/i965/brw_vtbl.c   |2 +-
 src/mesa/drivers/dri/i965/brw_wm.c |2 +-
 25 files changed, 41 insertions(+), 40 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/Makefile 
b/src/mesa/drivers/dri/i965/Makefile
index 57af7a6..833efa3 100644
--- a/src/mesa/drivers/dri/i965/Makefile
+++ b/src/mesa/drivers/dri/i965/Makefile
@@ -18,6 +18,7 @@ CXX_SOURCES := $(i965_CXX_SOURCES)
 ASM_SOURCES := $(i965_ASM_SOURCES)
 DRIVER_DEFINES := $(addprefix -I, $(i965_INCLUDES))
 
+
 INCLUDES += $(INTEL_CFLAGS)
 DRI_LIB_DEPS += $(INTEL_LIBS)
 
diff --git a/src/mesa/drivers/dri/i965/brw_clip.c 
b/src/mesa/drivers/dri/i965/brw_clip.c
index d82206b..b49c9f4 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.c
+++ b/src/mesa/drivers/dri/i965/brw_clip.c
@@ -42,7 +42,7 @@
 #include brw_state.h
 #include brw_clip.h
 
-#include ../glsl/ralloc.h
+#include glsl/ralloc.h
 
 #define FRONT_UNFILLED_BIT  0x1
 #define BACK_UNFILLED_BIT   0x2
diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index e00e248..898ad8a 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -40,7 +40,7 @@
 #include brw_state.h
 #include intel_span.h
 #include tnl/t_pipeline.h
-#include ../glsl/ralloc.h
+#include glsl/ralloc.h
 
 /***
  * Mesa's Driver Functions
diff --git a/src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp 
b/src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp
index 8574169..ff9485c 100644
--- a/src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp
+++ b/src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp
@@ -30,8 +30,8 @@
  * \author Eric Anholt e...@anholt.net
  */
 
-#include ../glsl/glsl_types.h
-#include ../glsl/ir.h
+#include glsl/glsl_types.h
+#include glsl/ir.h
 
 class brw_cubemap_normalize_visitor : public ir_hierarchical_visitor {
 public:
diff --git a/src/mesa/drivers/dri/i965/brw_eu.c 
b/src/mesa/drivers/dri/i965/brw_eu.c
index c1f2520..0e04af9 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.c
+++ b/src/mesa/drivers/dri/i965/brw_eu.c
@@ -34,7 +34,7 @@
 #include brw_defines.h
 #include brw_eu.h
 
-#include ../glsl/ralloc.h
+#include glsl/ralloc.h
 
 /* Returns the corresponding conditional mod for swapping src0 and
  * src1 in e.g. CMP.
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index c5013de..e8d0998 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -34,7 +34,7 @@
 #include brw_defines.h
 #include brw_eu.h
 
-#include ../glsl/ralloc.h
+#include glsl/ralloc.h
 
 /***
  * Internal helper for constructing instructions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 0b0445e..8b85f3b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -46,8 +46,8 @@ extern C {
 }
 #include brw_shader.h
 #include brw_fs.h
-#include ../glsl/glsl_types.h
-#include ../glsl/ir_print_visitor.h
+#include glsl/glsl_types.h
+#include glsl/ir_print_visitor.h
 
 #define MAX_INSTRUCTION (1  30)
 
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index 10f45f3..49454a5 100644
--- a/src/mesa/drivers/dri

[Mesa-dev] [PATCH 6/8] dri: Build libmesa_dri_common for Android

2011-08-26 Thread Chad Versace
libmesa_dri_common is a static library that contains the sources in
src/mesa/drivers/dri/common. Each DRI driver should link to it.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 Android.mk |1 +
 src/mesa/drivers/dri/common/Android.mk |   49 
 2 files changed, 50 insertions(+), 0 deletions(-)
 create mode 100644 src/mesa/drivers/dri/common/Android.mk

diff --git a/Android.mk b/Android.mk
index 53c619e..ab1778e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -74,6 +74,7 @@ SUBDIRS := \
src/mapi \
src/glsl \
src/mesa \
+   src/mesa/drivers/dri/common \
src/egl/main
 
 ifeq ($(strip $(MESA_BUILD_GALLIUM)),true)
diff --git a/src/mesa/drivers/dri/common/Android.mk 
b/src/mesa/drivers/dri/common/Android.mk
new file mode 100644
index 000..93982cc
--- /dev/null
+++ b/src/mesa/drivers/dri/common/Android.mk
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2011 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 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+# Import variables mesa_dri_common_*.
+include $(LOCAL_PATH)/Makefile.sources
+
+#---
+# Build libmesa_dri_common
+#---
+
+ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libmesa_dri_common
+
+LOCAL_C_INCLUDES := \
+   $(mesa_dri_common_INCLUDES) \
+   $(DRM_TOP) \
+   $(DRM_TOP)/include/drm \
+   external/expat/lib
+
+LOCAL_SRC_FILES := \
+   $(mesa_dri_common_SOURCES)
+
+include $(MESA_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
+
+endif # MESA_BUILD_CLASSIC
-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 8/8] i965: Build i965_dri.so for Android

2011-08-26 Thread Chad Versace
This just gets the driver to build. I have not yet tested if the driver
actually works.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 Android.mk   |3 +-
 src/mesa/drivers/dri/Android.mk  |   61 ++
 src/mesa/drivers/dri/i965/Android.mk |   61 ++
 3 files changed, 124 insertions(+), 1 deletions(-)
 create mode 100644 src/mesa/drivers/dri/Android.mk
 create mode 100644 src/mesa/drivers/dri/i965/Android.mk

diff --git a/Android.mk b/Android.mk
index ab1778e..e9711ba 100644
--- a/Android.mk
+++ b/Android.mk
@@ -35,7 +35,7 @@ MESA_PYTHON2 := python
 DRM_TOP := external/drm
 DRM_GRALLOC_TOP := hardware/drm_gralloc
 
-classic_drivers :=
+classic_drivers := i965
 gallium_drivers := swrast r600g
 
 MESA_GPU_DRIVERS := $(BOARD_GPU_DRIVERS)
@@ -74,6 +74,7 @@ SUBDIRS := \
src/mapi \
src/glsl \
src/mesa \
+   src/mesa/drivers/dri \
src/mesa/drivers/dri/common \
src/egl/main
 
diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
new file mode 100644
index 000..c0a1da3
--- /dev/null
+++ b/src/mesa/drivers/dri/Android.mk
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2011 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 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+# Import mesa_dri_common_INCLUDES.
+include $(LOCAL_PATH)/common/Makefile.sources
+
+#---
+# Variables common to all DRI drivers
+
+MESA_DRI_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/dri
+MESA_DRI_MODULE_UNSTRIPPED_PATH := 
$(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/dri
+
+MESA_DRI_C_INCLUDES := \
+   $(mesa_dri_common_INCLUDES) \
+   $(DRM_TOP) \
+   $(DRM_TOP)/include/drm \
+   external/expat/lib
+
+MESA_DRI_WHOLE_STATIC_LIBRARIES := \
+   libmesa_dri_common
+
+MESA_DRI_SHARED_LIBRARIES := \
+   libcutils \
+   libdl \
+   libdrm \
+   libexpat \
+   libglapi \
+   liblog \
+   libmesa_dricore
+
+#---
+# Build drivers
+
+drivers :=
+
+ifneq ($(filter i965, $(MESA_GPU_DRIVERS)),)
+   drivers += i965
+endif
+
+include $(patsubst %, $(LOCAL_PATH)/%/Android.mk, $(drivers))
diff --git a/src/mesa/drivers/dri/i965/Android.mk 
b/src/mesa/drivers/dri/i965/Android.mk
new file mode 100644
index 000..3925ef3
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/Android.mk
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2011 Intel Corporation
+# Copyright (C) 2010-2011 Chia-I Wu olva...@gmail.com
 
+# Copyright (C) 2010-2011 LunarG 
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the Software),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := i965_dri
+LOCAL_MODULE_PATH := $(MESA_DRI_MODULE_PATH)
+LOCAL_UNSTRIPPED_PATH := $(MESA_DRI_MODULE_UNSTRIPPED_PATH)
+
+# Import variables i965_*.
+include $(LOCAL_PATH)/Makefile.sources

Re: [Mesa-dev] [PATCH 5/8] make: Factor out source lists from drivers/dri/common into Makefile.sources

2011-08-28 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/26/2011 10:56 PM, Chia-I Wu wrote:
 On Sat, Aug 27, 2011 at 9:53 AM, Chad Versace c...@chad-versace.us wrote:
 In order that the autoconf and Android build can share the same source
 lists, move the lists from
  src/mesa/drivers/dri/Makefile.defines
 into
  src/mesa/drivers/dri/common/Makefile.sources

 I would like for Android to just reuse Makefile.defines, but the file is
 unsuitable for Android.

 Signed-off: Chad Versace c...@chad-versace.us
 ---
  src/mesa/drivers/dri/Makefile.defines|   23 ++-
  src/mesa/drivers/dri/common/Makefile.sources |   18 ++
  2 files changed, 28 insertions(+), 13 deletions(-)
  create mode 100644 src/mesa/drivers/dri/common/Makefile.sources

 diff --git a/src/mesa/drivers/dri/Makefile.defines 
 b/src/mesa/drivers/dri/Makefile.defines
 index 90ae551..536bcc6 100644
 --- a/src/mesa/drivers/dri/Makefile.defines
 +++ b/src/mesa/drivers/dri/Makefile.defines
 @@ -1,14 +1,16 @@
  # -*-makefile-*-

 +# MESA_TOP is relative the driver's directory.
 +MESA_TOP := ../../../../..
 +
 +# Import mesa_dri_common_*
 +include $(MESA_TOP)/src/mesa/drivers/dri/common/Makefile.sources
 +
  COMMON_GALLIUM_SOURCES = \
 -../common/utils.c \
 -../common/vblank.c \
 -../common/dri_util.c \
 -../common/xmlconfig.c
 +   $(addprefix ../common/, $(mesa_dri_common_gallium_SOURCES))

 -COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
 -../common/texmem.c \
 -../common/drirenderbuffer.c
 +COMMON_SOURCES = \
 +   $(addprefix ../common/, $(mesa_dri_common_SOURCES))

  INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES)

 @@ -20,13 +22,8 @@ OBJECTS = $(C_SOURCES:.c=.o) \
  ### Include directories
  SHARED_INCLUDES = \
-I. \
 -   -I$(TOP)/src/mesa/drivers/dri/common \
-Iserver \
 -   -I$(TOP)/include \
 -   -I$(TOP)/src/mapi \
 -   -I$(TOP)/src/mesa \
 -   -I$(TOP)/src/egl/main \
 -   -I$(TOP)/src/egl/drivers/dri \
 +   $(addprefix -I, $(mesa_dri_common_INCLUDES)) \
$(LIBDRM_CFLAGS)

  INCLUDES += $(API_DEFINES)
 diff --git a/src/mesa/drivers/dri/common/Makefile.sources 
 b/src/mesa/drivers/dri/common/Makefile.sources
 new file mode 100644
 index 000..bdb6518
 --- /dev/null
 +++ b/src/mesa/drivers/dri/common/Makefile.sources
 @@ -0,0 +1,18 @@
 +mesa_dri_common_gallium_SOURCES := \
 +   utils.c \
 +   vblank.c \
 +   dri_util.c \
 +   xmlconfig.c
 +
 +mesa_dri_common_SOURCES := \
 +   $(mesa_dri_common_gallium_SOURCES) \
 +texmem.c \
 +drirenderbuffer.c
 +
 +mesa_dri_common_INCLUDES := \
 +   $(MESA_TOP)/include \
 +   $(MESA_TOP)/src/egl/drivers/dri \
 +   $(MESA_TOP)/src/egl/main \
 +   $(MESA_TOP)/src/mapi \
 +   $(MESA_TOP)/src/mesa \
 +   $(MESA_TOP)/src/mesa/drivers/dri/common \

 Not a strong opinion here, but is it possible to make Makefile.sources
 self-contained?  That is, no dependency on MESA_TOP.

Sure, we can do that, as long as we maintain the convention that x_INCLUDES in 
Makefile.sources
is always relative to MESA_TOP. Then each user of Makefile.sources will need to 
prefix
x_INCLUDES accordingly.

I'm posting a v2 of this series which will have the change.

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOWmHgAAoJEAIvNt057x8ikjIP/AmGzsDjTNcjf/hYHa1+RB5s
w9gQPNsm4DGHRJoqvO33sx7UA74pqWRj8PUQCjyq9hHjzNVlV1zTxvIzfJA7pKYk
fhibj3n9cItS2z4yeySt8CWLiRpkdXRWWy/kF1ivv+YL1+b+NxW/4IFNNBtyyfls
HSXv3JMPJk3T09uWvuygDoPaIY+VsMbg1fmfoutEDesSGdDZjqu0ihSfHqYGCK15
kw2d088/5YLAJo4IvSznYebrC7+i/kL8qLohCT7rNCzAji6LuH90zihELFFuf/yz
J8YvtK4NTD6iRgo70GJuYs/LCrZeEpSu/DuBqqKWQNjEyaGrRSuYw5enCAXRBgxz
dWFZhSoy5sMoIEtWQXiMmZdHbZ3aqy/kfYIWUQWECG2wTpBtZWP9sG/8arHR+j7v
i+ui4mDlx7CAguTZCGCgl/4KMOiPXrQl+xnowB+JYV2sdOkwCr1t7bhQ8GpP+q4a
oLy6iRWJkqpTjAqb3kAW1O0mUYy3G+oRH3VqdWQe23FZBKVCd02GpLkPSGfe4Kv8
cWJlFfthWAbdpAO4JjH4bMI4Ld8xxopdksTRagCFzdkMyRKWMfaZentlaSIHu68B
oGPPIMrK8THmWtSRfD6rz59m9TwCv7xmTgrr4gdQ0e0o58UwUufNqrH4ipYmWdFB
Y4XkP27hiJWft8QWwP0j
=i8oO
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 8/8] i965: Build i965_dri.so for Android

2011-08-28 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/26/2011 10:51 PM, Chia-I Wu wrote:
 On Sat, Aug 27, 2011 at 9:54 AM, Chad Versace c...@chad-versace.us wrote:
 This just gets the driver to build. I have not yet tested if the driver
 actually works.

 Signed-off-by: Chad Versace c...@chad-versace.us
 ---
  Android.mk   |3 +-
  src/mesa/drivers/dri/Android.mk  |   61 
 ++
  src/mesa/drivers/dri/i965/Android.mk |   61 
 ++
  3 files changed, 124 insertions(+), 1 deletions(-)
  create mode 100644 src/mesa/drivers/dri/Android.mk
  create mode 100644 src/mesa/drivers/dri/i965/Android.mk

 diff --git a/Android.mk b/Android.mk
 index ab1778e..e9711ba 100644
 --- a/Android.mk
 +++ b/Android.mk
 @@ -35,7 +35,7 @@ MESA_PYTHON2 := python
  DRM_TOP := external/drm
  DRM_GRALLOC_TOP := hardware/drm_gralloc

 -classic_drivers :=
 +classic_drivers := i965
 Please also update the comments at the top.  BTW, I am fine replacing
 all classic/CLASSIC by dri/DRI if that is preferred.

I'll update the comment.

I think we should rename CLASSIC to DRI too, but we can do that after
these patches land.

 
  gallium_drivers := swrast r600g

  MESA_GPU_DRIVERS := $(BOARD_GPU_DRIVERS)
 @@ -74,6 +74,7 @@ SUBDIRS := \
src/mapi \
src/glsl \
src/mesa \
 +   src/mesa/drivers/dri \
src/mesa/drivers/dri/common \
src/egl/main
 The directory should be added only when MESA_BUILD_CLASSIC is true.
 
 Is it cleaner to remove src/mesa/drivers/dri/common from here and let
 src/mesa/drivers/dri/Android.mk handle it?  So it will be the
 Android.mk in charge of DRI drivers, similar to the role of
 src/gallium/Android.mk.

Agreed. I'll fix that in v2.

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOWmgnAAoJEAIvNt057x8i2BIP/27srdBNDGUDxutA0tDbBwoi
PUxxKn63G1NHBfxoe+NeI+3RmLeF/5M0+FP6+k3Y5GYajsKDz+MAXwNsLi5ji6MF
ka4bFJYPeEDhmjn+9I2rR0bQICoUOYneVFm83tv8l0ZbwMGGJyg2ZxafN4GZbNEZ
g22Cs9zWfP9D/3qLHkPmSVOrYup2ri1XSniTXTuZOcylRaIEmj5DRxDMnCFBQj7B
ZxJ18mC31EqqGxvFrozqd3tcsbuV/dZ5P6yV0HXnI4lyZeopF7iYn9dvK7yDDvH3
Xk/frOnR9LwHJ0dflULD0SsQCRjKgcKbdD7Q16d4fVVj06U0krKjkjUUw31eYbnw
uFMQTCzjmVngebc+RM6wfHyEUJ15qCtuujchi01d1Tbk8Bls6lzrsZeDSCTPxAJb
1XpbHszON2JIs3iGKVeyYbF9hvUUauFKR+fDZcNfOSaYm2tijI+/3+JH9XMxBo6U
3Kjlh6KRNWxTgbC4PdSjyFRaeZwHugWs2LkYC6EAD46yYECh63rp8xmu1E2+icc/
NaAoY2DTXfCXIhxtrdh0D2DCcttSZL02oKsdAvWcE9aqUNjn5RLP6zmlf8BBsgWY
fDXi1L40yR45XFmpujdjNzROif96Do8HPjzD2SqHYBoLG7BZAd9dn81TgXcPdPwQ
3Twqm8MeJUdV/5s1aaTK
=yX3O
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 7/8] i965: Fix Android build by removing relative includes

2011-08-28 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Spurious whitespace is fixed in v2.

On 08/27/2011 12:19 AM, Ian Romanick wrote:
 On 08/26/2011 06:54 PM, Chad Versace wrote:
 Add $(TOP)/src/mesa to include paths and replace each occurence of
   #include ../glsl/*.h
 with
   #include glsl/*.h
 
 Signed-off-by: Chad Versace c...@chad-versace.us
 ---
  src/mesa/drivers/dri/i965/Makefile |1 +
  src/mesa/drivers/dri/i965/brw_clip.c   |2 +-
  src/mesa/drivers/dri/i965/brw_context.c|2 +-
  .../drivers/dri/i965/brw_cubemap_normalize.cpp |4 ++--
  src/mesa/drivers/dri/i965/brw_eu.c |2 +-
  src/mesa/drivers/dri/i965/brw_eu_emit.c|2 +-
  src/mesa/drivers/dri/i965/brw_fs.cpp   |4 ++--
  src/mesa/drivers/dri/i965/brw_fs.h |4 ++--
  .../dri/i965/brw_fs_channel_expressions.cpp|6 +++---
  src/mesa/drivers/dri/i965/brw_fs_emit.cpp  |2 +-
  src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp  |6 +++---
  .../dri/i965/brw_fs_schedule_instructions.cpp  |6 +++---
  .../drivers/dri/i965/brw_fs_vector_splitting.cpp   |   10 +-
  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   |6 +++---
  src/mesa/drivers/dri/i965/brw_gs.c |2 +-
  src/mesa/drivers/dri/i965/brw_program.c|2 +-
  src/mesa/drivers/dri/i965/brw_sf.c |2 +-
  src/mesa/drivers/dri/i965/brw_shader.cpp   |4 ++--
  src/mesa/drivers/dri/i965/brw_state_batch.c|2 +-
  src/mesa/drivers/dri/i965/brw_vec4.h   |2 +-
  src/mesa/drivers/dri/i965/brw_vec4_emit.cpp|2 +-
  .../drivers/dri/i965/brw_vec4_reg_allocate.cpp |2 +-
  src/mesa/drivers/dri/i965/brw_vs.c |2 +-
  src/mesa/drivers/dri/i965/brw_vtbl.c   |2 +-
  src/mesa/drivers/dri/i965/brw_wm.c |2 +-
  25 files changed, 41 insertions(+), 40 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/i965/Makefile 
 b/src/mesa/drivers/dri/i965/Makefile
 index 57af7a6..833efa3 100644
 --- a/src/mesa/drivers/dri/i965/Makefile
 +++ b/src/mesa/drivers/dri/i965/Makefile
 @@ -18,6 +18,7 @@ CXX_SOURCES := $(i965_CXX_SOURCES)
  ASM_SOURCES := $(i965_ASM_SOURCES)
  DRIVER_DEFINES := $(addprefix -I, $(i965_INCLUDES))
 
 +
 
 Spurious whitespace.
 
  INCLUDES += $(INTEL_CFLAGS)
  DRI_LIB_DEPS += $(INTEL_LIBS)
 
 diff --git a/src/mesa/drivers/dri/i965/brw_clip.c 
 b/src/mesa/drivers/dri/i965/brw_clip.c
 index d82206b..b49c9f4 100644
 --- a/src/mesa/drivers/dri/i965/brw_clip.c
 +++ b/src/mesa/drivers/dri/i965/brw_clip.c
 @@ -42,7 +42,7 @@
  #include brw_state.h
  #include brw_clip.h
 
 -#include ../glsl/ralloc.h
 +#include glsl/ralloc.h
 
  #define FRONT_UNFILLED_BIT  0x1
  #define BACK_UNFILLED_BIT   0x2
 diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
 b/src/mesa/drivers/dri/i965/brw_context.c
 index e00e248..898ad8a 100644
 --- a/src/mesa/drivers/dri/i965/brw_context.c
 +++ b/src/mesa/drivers/dri/i965/brw_context.c
 @@ -40,7 +40,7 @@
  #include brw_state.h
  #include intel_span.h
  #include tnl/t_pipeline.h
 -#include ../glsl/ralloc.h
 +#include glsl/ralloc.h
 
  /***
   * Mesa's Driver Functions
 diff --git a/src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp 
 b/src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp
 index 8574169..ff9485c 100644
 --- a/src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp
 @@ -30,8 +30,8 @@
   * \author Eric Anholt e...@anholt.net
   */
 
 -#include ../glsl/glsl_types.h
 -#include ../glsl/ir.h
 +#include glsl/glsl_types.h
 +#include glsl/ir.h
 
  class brw_cubemap_normalize_visitor : public ir_hierarchical_visitor {
  public:
 diff --git a/src/mesa/drivers/dri/i965/brw_eu.c 
 b/src/mesa/drivers/dri/i965/brw_eu.c
 index c1f2520..0e04af9 100644
 --- a/src/mesa/drivers/dri/i965/brw_eu.c
 +++ b/src/mesa/drivers/dri/i965/brw_eu.c
 @@ -34,7 +34,7 @@
  #include brw_defines.h
  #include brw_eu.h
 
 -#include ../glsl/ralloc.h
 +#include glsl/ralloc.h
 
  /* Returns the corresponding conditional mod for swapping src0 and
   * src1 in e.g. CMP.
 diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
 b/src/mesa/drivers/dri/i965/brw_eu_emit.c
 index c5013de..e8d0998 100644
 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
 +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
 @@ -34,7 +34,7 @@
  #include brw_defines.h
  #include brw_eu.h
 
 -#include ../glsl/ralloc.h
 +#include glsl/ralloc.h
 
  /***
   * Internal helper for constructing instructions
 diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
 b/src/mesa/drivers/dri/i965/brw_fs.cpp
 index 0b0445e..8b85f3b 100644
 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
 +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
 @@ -46,8 +46,8 @@ extern C {
  }
  #include brw_shader.h
  #include

[Mesa-dev] [PATCH 0/3] make: A few small cleanups

2011-08-29 Thread Chad Versace
Chad Versace (3):
  make: Remove duplicate defintion of COMMON_SOURCES in Radeon
makefiles
  make: Remove duplicate occurence of driverfuncs.c
  make: Factor out source lists from drivers/dri/common into
Makefile.sources

 src/mesa/drivers/dri/Makefile.defines|   21 +++--
 src/mesa/drivers/dri/common/Makefile.sources |   19 +++
 src/mesa/drivers/dri/r300/Makefile   |9 -
 src/mesa/drivers/dri/r600/Makefile   |9 -
 src/mesa/drivers/dri/swrast/Makefile |1 -
 5 files changed, 26 insertions(+), 33 deletions(-)
 create mode 100644 src/mesa/drivers/dri/common/Makefile.sources

-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] make: Remove duplicate defintion of COMMON_SOURCES in Radeon makefiles

2011-08-29 Thread Chad Versace
Remove defintion of COMMON_SOURCES from {r300,r660}/Makefile. The
defintion is a duplicate of that found in
src/mesa/drivers/dri/Makefile.defines.

CC: Ian Romanick i...@freedesktop.org
Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/r300/Makefile |9 -
 src/mesa/drivers/dri/r600/Makefile |9 -
 2 files changed, 0 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/Makefile 
b/src/mesa/drivers/dri/r300/Makefile
index 9f23a84..a0a00e0 100644
--- a/src/mesa/drivers/dri/r300/Makefile
+++ b/src/mesa/drivers/dri/r300/Makefile
@@ -11,15 +11,6 @@ ifeq ($(RADEON_LDFLAGS),)
 CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
 endif
 
-COMMON_SOURCES = \
-   ../../common/driverfuncs.c \
-   ../common/drirenderbuffer.c \
-   ../common/utils.c \
-   ../common/texmem.c \
-   ../common/vblank.c \
-   ../common/xmlconfig.c \
-   ../common/dri_util.c
-
 RADEON_COMMON_SOURCES = \
radeon_bo_legacy.c \
radeon_buffer_objects.c \
diff --git a/src/mesa/drivers/dri/r600/Makefile 
b/src/mesa/drivers/dri/r600/Makefile
index bec0b5a..2adc352 100644
--- a/src/mesa/drivers/dri/r600/Makefile
+++ b/src/mesa/drivers/dri/r600/Makefile
@@ -11,15 +11,6 @@ ifeq ($(RADEON_LDFLAGS),)
 CS_SOURCES = radeon_cs_space_drm.c radeon_bo.c radeon_cs.c
 endif
 
-COMMON_SOURCES = \
-   ../../common/driverfuncs.c \
-   ../common/drirenderbuffer.c \
-   ../common/utils.c \
-   ../common/texmem.c \
-   ../common/vblank.c \
-   ../common/xmlconfig.c \
-   ../common/dri_util.c
-
 RADEON_COMMON_SOURCES = \
radeon_bo_legacy.c \
radeon_common_context.c \
-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/3] make: Remove duplicate occurence of driverfuncs.c

2011-08-29 Thread Chad Versace
driverfuncs.o is already contained in libmesa.a, so remove it from the
following source lists:
src/mesa/drivers/dri/Makefiles.defines:COMMON_SOURCES.
src/mesa/drivers/dri/swrast/Makefile:SWRAST_COMMON_SOURCES

v2

- [idr] Also remove driverfuncs.c from swrast/Makefile.
- [idr] Fix commit message. For the autoconf build, it was incorrect to say
  that driverfuncs.o was built twice.

CC: Ian Romanick i...@freedesktop.org
Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/Makefile.defines |1 -
 src/mesa/drivers/dri/swrast/Makefile  |1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/Makefile.defines 
b/src/mesa/drivers/dri/Makefile.defines
index 19b6de8..90ae551 100644
--- a/src/mesa/drivers/dri/Makefile.defines
+++ b/src/mesa/drivers/dri/Makefile.defines
@@ -7,7 +7,6 @@ COMMON_GALLIUM_SOURCES = \
 ../common/xmlconfig.c
 
 COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
-../../common/driverfuncs.c \
 ../common/texmem.c \
 ../common/drirenderbuffer.c
 
diff --git a/src/mesa/drivers/dri/swrast/Makefile 
b/src/mesa/drivers/dri/swrast/Makefile
index 4cb99fd..509fa28 100644
--- a/src/mesa/drivers/dri/swrast/Makefile
+++ b/src/mesa/drivers/dri/swrast/Makefile
@@ -20,7 +20,6 @@ C_SOURCES = \
 ASM_SOURCES =
 
 SWRAST_COMMON_SOURCES = \
-   ../../common/driverfuncs.c \
../common/utils.c \
../common/drisw_util.c
 
-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/3] make: Factor out source lists from drivers/dri/common into Makefile.sources

2011-08-29 Thread Chad Versace
In order that the Autoconf and Android build can share the same source
lists, move the lists from
src/mesa/drivers/dri/Makefile.defines
into
src/mesa/drivers/dri/common/Makefile.sources

I would like for Android to just reuse Makefile.defines, but the file is
unsuitable for reuse.

v2

- [olv] Remove MESA_TOP from definition of *_INCLUDES so that
  Makefile.sources can be self-contained.

CC: Chia-I Wu o...@lunarg.com
Signed-off: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/Makefile.defines|   20 +++-
 src/mesa/drivers/dri/common/Makefile.sources |   19 +++
 2 files changed, 26 insertions(+), 13 deletions(-)
 create mode 100644 src/mesa/drivers/dri/common/Makefile.sources

diff --git a/src/mesa/drivers/dri/Makefile.defines 
b/src/mesa/drivers/dri/Makefile.defines
index 90ae551..6ff8df5 100644
--- a/src/mesa/drivers/dri/Makefile.defines
+++ b/src/mesa/drivers/dri/Makefile.defines
@@ -1,14 +1,13 @@
 # -*-makefile-*-
 
+# Import mesa_dri_common_*
+include ../common/Makefile.sources
+
 COMMON_GALLIUM_SOURCES = \
-../common/utils.c \
-../common/vblank.c \
-../common/dri_util.c \
-../common/xmlconfig.c
+   $(addprefix ../common/, $(mesa_dri_common_gallium_SOURCES))
 
-COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
-../common/texmem.c \
-../common/drirenderbuffer.c
+COMMON_SOURCES = \
+   $(addprefix ../common/, $(mesa_dri_common_SOURCES))
 
 INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES)
 
@@ -20,13 +19,8 @@ OBJECTS = $(C_SOURCES:.c=.o) \
 ### Include directories
 SHARED_INCLUDES = \
-I. \
-   -I$(TOP)/src/mesa/drivers/dri/common \
-Iserver \
-   -I$(TOP)/include \
-   -I$(TOP)/src/mapi \
-   -I$(TOP)/src/mesa \
-   -I$(TOP)/src/egl/main \
-   -I$(TOP)/src/egl/drivers/dri \
+   $(addprefix -I$(TOP)/, $(mesa_dri_common_INCLUDES)) \
$(LIBDRM_CFLAGS)
 
 INCLUDES += $(API_DEFINES)
diff --git a/src/mesa/drivers/dri/common/Makefile.sources 
b/src/mesa/drivers/dri/common/Makefile.sources
new file mode 100644
index 000..22df2f0
--- /dev/null
+++ b/src/mesa/drivers/dri/common/Makefile.sources
@@ -0,0 +1,19 @@
+mesa_dri_common_gallium_SOURCES := \
+   utils.c \
+   vblank.c \
+   dri_util.c \
+   xmlconfig.c
+
+mesa_dri_common_SOURCES := \
+   $(mesa_dri_common_gallium_SOURCES) \
+texmem.c \
+drirenderbuffer.c
+
+# Paths are relative to MESA_TOP.
+mesa_dri_common_INCLUDES := \
+   include \
+   src/egl/drivers/dri \
+   src/egl/main \
+   src/mapi \
+   src/mesa \
+   src/mesa/drivers/dri/common \
-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/8] i965, mesa: Build libmesa_dricore and i965_dri for Android

2011-08-29 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

v2 of this series has been posted.

- -- 
Chad Versace
c...@chad-versace.us

On 08/26/2011 06:53 PM, Chad Versace wrote:
 This series builds libmesa_dricore.so and i965_dri.so for Android. Along the
 way, a few cleanups are necessary.
 
 This just gets the driver to build. I have not tested it yet.
 
 Chad Versace (8):
   android: Remove -fvisibility=hidden from CFLAGS so that we can build
 a shared dricore
   mesa: Build libmesa_dricore.so for Android
   make: Document imported variables
   make: Remove duplicate occurence of driverfuncs.c
   make: Factor out source lists from drivers/dri/common into
 Makefile.sources
   dri: Build libmesa_dri_common for Android
   i965: Fix Android build by removing relative includes
   i965: Build i965_dri.so for Android


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOW99BAAoJEAIvNt057x8i2rUP/23cS39dkzdLbd2D4tm4OHAz
M+DbsskfwViayxvVbMnNiLJ2EdXDV5alMOuXLKDvo2OTo54rGgA7SriAKSkLU6I+
V162qTFSfmEOXTW2xMmVapvPR5mj1sJ8tt3/BUaxOUJJ8cs4XWk+oirCEnTmCyQA
uP0haL8laPJeVzcuWEgcw9tlgKWjZEwGrepMK68U1lo3fQGSGfxbmuCCmkd2k01c
P47pSoceZGwKB77rU5t/cSQTTnDO1dNHPqeDiel3rwJx6rnIIg/7ZYeEi2COSsfJ
psTyRk6mz/1a2lfHUngJax0Hci9+CHqnAE2Zi4qcPwwIrK0insybMftYJ93twkmw
J1JfZH4tgKHq430PzFtIm3tGFceVqMo1WEUgftgFIobKWmYYbRet/fhEEj4+U4rz
TbT2y/q+yA6s25KQawf6TeZ0usgDjmuZvDN+i5Z1GoO72QgeISca9YNUtARW0rBI
rHkpZzYqx2XoeLnlHhp5q6BnpZH6eWohrhbIHv1wCAY7YvIIpwcKyhfqtyz2DBbH
3D0tYjaPGP6n0croBNtggrWKsCDiLdXJvM5rBPU3XPa3xBae1dudGLdzdBdJdxyC
BjrCB903u1azY9B7LFr17exHVAQODQc3S+asofdo4IFbLQ0grtq4NguWP3FocaPS
UamkdTokER/7Sn8VSy/M
=gua1
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [v2 PATCH 0/5] i965, mesa: Build libmesa_dricore and i965_dri for Android

2011-08-29 Thread Chad Versace
This series builds libmesa_dricore.a and i965_dri.so for Android. Along the
way, a few cleanups are necessary.

Note: This series depends on another series I posted to mesa-dev:
  [PATCH 0/3] make: A few small cleanups

This just gets the driver to build. I have not tested it yet.

v2

Changes noted in each patch.

Chad Versace (5):
  mesa: Build libmesa_dricore.a for Android
  make: Document imported variables
  dri: Build libmesa_dri_common for Android
  i965: Fix Android build by removing relative includes
  i965: Build i965_dri.so for Android

 Android.mk |8 ++-
 src/mesa/Android.mk|   35 +++
 src/mesa/drivers/dri/Android.mk|   62 
 src/mesa/drivers/dri/common/Android.mk |   41 +
 src/mesa/drivers/dri/i965/Android.mk   |   61 +++
 src/mesa/drivers/dri/i965/brw_clip.c   |2 +-
 src/mesa/drivers/dri/i965/brw_context.c|2 +-
 .../drivers/dri/i965/brw_cubemap_normalize.cpp |4 +-
 src/mesa/drivers/dri/i965/brw_eu.c |2 +-
 src/mesa/drivers/dri/i965/brw_eu_emit.c|2 +-
 src/mesa/drivers/dri/i965/brw_fs.cpp   |4 +-
 src/mesa/drivers/dri/i965/brw_fs.h |4 +-
 .../dri/i965/brw_fs_channel_expressions.cpp|6 +-
 src/mesa/drivers/dri/i965/brw_fs_emit.cpp  |2 +-
 src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp  |6 +-
 .../dri/i965/brw_fs_schedule_instructions.cpp  |6 +-
 .../drivers/dri/i965/brw_fs_vector_splitting.cpp   |   10 ++--
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   |6 +-
 src/mesa/drivers/dri/i965/brw_gs.c |2 +-
 src/mesa/drivers/dri/i965/brw_program.c|2 +-
 src/mesa/drivers/dri/i965/brw_sf.c |2 +-
 src/mesa/drivers/dri/i965/brw_shader.cpp   |4 +-
 src/mesa/drivers/dri/i965/brw_state_batch.c|2 +-
 src/mesa/drivers/dri/i965/brw_vec4.h   |2 +-
 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp|2 +-
 .../drivers/dri/i965/brw_vec4_reg_allocate.cpp |2 +-
 src/mesa/drivers/dri/i965/brw_vs.c |2 +-
 src/mesa/drivers/dri/i965/brw_vtbl.c   |2 +-
 src/mesa/drivers/dri/i965/brw_wm.c |2 +-
 29 files changed, 244 insertions(+), 43 deletions(-)
 create mode 100644 src/mesa/drivers/dri/Android.mk
 create mode 100644 src/mesa/drivers/dri/common/Android.mk
 create mode 100644 src/mesa/drivers/dri/i965/Android.mk

-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/5] mesa: Build libmesa_dricore.a for Android

2011-08-29 Thread Chad Versace
libmesa_dricore.a is analogous to the libmesa.a built by the Autoconf
build.

v2

- Change libmesa_dricore from a shared library to a static library.
  I decided to make this change after realizing that libmesa_dricore.so
  indiscriminately exported all its symbols.

CC: Ian Romanick i...@freedesktop.org
CC: Chia-I Wu o...@lunarg.com
Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/Android.mk |   29 +
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/mesa/Android.mk b/src/mesa/Android.mk
index 67808d4..5f0f4af 100644
--- a/src/mesa/Android.mk
+++ b/src/mesa/Android.mk
@@ -83,6 +83,35 @@ include $(BUILD_STATIC_LIBRARY)
 endif # MESA_BUILD_GALLIUM
 
 # ---
+# Build libmesa_dricore for DRI modules
+# ---
+
+ifeq ($(strip $(MESA_BUILD_CLASSIC)),true)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libmesa_dricore
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+
+LOCAL_CFLAGS := \
+   $(common_CFLAGS) \
+   -DFEATURE_GL=1
+
+LOCAL_C_INCLUDES := \
+   $(common_C_INCLUDES)
+
+LOCAL_SRC_FILES := \
+$(MESA_SOURCES) \
+$(MESA_CXX_SOURCES) \
+$(common_ASM)
+
+include $(LOCAL_PATH)/Android.gen.mk
+include $(MESA_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
+
+endif # MESA_BUILD_CLASSIC
+
+# ---
 # Build libmesa_glsl_utils
 #
 # It is used to avoid circular dependency between core mesa and glsl.
-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/5] make: Document imported variables

2011-08-29 Thread Chad Versace
In src/mesa/Android.mk, it is non-trivial to determine which variables are
imported by `include sources.mak`. So document them.

v2

- [olv] Add X86_sources to list of documented variables.

CC: Chia-I Wu o...@lunarg.com
Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/Android.mk |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/mesa/Android.mk b/src/mesa/Android.mk
index 5f0f4af..f21ba3a 100644
--- a/src/mesa/Android.mk
+++ b/src/mesa/Android.mk
@@ -25,6 +25,12 @@
 
 LOCAL_PATH := $(call my-dir)
 
+# Import the following variables:
+# MESA_CXX_SOURCES
+# MESA_GALLIUM_CXX_SOURCES
+# MESA_GALLIUM_SOURCES
+# MESA_SOURCES
+# X86_SOURCES
 include $(LOCAL_PATH)/sources.mak
 
 common_CFLAGS := \
-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/3] make: Factor out source lists from drivers/dri/common into Makefile.sources

2011-08-30 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/29/2011 08:46 PM, Chia-I Wu wrote:
 On Tue, Aug 30, 2011 at 2:43 AM, Chad Versace c...@chad-versace.us wrote:
 In order that the Autoconf and Android build can share the same source
 lists, move the lists from
src/mesa/drivers/dri/Makefile.defines
 into
src/mesa/drivers/dri/common/Makefile.sources

 I would like for Android to just reuse Makefile.defines, but the file is
 unsuitable for reuse.

 v2
 
 - [olv] Remove MESA_TOP from definition of *_INCLUDES so that
  Makefile.sources can be self-contained.

 CC: Chia-I Wu o...@lunarg.com
 Signed-off: Chad Versace c...@chad-versace.us
 ---
  src/mesa/drivers/dri/Makefile.defines|   20 +++-
  src/mesa/drivers/dri/common/Makefile.sources |   19 +++
  2 files changed, 26 insertions(+), 13 deletions(-)
  create mode 100644 src/mesa/drivers/dri/common/Makefile.sources

 diff --git a/src/mesa/drivers/dri/Makefile.defines 
 b/src/mesa/drivers/dri/Makefile.defines
 index 90ae551..6ff8df5 100644
 --- a/src/mesa/drivers/dri/Makefile.defines
 +++ b/src/mesa/drivers/dri/Makefile.defines
 @@ -1,14 +1,13 @@
  # -*-makefile-*-

 +# Import mesa_dri_common_*
 +include ../common/Makefile.sources
 +
  COMMON_GALLIUM_SOURCES = \
 -../common/utils.c \
 -../common/vblank.c \
 -../common/dri_util.c \
 -../common/xmlconfig.c
 +   $(addprefix ../common/, $(mesa_dri_common_gallium_SOURCES))

 -COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
 -../common/texmem.c \
 -../common/drirenderbuffer.c
 +COMMON_SOURCES = \
 +   $(addprefix ../common/, $(mesa_dri_common_SOURCES))

  INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES)

 @@ -20,13 +19,8 @@ OBJECTS = $(C_SOURCES:.c=.o) \
  ### Include directories
  SHARED_INCLUDES = \
-I. \
 -   -I$(TOP)/src/mesa/drivers/dri/common \
-Iserver \
 -   -I$(TOP)/include \
 -   -I$(TOP)/src/mapi \
 -   -I$(TOP)/src/mesa \
 -   -I$(TOP)/src/egl/main \
 -   -I$(TOP)/src/egl/drivers/dri \
 +   $(addprefix -I$(TOP)/, $(mesa_dri_common_INCLUDES)) \
$(LIBDRM_CFLAGS)

  INCLUDES += $(API_DEFINES)
 diff --git a/src/mesa/drivers/dri/common/Makefile.sources 
 b/src/mesa/drivers/dri/common/Makefile.sources
 new file mode 100644
 index 000..22df2f0
 --- /dev/null
 +++ b/src/mesa/drivers/dri/common/Makefile.sources
 @@ -0,0 +1,19 @@
 +mesa_dri_common_gallium_SOURCES := \
 +   utils.c \
 +   vblank.c \
 +   dri_util.c \
 +   xmlconfig.c
 +
 +mesa_dri_common_SOURCES := \
 +   $(mesa_dri_common_gallium_SOURCES) \
 +texmem.c \
 +drirenderbuffer.c
 +
 +# Paths are relative to MESA_TOP.
 +mesa_dri_common_INCLUDES := \
 +   include \
 +   src/egl/drivers/dri \
 +   src/egl/main \
 +   src/mapi \
 +   src/mesa \
 +   src/mesa/drivers/dri/common \

 Is the last backslash intended?  Either way, this file looks good to
 me.  I did not go through other changes though.

Oops. It was not intentional, and I removed it from the pushed patch.

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOXQvaAAoJEAIvNt057x8iaQoP/juAYus1o0ZpJMpyuNRmZPoG
64YbnFegA1RYCKPHiDwXDKzByqn0BmOR27zn8JUBAOmYN639crOg+gaJjVr2AEXK
qs9iIxRdY/ezLNlPG2QrZMp7ZuXl+s+MJ1GtP2Q5qRXRwaIL0CNWjjIEf3IyAcHo
UtLLPg+JufuOCenIn0YhLSaYnjeDFQtju28UjN3zgWXeR3e7P78MmhP/kT+7jJ5b
F51yFm5PQMbytHn3MPkH7QvvzdWEyn/CJ9neN2QgQLJdxzj5ZF9gAKHU2HzB5Z3K
8raXafx02wisI3J/6UI+1IwKDv6G4bPB/AV0yEj5hEmoGhitQDtuSJmYVOcAieV3
sZAO6OzqC0/LwOCV8evbZrNNPTUNLs/M6w897NmrwcfIKUfZLVEo4w7Sq56f4dYL
H7S1nEMbkNmhppPu2xmPvJX54jCbFtCHLvwqjB3OLgM2hYLQ5WbieFZbJvhPca5I
yTcxFnoVR6B0ADYPRYeWrQ+0bIOpD+Kn/2GTNEzB7rPQFNMa5O+Yr8EfhGs2Of7y
YB+x7UJhtzKppagVBIGkNVG042AoIp03Jin8CNuP1zBo22kcY7Nkuk2PySMDmWDA
cGHgJ/0/crorh4k3dc9GqLlqYvSfvAkM185Eyl5+OFgIzNubCVnwcBkz3sYYzoEZ
025IvE+s8Y9jP3RXTiQM
=GwU0
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 5/5] i965: Build i965_dri.so for Android

2011-08-30 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/29/2011 08:59 PM, Chia-I Wu wrote:
 On Tue, Aug 30, 2011 at 2:50 AM, Chad Versace c...@chad-versace.us wrote:
 Compile tested only.

 v2
 
 - [olv] Update comments to include i965 in list of classic drivers.

 CC: Ian Romanick i...@freedesktop.org
 CC: Chia-I Wu o...@lunarg.com
 Signed-off-by: Chad Versace c...@chad-versace.us
 ---
  Android.mk   |4 +-
  src/mesa/drivers/dri/Android.mk  |   35 +++
  src/mesa/drivers/dri/i965/Android.mk |   61 
 ++
  3 files changed, 98 insertions(+), 2 deletions(-)
  create mode 100644 src/mesa/drivers/dri/i965/Android.mk

 diff --git a/Android.mk b/Android.mk
 index 2ad83a0..7c7c55a 100644
 --- a/Android.mk
 +++ b/Android.mk
 @@ -23,7 +23,7 @@

  # BOARD_GPU_DRIVERS should be defined.  The valid values are
  #
 -#   classic drivers:
 +#   classic drivers: i965
  #   gallium drivers: swrast i915g nouveau r300g r600g vmwgfx
  #
  # The main target is libGLES_mesa.  For each classic driver enabled, a DRI
 @@ -36,7 +36,7 @@ MESA_PYTHON2 := python
  DRM_TOP := external/drm
  DRM_GRALLOC_TOP := hardware/drm_gralloc

 -classic_drivers :=
 +classic_drivers := i965
  gallium_drivers := swrast i915g nouveau r300g r600g vmwgfx

  MESA_GPU_DRIVERS := $(strip $(BOARD_GPU_DRIVERS))
 diff --git a/src/mesa/drivers/dri/Android.mk 
 b/src/mesa/drivers/dri/Android.mk
 index 05b02cb..d3b7826 100644
 --- a/src/mesa/drivers/dri/Android.mk
 +++ b/src/mesa/drivers/dri/Android.mk
 @@ -22,6 +22,41 @@

  LOCAL_PATH := $(call my-dir)

 +# Import mesa_dri_common_INCLUDES.
 +include $(LOCAL_PATH)/common/Makefile.sources
 +
 +#---
 +# Variables common to all DRI drivers
 +
 +MESA_DRI_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/dri
 +MESA_DRI_MODULE_UNSTRIPPED_PATH := 
 $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/dri
 +
 +MESA_DRI_C_INCLUDES := \
 +   $(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
 +   $(DRM_TOP) \
 +   $(DRM_TOP)/include/drm \
 +   external/expat/lib
 +
 +MESA_DRI_WHOLE_STATIC_LIBRARIES := \
 +   libmesa_glsl \
 +   libmesa_dri_common \
 +   libmesa_dricore
 +
 +MESA_DRI_SHARED_LIBRARIES := \
 +   libcutils \
 +   libdl \
 +   libdrm \
 +   libexpat \
 +   libglapi \
 +   liblog \

 Spurious backslash?

I really must be on the watch for trailing backslashes...
 
 I did not test, but
 
 Reviewed-by: Chia-I Wu o...@lunarg.com

Thanks for the review.

 
 +
 +#---
 +# Build drivers and libmesa_dri_common
 +
  SUBDIRS := common

 +ifneq ($(filter i965, $(MESA_GPU_DRIVERS)),)
 +   SUBDIRS += i965
 +endif
 +
  include $(foreach d, $(SUBDIRS), $(LOCAL_PATH)/$(d)/Android.mk)
 diff --git a/src/mesa/drivers/dri/i965/Android.mk 
 b/src/mesa/drivers/dri/i965/Android.mk
 new file mode 100644
 index 000..2a289dd
 --- /dev/null
 +++ b/src/mesa/drivers/dri/i965/Android.mk
 @@ -0,0 +1,61 @@
 +#
 +# Copyright (C) 2011 Intel Corporation
 +# Copyright (C) 2010-2011 Chia-I Wu olva...@gmail.com
 +# Copyright (C) 2010-2011 LunarG
 +#
 +# Permission is hereby granted, free of charge, to any person obtaining a
 +# copy of this software and associated documentation files (the Software),
 +# to deal in the Software without restriction, including without limitation
 +# the rights to use, copy, modify, merge, publish, distribute, sublicense,
 +# and/or sell copies of the Software, and to permit persons to whom the
 +# Software is furnished to do so, subject to the following conditions:
 +#
 +# The above copyright notice and this permission notice shall be included
 +# in all copies or substantial portions of the Software.
 +#
 +# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 +# 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.
 +#
 +
 +LOCAL_PATH := $(call my-dir)
 +include $(CLEAR_VARS)
 +
 +LOCAL_MODULE := i965_dri
 +LOCAL_MODULE_PATH := $(MESA_DRI_MODULE_PATH)
 +LOCAL_UNSTRIPPED_PATH := $(MESA_DRI_MODULE_UNSTRIPPED_PATH)
 +
 +# Import variables i965_*.
 +include $(LOCAL_PATH)/Makefile.sources
 +
 +# Overriding LOCAL_CC below is an ugly workaround.  We cannot place -std=c99
 +# in LOCAL_C_FLAGS because Android appends LOCAL_C_FLAGS to LOCAL_CPP_FLAGS.
 +LOCAL_CC := $(CC) -std=c99
 +
 +LOCAL_C_FLAGS := \
 +   $(MESA_DRI_C_FLAGS) \
 +   -DI965
 +
 +LOCAL_C_INCLUDES := \
 +   $(i965_INCLUDES) \
 +   $(MESA_DRI_C_INCLUDES) \
 +   $(DRM_TOP)/intel
 +
 +LOCAL_SRC_FILES := \
 +   $(i965_C_SOURCES) \
 +   $(i965_CXX_SOURCES

Re: [Mesa-dev] [PATCH 2/3] egl_dri2: check the surface type in platform_android

2011-08-30 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/28/2011 08:39 AM, Chia-I Wu wrote:
 From: Chia-I Wu o...@lunarg.com
 
 Check the surface type is EGL_WINDOW_BIT before doing anything, in
 preparation for pbuffer support.
 ---
  src/egl/drivers/dri2/platform_android.c |  104 
 +--
  1 files changed, 58 insertions(+), 46 deletions(-)
 
 diff --git a/src/egl/drivers/dri2/platform_android.c 
 b/src/egl/drivers/dri2/platform_android.c
 index 2bbd210..7b6730a 100644
 --- a/src/egl/drivers/dri2/platform_android.c
 +++ b/src/egl/drivers/dri2/platform_android.c

[snip]

 @@ -431,17 +441,19 @@ droid_get_buffers_with_format(__DRIdrawable * 
 driDrawable,
dri2_egl_display(dri2_surf-base.Resource.Display);
 int i;
  
 -   if (!dri2_surf-buffer) {
 -  if (!droid_window_dequeue_buffer(dri2_surf))
 - return NULL;
 -   }
 +   if (dri2_surf-base.Type == EGL_WINDOW_BIT) {
 +  if (!dri2_surf-buffer) {
 + if (!droid_window_dequeue_buffer(dri2_surf))
 +return NULL;
 +  }

The above would be easier to read if the two if-trees were combined:
 if (!dri2_surf-buffer  !droid_window_dequeue_buffer(dri2_surf))
 return NULL;

Either way,
Reviewed-by: Chad Versace c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOXWfjAAoJEAIvNt057x8ikBUP/33hYl97ZxN/ftSLbPwzwqHW
g28pshV4q2CUe5y8hWngKOjXq+vqqJcpZcLCkpY2oJpRKhUGy3QLL6wFu3OEKqL8
gZgCbRqwCPpadUDGtev+tO+8SdEiMcUJP+m4cZ2ryUyWnjt9DgOYWVjScAXvrvpy
TPbuDTsF4F25lg2rW4MtWA1On/vHSvFMa4/wSUbSCkLQNC1PfKlT/T/mcyIxH0/a
++yG+y+ScDah0qFc4Mf1W0oBRTEfKYnI/VP57u32IMWh9DK+YxKQgS0Pc7oqcNOY
8hE19Ljk4OpT5CHNZcVfdLgGA10uNzwAwncUNSC/3Y1oSLuXeAqUXX0QK3uYnj1T
smzklKNqx9bbpmU2UVMOE2/OoiZUngpYVKUy9HLRUBVVitnRLkQ8O2tEB3LGNFf3
SUXlkh6D4N/H0MTjJZuxu+ZD6EWBoi9Zm4MZazzpBJGcjknl88cJ4iGIaBvWU+Sf
0jT9VgQs9FMaTeVaE4DLLOVxQ2JAO2KAlW6MMVqauCsQ8AtJLhcC/s0PCz57ngoB
GH12lh2hF9YL3kjE//9Zt8s/psMGWsUsW7z3dgSzgfZcpU6AaSp6vU+wtoobSN5M
8o+Z8HVlKhH77IbMIyNlN74krKPuNckDsTh1K9B2jdlJju/l2qHKR2KOkk/6O81s
mmmCbHoFCBwmTNx/ze7D
=RpKS
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/3] egl_dri2: add pbuffer support to platform_android

2011-08-30 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/28/2011 08:39 AM, Chia-I Wu wrote:
 From: Chia-I Wu o...@lunarg.com
 
 This is a simple change thanks to allocateBuffer.

Wow, adding pbuffer support was short and simple.

 ---
  src/egl/drivers/dri2/platform_android.c |   12 
  1 files changed, 8 insertions(+), 4 deletions(-)
 
 diff --git a/src/egl/drivers/dri2/platform_android.c 
 b/src/egl/drivers/dri2/platform_android.c
 index 7b6730a..759f9f6 100644
 --- a/src/egl/drivers/dri2/platform_android.c
 +++ b/src/egl/drivers/dri2/platform_android.c
 @@ -222,7 +222,8 @@ static _EGLSurface *
  droid_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp,
   _EGLConfig *conf, const EGLint *attrib_list)
  {
 -   return NULL;
 +   return droid_create_surface(drv, disp, EGL_PBUFFER_BIT, conf,
 +   NULL, attrib_list);
  }
  
  static EGLBoolean
 @@ -401,8 +402,10 @@ droid_get_buffers_parse_attachments(struct 
 dri2_egl_surface *dri2_surf,
  
  if (buf-name)
 num_buffers++;
 +
 +break;
   }
 - break;
 + /* fall through for pbuffers */
case __DRI_BUFFER_DEPTH:
case __DRI_BUFFER_STENCIL:
case __DRI_BUFFER_ACCUM:
 @@ -473,6 +476,7 @@ static EGLBoolean
  droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
  {
 struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
 +   const EGLint surface_type = EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
 const struct {
int format;
int size;
 @@ -495,7 +499,7 @@ droid_add_configs_for_visuals(_EGLDriver *drv, 
 _EGLDisplay *dpy)
   struct dri2_egl_config *dri2_conf;
  
   dri2_conf = dri2_add_config(dpy, dri2_dpy-driver_configs[j],
 -   count + 1, visuals[i].size, EGL_WINDOW_BIT, NULL,
 +   count + 1, visuals[i].size, surface_type, NULL,
 visuals[i].rgba_masks);
   if (dri2_conf) {
  dri2_conf-base.NativeVisualID = visuals[i].format;
 @@ -521,7 +525,7 @@ droid_add_configs_for_visuals(_EGLDriver *drv, 
 _EGLDisplay *dpy)
  
/* and we want to make sure GL_DRAW_BUFFER is always GL_BACK */
if (!dri2_conf-dri_double_config)
 - dri2_conf-base.SurfaceType = ~EGL_WINDOW_BIT;
 + dri2_conf-base.SurfaceType = ~surface_type;

I think (but I'm not certain) that the last fixup is equivalent to:
dri2_conf-base.SurfaceType = 0;
If it is, then the code should just set SurfaceType = 0.

Other than that, the patch looks good.
Reviewed-by: Chad Versace c...@chad-versace.us

 }
  
 return (count != 0);
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOXWkmAAoJEAIvNt057x8ifRAP/R9D0bfH9xz1Cr8yNbMAT27O
yXK8gYNfR23A2GGnrFf6ObFjgGxD6c5qMh8yi71DVLpY6dxRibUaARE3OQn6W6w/
p8+Fg5xkTbGay4qt6uDS0JL5xCwfk7GI/1jykMzQjTWwRka0kJVw/6uVM3rTbZxQ
Vf5lb30oE3amBiiVAiIZpoAdKpHpuM/4zxgGvTXmJ9K6/gyvPsYWnQWYnjkBTzHq
DTlylQbKMuJd/qCAlddxx3PmyEhfi4sY70QAVJg7OMy/6DkGdyh2xFbd6ggYxIUv
fvUoAxuHbEkVHecrDqQqFk23SPRga5aG4vTuiPNddbB+GbWpginea2M9KIW04qIK
2W242H01EUxeouosOKzsJh9AT6RoJURHdtIG4vyi4HIBJ4N68Q3zFtMIklsqurKF
XqcHjEnWrfvh2Z/sCKIWWLwvWPOIi9oYU8y/EWbVxN7z8+DSSlCW//IAQvnlr0MC
ag4Q4pGD0foRU17d0RKB20mC1+9ogXuXSaIPIVh0iCYquGngaV8zSHhj7t9reIGA
bggXIGDGHpaL+q6BzI0Sjjju9YTbW1OtsfkGB9x5sh80bJ+TwxgeE/rSIWv+DrZR
hkpQPxFFUpk7z2RXqL3S1c680a28UcHaeYkphnZnJGRm2+8aJFfnqZHeJJlcMrj3
ko9658xNbu6lTXfAeT5L
=xgvk
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl_dri2: set ctx-WindowRenderBuffer

2011-08-30 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 08/28/2011 08:38 AM, Chia-I Wu wrote:
 From: Chia-I Wu o...@lunarg.com
 
 Set ctx-WindowRenderBuffer to EGL_BACK_BUFFER.  As EGL_WINDOW_BIT of a
 config is set only when there is dri_double_buffer, that makes sure
 window surfaces are always double-buffered and contexts will render to
 the back buffer.
 ---
  src/egl/drivers/dri2/egl_dri2.c |6 ++
  1 files changed, 6 insertions(+), 0 deletions(-)
 
 diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
 index 4aa1df0..0099a0d 100644
 --- a/src/egl/drivers/dri2/egl_dri2.c
 +++ b/src/egl/drivers/dri2/egl_dri2.c
 @@ -697,6 +697,12 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, 
 _EGLConfig *conf,
   dri_config = dri2_config-dri_double_config;
else
   dri_config = dri2_config-dri_single_config;
 +
 +  /* EGL_WINDOW_BIT is set only when there is a dri_double_config.  This
 +   * makes sure the back buffer will always be used.
 +   */
 +  if (conf-SurfaceType  EGL_WINDOW_BIT)
 + dri2_ctx-base.WindowRenderBuffer = EGL_BACK_BUFFER;
 }
 else
dri_config = NULL;

Yes. Now eglQuerySurface(EGL_RENDER_BUFFER) will do the right thing.

Reviewed-by: Chad Versace c...@chad-versace.us

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOXWmgAAoJEAIvNt057x8iNh8P/2E46l+ftf9jHKgAbZkuCDR1
wa8wVDKUEKXt5xvZKAPZx9IwoDbNyiHyEf2QOgn3Hk08uQKR7CP1+nzj7nC74oab
AklG79VurGdANLMtynworv7HTfmT6ZmoDkpUEYw31t7AKTVLKTB4LmJy2H0t3dmt
h5pQkW2UZp3h1e0efobQUvY8lFQOb6SUPzU9x8w2MgOen+QShLYZgvu2Xt3Dl0g7
APji6hdNppfRrrpTTOMGkfyARarVc88OWvpLNBCFKKvXkWdN6eJ8oSk3BJfh1T5E
ycvUb2MET2IKVm2nzDswcXNGsQcVJhoiKkmiRtYHafN7uM+vZn/V7YoLuc7w58g0
JaMJNArmq5ADgLPqYI1fu6yc6YZw5QYt2xAKzCT4S3IeJNF9rhv349X40vEofh7u
r8lojv3dbANQJMJ0sKpNdaOJ3euAHLBXSDbQDHpe87l+B2NJmgPqzWzw9HRgXSjS
++tl3c84jpgCVCvl04OfE3XjJ3jLyStlY2M1n7mdBY9C7a9JSZjCdfZC8yNnMRgY
+owL284uR5P4LwR265qD2/LpNXxU7VOKNRN/jYxgIO04iEOBwUyTldUskl/63/h7
IR9Sz5GvO9KQv5U9tJ+wW65al75hk0VF04INubZtARZVrU8AP9lodO9Pu5em2zts
iEozyO7A43oJD/qEi6gM
=yc6i
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] i965: fix Android build

2011-08-31 Thread Chad Versace
On 08/30/2011 10:27 PM, Chia-I Wu wrote:
 From: Chia-I Wu o...@lunarg.com
 
 Use $(TARGET_CC) instead of $(CC).  Correctly name and set LOCAL_CFLAGS.
 ---
  src/mesa/drivers/dri/Android.mk  |5 +
  src/mesa/drivers/dri/i965/Android.mk |7 +++
  2 files changed, 8 insertions(+), 4 deletions(-)

Thanks for fixing the mistakes in i965/Android.mk. I was unaware of TARGET_CC.

I tested the i915 build, both with Android and Autoconf. So, for the series:
Reviewed-by: Chad Versace c...@chad-versace.us

-- 
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa: Fix save/restore of ActiveProgram in meta-ops

2011-09-20 Thread Chad Versace
The mismatch below caused ActiveProgram to be incorrectly saved/restored:

_meas_meta_begin:
line 465) ActiveShader := gl_shader_state::CurrentFragmentProgram
_mesa_meta_end:
line 741) gl_shader_state::ActiveProgram := ActiveShader

This patch fixes it to be:

_meas_meta_begin:
line 465) ActiveShader := gl_shader_state::ActiveProgram
_mesa_meta_end:
line 741) gl_shader_state::ActiveProgram := ActiveShader

I discovered this bug by inspection.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/common/meta.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 1b71aa1..2ac81ac 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -463,7 +463,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
 _mesa_reference_shader_program(ctx, save-FragmentShader,
ctx-Shader.CurrentFragmentProgram);
 _mesa_reference_shader_program(ctx, save-ActiveShader,
-   ctx-Shader.CurrentFragmentProgram);
+   ctx-Shader.ActiveProgram);
 
  _mesa_UseProgramObjectARB(0);
   }
-- 
1.7.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 00/19] i965: Do HiZ and depth resolves

2011-09-23 Thread Chad Versace
By default, HiZ is still disabled. This series causes no Piglit regressions
when HiZ is disabled.

When HiZ *is* enabled, it is now stable enough to run gnome-shell, nexuiz, and
openarena without any artifacts. Mipmapped depth textures, however, are still
broken, as well as many Piglit tests.

Chad Versace (18):
  intel: Add HiZ operations to intel_context.vtbl
  i965: Initialize intel_context.vtbl after calling intelInitContext
  i965: Add stub functions for HiZ operations
  i965: Set HiZ operations in brw vtbl
  intel: Add HiZ control state to intel_region
  intel: Add 'mode' param to intel_region_map
  intel: Execute HiZ resolve ops in intel_region_map
  intel: Use intel_region_map/unmap in intel_renderbuffer_map/unmap
  intel: Move definition of intel_framebuffer_get_hiz_region from .h to
.c
  intel: Add function intel_renderbuffer_hiz_alloc
  intel: Remove intel_renderbuffer::hiz_region
  i965: Add HiZ operation state to brw_context
  i965: Complete stubs for HiZ operation meta-ops
  i965/gen6: Don't set intel_context.reduced_primitive on Gen = 6
  i965: Change type of brw_context.primitive from GLenum to hardware
primitive
  i965: Manipulate state batches for HiZ operation meta-ops
  i965: After emitting a HiZ buffer, mark that it needs a HiZ resolve
  i965: Do needed HiZ meta-ops before drawing

Kenneth Graunke (1):
  i965/gen7: Manipulate gen7 state batches for HiZ meta-ops

 src/mesa/drivers/dri/i965/Makefile.sources  |1 +
 src/mesa/drivers/dri/i965/brw_context.c |3 +-
 src/mesa/drivers/dri/i965/brw_context.h |   37 +++-
 src/mesa/drivers/dri/i965/brw_draw.c|  114 ++---
 src/mesa/drivers/dri/i965/brw_gs.c  |   44 ++--
 src/mesa/drivers/dri/i965/brw_gs.h  |2 +-
 src/mesa/drivers/dri/i965/brw_hiz.c |  318 +++
 src/mesa/drivers/dri/i965/brw_hiz.h |   43 +++
 src/mesa/drivers/dri/i965/brw_misc_state.c  |   33 ++-
 src/mesa/drivers/dri/i965/brw_vtbl.c|   10 +
 src/mesa/drivers/dri/i965/gen6_clip_state.c |   17 ++
 src/mesa/drivers/dri/i965/gen6_depthstencil.c   |   22 ++-
 src/mesa/drivers/dri/i965/gen6_sf_state.c   |   16 +-
 src/mesa/drivers/dri/i965/gen6_wm_state.c   |   28 ++-
 src/mesa/drivers/dri/i965/gen7_clip_state.c |   17 ++
 src/mesa/drivers/dri/i965/gen7_misc_state.c |   33 ++-
 src/mesa/drivers/dri/i965/gen7_sf_state.c   |   13 +-
 src/mesa/drivers/dri/i965/gen7_wm_state.c   |   26 ++
 src/mesa/drivers/dri/intel/intel_context.c  |   14 +-
 src/mesa/drivers/dri/intel/intel_context.h  |   13 +-
 src/mesa/drivers/dri/intel/intel_fbo.c  |   65 +++--
 src/mesa/drivers/dri/intel/intel_fbo.h  |   23 +-
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c  |   11 +-
 src/mesa/drivers/dri/intel/intel_mipmap_tree.h  |1 +
 src/mesa/drivers/dri/intel/intel_regions.c  |   24 ++-
 src/mesa/drivers/dri/intel/intel_regions.h  |   29 ++-
 src/mesa/drivers/dri/intel/intel_span.c |   13 +-
 src/mesa/drivers/dri/intel/intel_tex.c  |6 +-
 src/mesa/drivers/dri/intel/intel_tex.h  |6 +-
 src/mesa/drivers/dri/intel/intel_tex_image.c|2 +
 src/mesa/drivers/dri/intel/intel_tex_validate.c |   15 +-
 31 files changed, 851 insertions(+), 148 deletions(-)
 create mode 100644 src/mesa/drivers/dri/i965/brw_hiz.c
 create mode 100644 src/mesa/drivers/dri/i965/brw_hiz.h

-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 01/19] intel: Add HiZ operations to intel_context.vtbl

2011-09-23 Thread Chad Versace
Add the following functions:
resolve_depthbuffer
resolve_hizbuffer

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/intel/intel_context.h |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_context.h 
b/src/mesa/drivers/dri/intel/intel_context.h
index b7989dd..78e3ca3 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -154,6 +154,17 @@ struct intel_context
   /** Can HiZ be enabled on a depthbuffer of the given format? */
   bool (*is_hiz_depth_format)(struct intel_context *intel,
  gl_format format);
+
+  /**
+   * \name HiZ operations
+   * \{
+   */
+  void (*resolve_depthbuffer)(struct intel_context *intel,
+ struct intel_region *depth_region);
+  void (*resolve_hizbuffer)(struct intel_context *intel,
+   struct intel_region *depth_region);
+  /** \} */
+
} vtbl;
 
GLbitfield Fallback;  /** mask of INTEL_FALLBACK_x bits */
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 02/19] i965: Initialize intel_context.vtbl after calling intelInitContext

2011-09-23 Thread Chad Versace
The intel_context.gen field is set by intelInitContext. So, by calling
intelInitContext before initializing the vtable, we can can construct
different vtables for different gens.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i965/brw_context.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index cb37319..fbf77ad 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -70,7 +70,6 @@ GLboolean brwCreateContext( int api,
   return GL_FALSE;
}
 
-   brwInitVtbl( brw );
brwInitDriverFunctions( functions );
 
if (!intelInitContext( intel, api, mesaVis, driContextPriv,
@@ -80,6 +79,8 @@ GLboolean brwCreateContext( int api,
   return GL_FALSE;
}
 
+   brwInitVtbl( brw );
+
/* Initialize swrast, tnl driver tables: */
intelInitSpanFuncs(ctx);
 
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 03/19] i965: Add stub functions for HiZ operations

2011-09-23 Thread Chad Versace
Add stub functions for the following:
brw_hiz_resolve_depthbuffer
brw_hiz_resolve_hizbuffer

These will later be used to implement:
intel.vtbl.resolve_depthbuffer
intel.vtbl.resolve_hizbuffer

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i965/Makefile.sources |1 +
 src/mesa/drivers/dri/i965/brw_hiz.c|   40 
 src/mesa/drivers/dri/i965/brw_hiz.h|   35 
 3 files changed, 76 insertions(+), 0 deletions(-)
 create mode 100644 src/mesa/drivers/dri/i965/brw_hiz.c
 create mode 100644 src/mesa/drivers/dri/i965/brw_hiz.h

diff --git a/src/mesa/drivers/dri/i965/Makefile.sources 
b/src/mesa/drivers/dri/i965/Makefile.sources
index da7a952..b975a89 100644
--- a/src/mesa/drivers/dri/i965/Makefile.sources
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -52,6 +52,7 @@ i965_C_SOURCES := \
brw_gs.c \
brw_gs_emit.c \
brw_gs_state.c \
+   brw_hiz.c \
brw_misc_state.c \
brw_optimize.c \
brw_program.c \
diff --git a/src/mesa/drivers/dri/i965/brw_hiz.c 
b/src/mesa/drivers/dri/i965/brw_hiz.c
new file mode 100644
index 000..297b654
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/brw_hiz.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright © 2011 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.
+ */
+
+#include brw_hiz.h
+
+void
+brw_hiz_resolve_depthbuffer(struct intel_context *intel,
+struct intel_region *depth_region)
+{
+   /* stub */
+   abort();
+}
+
+void
+brw_hiz_resolve_hizbuffer(struct intel_context *intel,
+  struct intel_region *depth_region)
+{
+   /* stub */
+   abort();
+}
diff --git a/src/mesa/drivers/dri/i965/brw_hiz.h 
b/src/mesa/drivers/dri/i965/brw_hiz.h
new file mode 100644
index 000..1fec0f7
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/brw_hiz.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2011 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.
+ */
+
+#pragma once
+
+struct intel_context;
+struct intel_region;
+
+void
+brw_hiz_resolve_depthbuffer(struct intel_context *intel,
+struct intel_region *depth_region);
+
+void
+brw_hiz_resolve_hizbuffer(struct intel_context *intel,
+  struct intel_region *depth_region);
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 04/19] i965: Set HiZ operations in brw vtbl

2011-09-23 Thread Chad Versace
If Gen = 6, then set the following:
vtbl.resolve_depthbuffer
vtbl.resolve_hizbuffer.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i965/brw_vtbl.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c 
b/src/mesa/drivers/dri/i965/brw_vtbl.c
index 8b3677b..135887b 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -44,6 +44,7 @@
 
 #include brw_context.h
 #include brw_defines.h
+#include brw_hiz.h
 #include brw_state.h
 #include brw_draw.h
 #include brw_vs.h
@@ -254,4 +255,12 @@ void brwInitVtbl( struct brw_context *brw )
brw-intel.vtbl.debug_batch = brw_debug_batch;
brw-intel.vtbl.render_target_supported = brw_render_target_supported;
brw-intel.vtbl.is_hiz_depth_format = brw_is_hiz_depth_format;
+
+   if (brw-intel.gen = 6) {
+  brw-intel.vtbl.resolve_hizbuffer = brw_hiz_resolve_hizbuffer;
+  brw-intel.vtbl.resolve_depthbuffer = brw_hiz_resolve_depthbuffer;
+   } else {
+  brw-intel.vtbl.resolve_hizbuffer = 0;
+  brw-intel.vtbl.resolve_depthbuffer = 0;
+   }
 }
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 05/19] intel: Add HiZ control state to intel_region

2011-09-23 Thread Chad Versace
The HiZ control state is used only by depth regions for which HiZ is
enabled. The control state points to the depth region's associated HiZ
region and indicates if any resolve is needed.

A later commit will remove intel_renderbuffer::hiz_region. since that
pointer is will be duplicated by intel_renderbuffer::region::hiz::region.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/intel/intel_regions.c |2 ++
 src/mesa/drivers/dri/intel/intel_regions.h |   21 +
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_regions.c 
b/src/mesa/drivers/dri/intel/intel_regions.c
index 4d4ddd9..cd0542c 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -292,6 +292,8 @@ intel_region_release(struct intel_region **region_handle)
if (region-refcount == 0) {
   assert(region-map_refcount == 0);
 
+  intel_region_release(region-hiz.region);
+
   drm_intel_bo_unreference(region-buffer);
 
   if (region-name  0)
diff --git a/src/mesa/drivers/dri/intel/intel_regions.h 
b/src/mesa/drivers/dri/intel/intel_regions.h
index f3f6a07..3b7a3cf 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.h
+++ b/src/mesa/drivers/dri/intel/intel_regions.h
@@ -66,6 +66,27 @@ struct intel_region
 
uint32_t name; /** Global name for the bo */
struct intel_screen *screen;
+
+   /**
+* \brief HiZ control state
+*
+* Used only by depth buffers that possess a HiZ buffer.
+*/
+   struct intel_hiz_control {
+  struct intel_region *region; /** of HiZ buffer. */
+  gl_format depth_format; /** depth_rb-Format */
+
+  enum intel_hiz_need_resolve {
+ /** No resolve is needed. */
+ INTEL_HIZ_NEED_NO_RESOLVE = 0,
+
+ /** Content of the HiZ buffer is stale. A HiZ resolve is needed. */
+ INTEL_HIZ_NEED_HIZ_RESOLVE,
+
+ /** Content of the depth buffer is stale. A depth resolve is needed. 
*/
+ INTEL_HIZ_NEED_DEPTH_RESOLVE,
+  } need_resolve;
+   } hiz;
 };
 
 
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 06/19] intel: Add 'mode' param to intel_region_map

2011-09-23 Thread Chad Versace
The 'mode' param is a bitmask of GL_MAP_READ_BIT and GL_MAP_WRITE_BIT.

A future commit will perform HiZ resolve operations in intel_region_map().
So, even though the access mode is irrelevant to the GTT, the extra
information allows us to intelligently avoid unneccessary HiZ ops.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c  |   11 +++
 src/mesa/drivers/dri/intel/intel_mipmap_tree.h  |1 +
 src/mesa/drivers/dri/intel/intel_regions.c  |6 --
 src/mesa/drivers/dri/intel/intel_regions.h  |8 ++--
 src/mesa/drivers/dri/intel/intel_span.c |6 --
 src/mesa/drivers/dri/intel/intel_tex.c  |6 --
 src/mesa/drivers/dri/intel/intel_tex.h  |6 --
 src/mesa/drivers/dri/intel/intel_tex_image.c|2 ++
 src/mesa/drivers/dri/intel/intel_tex_validate.c |   15 ---
 9 files changed, 44 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 18427b5..b8e583c 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -311,6 +311,8 @@ intel_miptree_get_image_offset(struct intel_mipmap_tree *mt,
 
 /**
  * Map a teximage in a mipmap tree.
+ *
+ * \param mode  bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT
  * \param row_stride  returns row stride in bytes
  * \param image_stride  returns image stride in bytes (for 3D textures).
  * \param image_offsets pointer to array of pixel offsets from the returned
@@ -322,6 +324,7 @@ intel_miptree_image_map(struct intel_context * intel,
 struct intel_mipmap_tree * mt,
 GLuint face,
 GLuint level,
+GLbitfield mode,
 GLuint * row_stride, GLuint * image_offsets)
 {
GLuint x, y;
@@ -341,7 +344,7 @@ intel_miptree_image_map(struct intel_context * intel,
 
   DBG(%s \n, __FUNCTION__);
 
-  return intel_region_map(intel, mt-region);
+  return intel_region_map(intel, mt-region, mode);
} else {
   assert(mt-level[level].depth == 1);
   intel_miptree_get_image_offset(mt, level, face, 0,
@@ -351,7 +354,7 @@ intel_miptree_image_map(struct intel_context * intel,
   DBG(%s: (%d,%d) - (%d, %d)/%d\n,
  __FUNCTION__, face, level, x, y, mt-region-pitch * mt-cpp);
 
-  return intel_region_map(intel, mt-region) +
+  return intel_region_map(intel, mt-region, mode) +
 (x + y * mt-region-pitch) * mt-cpp;
}
 }
@@ -451,8 +454,8 @@ intel_miptree_image_copy(struct intel_context *intel,
   if (!success) {
 GLubyte *src_ptr, *dst_ptr;
 
-src_ptr = intel_region_map(intel, src-region);
-dst_ptr = intel_region_map(intel, dst-region);
+src_ptr = intel_region_map(intel, src-region, GL_MAP_READ_BIT);
+dst_ptr = intel_region_map(intel, dst-region, GL_MAP_WRITE_BIT);
 
 _mesa_copy_rect(dst_ptr,
 dst-cpp,
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h 
b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
index 7f20319..b30eb91 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
@@ -173,6 +173,7 @@ GLubyte *intel_miptree_image_map(struct intel_context 
*intel,
  struct intel_mipmap_tree *mt,
  GLuint face,
  GLuint level,
+ GLbitfield mode,
  GLuint * row_stride, GLuint * image_stride);
 
 void intel_miptree_image_unmap(struct intel_context *intel,
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c 
b/src/mesa/drivers/dri/intel/intel_regions.c
index cd0542c..0a5c2c1 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -109,7 +109,8 @@ debug_backtrace(void)
 /* XXX: Thread safety?
  */
 GLubyte *
-intel_region_map(struct intel_context *intel, struct intel_region *region)
+intel_region_map(struct intel_context *intel, struct intel_region *region,
+ GLbitfield mode)
 {
intel_flush(intel-ctx);
 
@@ -362,7 +363,8 @@ intel_region_data(struct intel_context *intel,
 
intel_prepare_render(intel);
 
-   _mesa_copy_rect(intel_region_map(intel, dst) + dst_offset,
+   GLubyte *dst_base = intel_region_map(intel, dst, GL_MAP_WRITE_BIT);
+   _mesa_copy_rect(dst_base + dst_offset,
dst-cpp,
dst-pitch,
dstx, dsty, width, height, src, src_pitch, srcx, srcy);
diff --git a/src/mesa/drivers/dri/intel/intel_regions.h 
b/src/mesa/drivers/dri/intel/intel_regions.h
index 3b7a3cf..209ea90 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.h
+++ b/src/mesa/drivers/dri/intel/intel_regions.h
@@ -115,10 +115,14 @@ void intel_region_release

[Mesa-dev] [PATCH 07/19] intel: Execute HiZ resolve ops in intel_region_map

2011-09-23 Thread Chad Versace
Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/intel/intel_regions.c |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_regions.c 
b/src/mesa/drivers/dri/intel/intel_regions.c
index 0a5c2c1..304de8b 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -116,6 +116,22 @@ intel_region_map(struct intel_context *intel, struct 
intel_region *region,
 
_DBG(%s %p\n, __FUNCTION__, region);
if (!region-map_refcount++) {
+  /* Handle HiZ resolve ops. */
+  struct intel_hiz_control *hiz = region-hiz;
+  if (hiz-region != NULL) {
+if (hiz-need_resolve == INTEL_HIZ_NEED_DEPTH_RESOLVE) {
+   intel-vtbl.resolve_depthbuffer(intel, region);
+} else if (hiz-need_resolve == INTEL_HIZ_NEED_HIZ_RESOLVE) {
+   intel-vtbl.resolve_hizbuffer(intel, region);
+}
+
+assert(!hiz-need_resolve);
+
+if (hiz-region  (mode  GL_MAP_WRITE_BIT)) {
+   hiz-need_resolve = INTEL_HIZ_NEED_HIZ_RESOLVE;
+}
+  }
+
   if (region-tiling != I915_TILING_NONE)
 drm_intel_gem_bo_map_gtt(region-buffer);
   else
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 09/19] intel: Move definition of intel_framebuffer_get_hiz_region from .h to .c

2011-09-23 Thread Chad Versace
This eliminates the need for intel_fbo.h to include intel_regions.h on the
next commit. And this function was too large to be inline, anyway.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/intel/intel_fbo.c |   12 
 src/mesa/drivers/dri/intel/intel_fbo.h |   14 ++
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
b/src/mesa/drivers/dri/intel/intel_fbo.c
index 418e426..0828af4 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -97,6 +97,18 @@ intel_get_pointer(struct gl_context * ctx, struct 
gl_renderbuffer *rb,
return NULL;
 }
 
+struct intel_region*
+intel_framebuffer_get_hiz_region(struct gl_framebuffer *fb)
+{
+   struct intel_renderbuffer *rb = NULL;
+   if (fb)
+  rb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
+
+   if (rb)
+  return rb-hiz_region;
+   else
+  return NULL;
+}
 
 /**
  * Called via glRenderbufferStorageEXT() to set the format and allocate
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h 
b/src/mesa/drivers/dri/intel/intel_fbo.h
index e12d0fd..459cba6 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.h
+++ b/src/mesa/drivers/dri/intel/intel_fbo.h
@@ -135,18 +135,8 @@ intel_get_renderbuffer(struct gl_framebuffer *fb, 
gl_buffer_index attIndex)
  * If the framebuffer has a depth buffer attached, then return its HiZ region.
  * The HiZ region may be null.
  */
-static INLINE struct intel_region*
-intel_framebuffer_get_hiz_region(struct gl_framebuffer *fb)
-{
-   struct intel_renderbuffer *rb = NULL;
-   if (fb)
-  rb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
-
-   if (rb)
-  return rb-hiz_region;
-   else
-  return NULL;
-}
+struct intel_region*
+intel_framebuffer_get_hiz_region(struct gl_framebuffer *fb);
 
 static INLINE bool
 intel_framebuffer_has_hiz(struct gl_framebuffer *fb)
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 10/19] intel: Add function intel_renderbuffer_hiz_alloc

2011-09-23 Thread Chad Versace
This function allocates the HiZ region and initializes the HiZ control
state for a depthbuffer.

It is wise to define the logic for HiZ region allocation in a single
location, since when MSAA arrives that logic will become more complicated.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/intel/intel_fbo.c |   21 +
 src/mesa/drivers/dri/intel/intel_fbo.h |8 
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
b/src/mesa/drivers/dri/intel/intel_fbo.c
index 0828af4..bf57e30 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -110,6 +110,27 @@ intel_framebuffer_get_hiz_region(struct gl_framebuffer *fb)
   return NULL;
 }
 
+bool
+intel_renderbuffer_alloc_hiz(struct intel_context *intel,
+ struct intel_renderbuffer *depth_irb)
+{
+   struct intel_region *depth_region = depth_irb-region;
+   struct intel_hiz_control *hiz = depth_irb-region-hiz;
+
+   hiz-region = intel_region_alloc(intel-intelScreen,
+   I915_TILING_Y,
+   depth_region-cpp,
+   depth_region-width,
+   depth_region-height,
+   GL_TRUE);
+   if (!hiz-region)
+  return false;
+
+   hiz-need_resolve = INTEL_HIZ_NEED_NO_RESOLVE;
+   hiz-depth_format = depth_irb-Base.Format;
+   return true;
+}
+
 /**
  * Called via glRenderbufferStorageEXT() to set the format and allocate
  * storage for a user-created renderbuffer.
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h 
b/src/mesa/drivers/dri/intel/intel_fbo.h
index 459cba6..377cb1b 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.h
+++ b/src/mesa/drivers/dri/intel/intel_fbo.h
@@ -138,6 +138,14 @@ intel_get_renderbuffer(struct gl_framebuffer *fb, 
gl_buffer_index attIndex)
 struct intel_region*
 intel_framebuffer_get_hiz_region(struct gl_framebuffer *fb);
 
+/**
+ * For the given depthbuffer, allocate the HiZ region and initialize the HiZ
+ * control state.
+ */
+bool
+intel_renderbuffer_alloc_hiz(struct intel_context *intel,
+ struct intel_renderbuffer *depth_irb);
+
 static INLINE bool
 intel_framebuffer_has_hiz(struct gl_framebuffer *fb)
 {
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 11/19] intel: Remove intel_renderbuffer::hiz_region

2011-09-23 Thread Chad Versace
And replace it with intel_renderbuffer::region::hiz::region.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i965/brw_misc_state.c |   27 +++--
 src/mesa/drivers/dri/intel/intel_context.c |   14 --
 src/mesa/drivers/dri/intel/intel_fbo.c |   36 ++-
 src/mesa/drivers/dri/intel/intel_fbo.h |3 --
 4 files changed, 33 insertions(+), 47 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c 
b/src/mesa/drivers/dri/i965/brw_misc_state.c
index ce4fc84..5adf2d7 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -206,8 +206,8 @@ static void prepare_depthbuffer(struct brw_context *brw)
 
if (drb)
   brw_add_validated_bo(brw, drb-region-buffer);
-   if (drb  drb-hiz_region)
-  brw_add_validated_bo(brw, drb-hiz_region-buffer);
+   if (drb  drb-region-hiz.region)
+  brw_add_validated_bo(brw, drb-region-hiz.region-buffer);
if (srb)
   brw_add_validated_bo(brw, srb-region-buffer);
 }
@@ -220,7 +220,7 @@ static void emit_depthbuffer(struct brw_context *brw)
/* _NEW_BUFFERS */
struct intel_renderbuffer *depth_irb = intel_get_renderbuffer(fb, 
BUFFER_DEPTH);
struct intel_renderbuffer *stencil_irb = intel_get_renderbuffer(fb, 
BUFFER_STENCIL);
-   struct intel_region *hiz_region = depth_irb ? depth_irb-hiz_region : NULL;
+   bool has_hiz = intel_framebuffer_has_hiz(fb);
unsigned int len;
 
/* 3DSTATE_DEPTH_BUFFER, 3DSTATE_STENCIL_BUFFER are both
@@ -313,7 +313,7 @@ static void emit_depthbuffer(struct brw_context *brw)
   uint32_t tile_x, tile_y, offset;
 
   /* If using separate stencil, hiz must be enabled. */
-  assert(!stencil_irb || hiz_region);
+  assert(!stencil_irb || has_hiz);
 
   switch (region-cpp) {
   case 2:
@@ -322,7 +322,7 @@ static void emit_depthbuffer(struct brw_context *brw)
   case 4:
 if (intel-depth_buffer_is_float)
format = BRW_DEPTHFORMAT_D32_FLOAT;
-else if (hiz_region)
+else if (has_hiz)
format = BRW_DEPTHFORMAT_D24_UNORM_X8_UINT;
 else
format = BRW_DEPTHFORMAT_D24_UNORM_S8_UINT;
@@ -335,14 +335,14 @@ static void emit_depthbuffer(struct brw_context *brw)
   offset = intel_renderbuffer_tile_offsets(depth_irb, tile_x, tile_y);
 
   assert(intel-gen  6 || region-tiling == I915_TILING_Y);
-  assert(!hiz_region || region-tiling == I915_TILING_Y);
+  assert(!has_hiz || region-tiling == I915_TILING_Y);
 
   BEGIN_BATCH(len);
   OUT_BATCH(_3DSTATE_DEPTH_BUFFER  16 | (len - 2));
   OUT_BATCH(((region-pitch * region-cpp) - 1) |
(format  18) |
-   ((hiz_region ? 1 : 0)  21) | /* separate stencil enable */
-   ((hiz_region ? 1 : 0)  22) | /* hiz enable */
+   ((has_hiz ? 1 : 0)  21) | /* separate stencil enable */
+   ((has_hiz ? 1 : 0)  22) | /* hiz enable */
(BRW_TILEWALK_YMAJOR  26) |
((region-tiling != I915_TILING_NONE)  27) |
(BRW_SURFACE_2D  29));
@@ -365,7 +365,7 @@ static void emit_depthbuffer(struct brw_context *brw)
   ADVANCE_BATCH();
}
 
-   if (hiz_region || stencil_irb) {
+   if (has_hiz || stencil_irb) {
   /*
* In the 3DSTATE_DEPTH_BUFFER batch emitted above, the 'separate
* stencil enable' and 'hiz enable' bits were set. Therefore we must
@@ -375,11 +375,12 @@ static void emit_depthbuffer(struct brw_context *brw)
*/
 
   /* Emit hiz buffer. */
-  if (hiz_region) {
+  if (has_hiz) {
+struct intel_hiz_control *hiz = depth_irb-region-hiz;
 BEGIN_BATCH(3);
 OUT_BATCH((_3DSTATE_HIER_DEPTH_BUFFER  16) | (3 - 2));
-OUT_BATCH(hiz_region-pitch * hiz_region-cpp - 1);
-OUT_RELOC(hiz_region-buffer,
+OUT_BATCH(hiz-region-pitch * hiz-region-cpp - 1);
+OUT_RELOC(hiz-region-buffer,
   I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
   0);
 ADVANCE_BATCH();
@@ -417,7 +418,7 @@ static void emit_depthbuffer(struct brw_context *brw)
 * 3DSTATE_CLEAR_PARAMS packet must follow the DEPTH_BUFFER_STATE packet
 * when HiZ is enabled and the DEPTH_BUFFER_STATE changes.
 */
-   if (intel-gen = 6 || hiz_region) {
+   if (intel-gen = 6 || has_hiz) {
   if (intel-gen == 6)
 intel_emit_post_sync_nonzero_flush(intel);
 
diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
b/src/mesa/drivers/dri/intel/intel_context.c
index caac24a..4e48e21 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -1318,8 +1318,8 @@ intel_process_dri2_buffer_with_separate_stencil(struct 
intel_context *intel,
rb-region 
rb-region-name == buffer-name) ||
(buffer-attachment == __DRI_BUFFER_HIZ 
-   rb-hiz_region 
-   rb-hiz_region-name == buffer-name

[Mesa-dev] [PATCH 12/19] i965: Add HiZ operation state to brw_context

2011-09-23 Thread Chad Versace
struct brw_context::hiz contains state needed to perform HiZ meta-ops and
indicates if a HiZ operation is currently in progress.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i965/brw_context.h |   35 +++
 src/mesa/drivers/dri/i965/brw_hiz.c |   20 +
 src/mesa/drivers/dri/i965/brw_hiz.h |8 +++
 src/mesa/drivers/dri/i965/brw_vtbl.c|1 +
 4 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index 6772029..177aa67 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -898,6 +898,41 @@ struct brw_context
   enum state_struct_type type;
} *state_batch_list;
int state_batch_count;
+
+   /**
+* \brief State needed to execute HiZ meta-ops
+*
+* All fields except \c op are initialized by brw_hiz_init().
+*/
+   struct brw_hiz_state {
+  /**
+   * \brief Indicates which HiZ operation is in progress.
+   *
+   * See the following sections of the Sandy Bridge PRM, Volume 1, Part2:
+   *   - 7.5.3.1 Depth Buffer Clear
+   *   - 7.5.3.2 Depth Buffer Resolve
+   *   - 7.5.3.3 Hierarchical Depth Buffer Resolve
+   */
+  enum brw_hiz_op {
+BRW_HIZ_OP_NONE = 0,
+BRW_HIZ_OP_DEPTH_CLEAR,
+BRW_HIZ_OP_DEPTH_RESOLVE,
+BRW_HIZ_OP_HIZ_RESOLVE,
+  } op;
+
+  /** \brief Shader state */
+  struct {
+GLuint program;
+GLuint position_vbo;
+GLint position_location;
+  } shader;
+
+  /** \brief VAO for the rectangle primitive's vertices. */
+  GLuint vao;
+
+  GLuint fbo;
+  struct gl_renderbuffer *depth_rb;
+   } hiz;
 };
 
 
diff --git a/src/mesa/drivers/dri/i965/brw_hiz.c 
b/src/mesa/drivers/dri/i965/brw_hiz.c
index 297b654..4e8baa0 100644
--- a/src/mesa/drivers/dri/i965/brw_hiz.c
+++ b/src/mesa/drivers/dri/i965/brw_hiz.c
@@ -21,6 +21,11 @@
  * IN THE SOFTWARE.
  */
 
+#include mesa/main/arrayobj.h
+#include mesa/main/bufferobj.h
+#include mesa/main/fbobject.h
+#include mesa/main/shaderapi.h
+
 #include brw_hiz.h
 
 void
@@ -38,3 +43,18 @@ brw_hiz_resolve_hizbuffer(struct intel_context *intel,
/* stub */
abort();
 }
+
+void
+brw_hiz_destroy(struct brw_context *brw)
+{
+   if (brw-hiz.fbo == 0) {
+  /* brw-hiz was never initialized. */
+  return;
+   }
+
+   _mesa_DeleteFramebuffersEXT(1, brw-hiz.fbo);
+   _mesa_DeleteRenderbuffersEXT(1, brw-hiz.depth_rb-Name);
+   _mesa_DeleteProgram(brw-hiz.shader.program);
+   _mesa_DeleteVertexArraysAPPLE(1, brw-hiz.vao);
+   _mesa_DeleteBuffersARB(1, brw-hiz.shader.position_vbo);
+}
diff --git a/src/mesa/drivers/dri/i965/brw_hiz.h 
b/src/mesa/drivers/dri/i965/brw_hiz.h
index 1fec0f7..9962d50 100644
--- a/src/mesa/drivers/dri/i965/brw_hiz.h
+++ b/src/mesa/drivers/dri/i965/brw_hiz.h
@@ -33,3 +33,11 @@ brw_hiz_resolve_depthbuffer(struct intel_context *intel,
 void
 brw_hiz_resolve_hizbuffer(struct intel_context *intel,
   struct intel_region *depth_region);
+
+/**
+ * \brief Destroy brw-hiz
+ *
+ * Called by brw_destroy() during context destruction.
+ */
+void
+brw_hiz_destroy(struct brw_context *brw);
diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c 
b/src/mesa/drivers/dri/i965/brw_vtbl.c
index 135887b..4338d80 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -70,6 +70,7 @@ static void brw_destroy_context( struct intel_context *intel )
brw_destroy_state(brw);
brw_draw_destroy( brw );
brw_clear_validated_bos(brw);
+   brw_hiz_destroy(brw);
ralloc_free(brw-wm.compile_data);
 
dri_bo_release(brw-curbe.curbe_bo);
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 13/19] i965: Complete stubs for HiZ operation meta-ops

2011-09-23 Thread Chad Versace
Complete the following functions:
brw_hiz_resolve_depthbuffer
brw_hiz_resolve_hizbuffer

In addition to these meta-ops, we must manipulate several state batches
(see comments to brw_hiz_meta_save). That work is done in the subsequent
commit i965: Manipulate state batches for Hiz meta-ops.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i965/brw_hiz.c |  266 ++-
 1 files changed, 262 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_hiz.c 
b/src/mesa/drivers/dri/i965/brw_hiz.c
index 4e8baa0..8815a26 100644
--- a/src/mesa/drivers/dri/i965/brw_hiz.c
+++ b/src/mesa/drivers/dri/i965/brw_hiz.c
@@ -21,27 +21,285 @@
  * IN THE SOFTWARE.
  */
 
+#include assert.h
+
+#include mesa/drivers/common/meta.h
+
 #include mesa/main/arrayobj.h
 #include mesa/main/bufferobj.h
+#include mesa/main/depth.h
+#include mesa/main/enable.h
 #include mesa/main/fbobject.h
+#include mesa/main/renderbuffer.h
 #include mesa/main/shaderapi.h
+#include mesa/main/varray.h
+#include main/arrayobj.h
+#include main/bufferobj.h
+#include main/fbobject.h
+#include main/shaderapi.h
 
+#include intel_fbo.h
+#include intel_regions.h
+#include intel_tex.h
+
+#include brw_context.h
+#include brw_defines.h
 #include brw_hiz.h
 
+static const uint32_t brw_hiz_meta_save =
+
+  /* Disable alpha, depth, and stencil test.
+   *
+   * See the following sections of the Sandy Bridge PRM, Volume 1, Part2:
+   *   - 7.5.3.1 Depth Buffer Clear
+   *   - 7.5.3.2 Depth Buffer Resolve
+   *   - 7.5.3.3 Hierarchical Depth Buffer Resolve
+   */
+  MESA_META_ALPHA_TEST |
+  MESA_META_DEPTH_TEST |
+  MESA_META_STENCIL_TEST |
+
+  /* Disable viewport mapping.
+   *
+   * From page 11 of the Sandy Bridge PRM, Volume 2, Part 1, Section 1.3
+   * 3D Primitives Overview:
+   *RECTLIST:
+   *Viewport Mapping must be DISABLED (as is typical with the use of
+   *screen- space coordinates).
+   *
+   * We must also manually disable 3DSTATE_SF.Viewport_Transform_Enable.
+   */
+  MESA_META_VIEWPORT |
+
+  /* Disable clipping.
+   *
+   * From page 11 of the Sandy Bridge PRM, Volume 2, Part 1, Section 1.3
+   * 3D Primitives Overview:
+   * Either the CLIP unit should be DISABLED, or the CLIP unit’s Clip
+   * Mode should be set to a value other than CLIPMODE_NORMAL.
+   *
+   * We must also manually disable 3DSTATE_CLIP.Clip_Enable.
+   */
+  MESA_META_CLIP |
+
+  /* Render a solid rectangle (set 3DSTATE_SF.FrontFace_Fill_Mode).
+   *
+   * From page 249 of the Sandy Bridge PRM, Volume 2, Part 1, Section
+   * 6.4.1.1 3DSTATE_SF, FrontFace_Fill_Mode:
+   * SOLID: Any triangle or rectangle object found to be front-facing
+   * is rendered as a solid object. This setting is required when
+   * (rendering rectangle (RECTLIST) objects.
+   * Also see field BackFace_Fill_Mode.
+   *
+   * Note: MESA_META_RASTERIZAION also disables culling, but that is
+   * irrelevant. See 3DSTATE_SF.Cull_Mode.
+   */
+  MESA_META_RASTERIZATION |
+
+  /* Each HiZ operation uses a vertex shader and VAO. */
+  MESA_META_SHADER |
+  MESA_META_VERTEX |
+
+  /* Disable scissoring.
+   *
+   * Scissoring is disabled for resolves because a resolve operation
+   * should resolve the entire buffer. Scissoring is disabled for depth
+   * clears because, if we are performing a partial depth clear, then we
+   * specify the clear region with the RECTLIST vertices.
+   */
+  MESA_META_SCISSOR;
+
+/**
+ * Initialize static data needed for HiZ operations.
+ */
+static void
+brw_hiz_init(struct brw_context *brw)
+{
+   struct gl_context *ctx = brw-intel.ctx;
+   struct brw_hiz_state *hiz = brw-hiz;
+
+   if (hiz-fbo != 0)
+  return;
+
+   /* Create depthbuffer.
+*
+* Until glRenderbufferStorage is called, the renderbuffer hash table
+* maps the renderbuffer name to a dummy renderbuffer. We need the
+* renderbuffer to be registered in the hash table so that framebuffer
+* validation succeeds, so we hackishly allocate storage then immediately
+* discard it.
+*/
+   GLuint depth_rb_name;
+   _mesa_GenRenderbuffersEXT(1, depth_rb_name);
+   _mesa_BindRenderbufferEXT(GL_RENDERBUFFER, depth_rb_name);
+   _mesa_RenderbufferStorageEXT(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, 32, 32);
+   _mesa_reference_renderbuffer(hiz-depth_rb,
+_mesa_lookup_renderbuffer(ctx, depth_rb_name));
+   intel_region_release(((struct intel_renderbuffer*) hiz-depth_rb)-region);
+
+   /* Setup FBO. */
+   _mesa_GenFramebuffersEXT(1, hiz-fbo);
+   _mesa_BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, hiz-fbo);
+   _mesa_FramebufferRenderbufferEXT(GL_DRAW_FRAMEBUFFER,
+GL_DEPTH_ATTACHMENT

[Mesa-dev] [PATCH 14/19] i965/gen6: Don't set intel_context.reduced_primitive on Gen = 6

2011-09-23 Thread Chad Versace
Before this commit, brw_set_prim() used intel_context.reduced_primitive
and BRW_NEW_REDUCED_PRIMITIVE regardless of generation. This was
confusing, because those bits are not actually used on Gen = 6.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i965/brw_draw.c   |3 ++-
 src/mesa/drivers/dri/intel/intel_context.h |2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
b/src/mesa/drivers/dri/i965/brw_draw.c
index bdb5b67..a7becb3 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -106,7 +106,8 @@ static GLuint brw_set_prim(struct brw_context *brw,
   brw-primitive = mode;
   brw-state.dirty.brw |= BRW_NEW_PRIMITIVE;
 
-  if (reduced_prim[mode] != brw-intel.reduced_primitive) {
+  if (brw-intel.gen  6 
+ reduced_prim[mode] != brw-intel.reduced_primitive) {
 brw-intel.reduced_primitive = reduced_prim[mode];
 brw-state.dirty.brw |= BRW_NEW_REDUCED_PRIMITIVE;
   }
diff --git a/src/mesa/drivers/dri/intel/intel_context.h 
b/src/mesa/drivers/dri/intel/intel_context.h
index 78e3ca3..74d88a4 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -265,7 +265,7 @@ struct intel_context
GLuint RenderIndex;
GLmatrix ViewportMatrix;
GLenum render_primitive;
-   GLenum reduced_primitive;
+   GLenum reduced_primitive; /* Only gen  6 */
GLuint vertex_size;
GLubyte *verts;  /* points to tnl-clipspace.vertex_buf */
 
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 15/19] i965: Change type of brw_context.primitive from GLenum to hardware primitive

2011-09-23 Thread Chad Versace
For example, GL_TRIANLES is converted to _3DPRIM_TRILIST.

The conversion is necessary because HiZ and MSAA resolve operations emit
a 3DPRIM_RECTLIST, which cannot be conveyed by GLenum.

As a consequence, brw_gs_prog_key.primitive is also converted.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i965/brw_context.h |2 +-
 src/mesa/drivers/dri/i965/brw_draw.c|   67 ---
 src/mesa/drivers/dri/i965/brw_gs.c  |   44 +++-
 src/mesa/drivers/dri/i965/brw_gs.h  |2 +-
 4 files changed, 62 insertions(+), 53 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index 177aa67..96c3733 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -585,7 +585,7 @@ struct brw_query_object {
 struct brw_context 
 {
struct intel_context intel;  /** base class, must be first field */
-   GLuint primitive;
+   uint32_t primitive; /** Hardware primitive, one of _3DPRIM_*. */
 
GLboolean emit_state_always;
GLboolean has_surface_tile_offset;
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
b/src/mesa/drivers/dri/i965/brw_draw.c
index a7becb3..351f351 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -59,18 +59,22 @@ static GLuint prim_to_hw_prim[GL_POLYGON+1] = {
_3DPRIM_POLYGON
 };
 
-
-static const GLenum reduced_prim[GL_POLYGON+1] = {  
-   GL_POINTS,
-   GL_LINES,
-   GL_LINES,
-   GL_LINES,
-   GL_TRIANGLES,
-   GL_TRIANGLES,
-   GL_TRIANGLES,
-   GL_TRIANGLES,
-   GL_TRIANGLES,
-   GL_TRIANGLES
+static const GLenum
+brw_get_reduced_prim(uint32_t hw_prim)
+{
+   switch (hw_prim) {
+   case _3DPRIM_POINTLIST:  return GL_POINTS;
+   case _3DPRIM_LINELIST:   return GL_LINES;
+   case _3DPRIM_LINELOOP:   return GL_LINES;
+   case _3DPRIM_LINESTRIP:  return GL_LINES;
+   case _3DPRIM_TRILIST:return GL_TRIANGLES;
+   case _3DPRIM_TRISTRIP:   return GL_TRIANGLES;
+   case _3DPRIM_TRIFAN: return GL_TRIANGLES;
+   case _3DPRIM_QUADLIST:   return GL_TRIANGLES;
+   case _3DPRIM_QUADSTRIP:  return GL_TRIANGLES;
+   case _3DPRIM_POLYGON:return GL_TRIANGLES;
+   default: assert(0); return 0;
+   }
 };
 
 
@@ -79,41 +83,40 @@ static const GLenum reduced_prim[GL_POLYGON+1] = {
  * programs be immune to the active primitive (ie. cope with all
  * possibilities).  That may not be realistic however.
  */
-static GLuint brw_set_prim(struct brw_context *brw,
+static void brw_set_prim(struct brw_context *brw,
   const struct _mesa_prim *prim)
 {
struct gl_context *ctx = brw-intel.ctx;
-   GLenum mode = prim-mode;
+   uint32_t hw_prim;
 
DBG(PRIM: %s\n, _mesa_lookup_enum_by_nr(prim-mode));
 
/* Slight optimization to avoid the GS program when not needed:
 */
-   if (mode == GL_QUAD_STRIP 
-   ctx-Light.ShadeModel != GL_FLAT 
-   ctx-Polygon.FrontMode == GL_FILL 
-   ctx-Polygon.BackMode == GL_FILL)
-  mode = GL_TRIANGLE_STRIP;
-
-   if (prim-mode == GL_QUADS  prim-count == 4 
+   if (prim-mode == GL_QUAD_STRIP 
ctx-Light.ShadeModel != GL_FLAT 
ctx-Polygon.FrontMode == GL_FILL 
ctx-Polygon.BackMode == GL_FILL) {
-  mode = GL_TRIANGLE_FAN;
+  hw_prim = _3DPRIM_TRISTRIP;
+   } else if (prim-mode == GL_QUADS  prim-count == 4 
+ ctx-Light.ShadeModel != GL_FLAT 
+ ctx-Polygon.FrontMode == GL_FILL 
+ ctx-Polygon.BackMode == GL_FILL) {
+  hw_prim = _3DPRIM_TRIFAN;
+   } else {
+  hw_prim = prim_to_hw_prim[prim-mode];
}
 
-   if (mode != brw-primitive) {
-  brw-primitive = mode;
+   if (hw_prim != brw-primitive) {
+  brw-primitive = hw_prim;
   brw-state.dirty.brw |= BRW_NEW_PRIMITIVE;
 
   if (brw-intel.gen  6 
- reduced_prim[mode] != brw-intel.reduced_primitive) {
-brw-intel.reduced_primitive = reduced_prim[mode];
+ brw-intel.reduced_primitive != brw_get_reduced_prim(hw_prim)) {
+brw-intel.reduced_primitive = brw_get_reduced_prim(hw_prim);
 brw-state.dirty.brw |= BRW_NEW_REDUCED_PRIMITIVE;
   }
}
-
-   return prim_to_hw_prim[mode];
 }
 
 
@@ -319,7 +322,6 @@ static GLboolean brw_try_draw_prims( struct gl_context *ctx,
intel_prepare_render(intel);
 
for (i = 0; i  nr_prims; i++) {
-  uint32_t hw_prim;
   int estimated_max_prim_size;
 
   estimated_max_prim_size = 512; /* batchbuffer commands */
@@ -336,7 +338,8 @@ static GLboolean brw_try_draw_prims( struct gl_context *ctx,
*/
   intel_batchbuffer_require_space(intel, estimated_max_prim_size, false);
 
-  hw_prim = brw_set_prim(brw, prim[i]);
+  brw_set_prim(brw, prim[i]);
+
   if (brw-state.dirty.brw) {
 brw_validate_state(brw);
 
@@ -372,9 +375,9 @@ static GLboolean brw_try_draw_prims( struct gl_context *ctx,
   }
 
   if (intel-gen = 7)
-gen7_emit_prim(brw, prim

[Mesa-dev] [PATCH 16/19] i965: Manipulate state batches for HiZ operation meta-ops

2011-09-23 Thread Chad Versace
Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i965/brw_draw.c  |3 ++
 src/mesa/drivers/dri/i965/gen6_clip_state.c   |   17 +++
 src/mesa/drivers/dri/i965/gen6_depthstencil.c |   22 +-
 src/mesa/drivers/dri/i965/gen6_sf_state.c |   16 -
 src/mesa/drivers/dri/i965/gen6_wm_state.c |   28 +---
 5 files changed, 78 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
b/src/mesa/drivers/dri/i965/brw_draw.c
index 351f351..af02332 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -103,6 +103,9 @@ static void brw_set_prim(struct brw_context *brw,
  ctx-Polygon.FrontMode == GL_FILL 
  ctx-Polygon.BackMode == GL_FILL) {
   hw_prim = _3DPRIM_TRIFAN;
+   } else if (brw-hiz.op) {
+  assert(prim-mode == GL_TRIANGLES);
+  hw_prim = _3DPRIM_RECTLIST;
} else {
   hw_prim = prim_to_hw_prim[prim-mode];
}
diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c 
b/src/mesa/drivers/dri/i965/gen6_clip_state.c
index 872465d..29b1414 100644
--- a/src/mesa/drivers/dri/i965/gen6_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c
@@ -39,6 +39,23 @@ upload_clip_state(struct brw_context *brw)
uint32_t depth_clamp = 0;
uint32_t provoking, userclip;
 
+   if (brw-hiz.op) {
+  /* HiZ operations emit a rectangle primitive, which requires clipping to
+   * be disabled. From page 10 of the Sandy Bridge PRM Volume 2 Part 1
+   * Section 1.3 3D Primitives Overview:
+   *RECTLIST:
+   *Either the CLIP unit should be DISABLED, or the CLIP unit's Clip
+   *Mode should be set to a value other than CLIPMODE_NORMAL.
+   */
+  BEGIN_BATCH(4);
+  OUT_BATCH(_3DSTATE_CLIP  16 | (4 - 2));
+  OUT_BATCH(0);
+  OUT_BATCH(0);
+  OUT_BATCH(0);
+  ADVANCE_BATCH();
+  return;
+   }
+
if (!ctx-Transform.DepthClamp)
   depth_clamp = GEN6_CLIP_Z_TEST;
 
diff --git a/src/mesa/drivers/dri/i965/gen6_depthstencil.c 
b/src/mesa/drivers/dri/i965/gen6_depthstencil.c
index 5d14147..59f3fe4 100644
--- a/src/mesa/drivers/dri/i965/gen6_depthstencil.c
+++ b/src/mesa/drivers/dri/i965/gen6_depthstencil.c
@@ -77,10 +77,28 @@ gen6_prepare_depth_stencil_state(struct brw_context *brw)
}
 
/* _NEW_DEPTH */
-   if (ctx-Depth.Test) {
-  ds-ds2.depth_test_enable = 1;
+   if (ctx-Depth.Test || brw-hiz.op != 0) {
   ds-ds2.depth_test_func = intel_translate_compare_func(ctx-Depth.Func);
   ds-ds2.depth_write_enable = ctx-Depth.Mask;
+
+  /* See the following sections of the Sandy Bridge PRM, Volume 1, Part2:
+   *   - 7.5.3.1 Depth Buffer Clear
+   *   - 7.5.3.2 Depth Buffer Resolve
+   *   - 7.5.3.3 Hierarchical Depth Buffer Resolve
+   */
+  switch (brw-hiz.op) {
+  case BRW_HIZ_OP_NONE:
+  case BRW_HIZ_OP_DEPTH_RESOLVE:
+ ds-ds2.depth_test_enable = 1;
+ break;
+  case BRW_HIZ_OP_DEPTH_CLEAR:
+  case BRW_HIZ_OP_HIZ_RESOLVE:
+ ds-ds2.depth_test_enable = 0;
+ break;
+  default:
+ assert(0);
+ break;
+  }
}
 
brw-state.dirty.cache |= CACHE_NEW_DEPTH_STENCIL_STATE;
diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c 
b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index 5cbfe78..bdd02ed 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -149,8 +149,20 @@ upload_sf_state(struct brw_context *brw)
   num_outputs  GEN6_SF_NUM_OUTPUTS_SHIFT |
   urb_entry_read_length  GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT |
   urb_entry_read_offset  GEN6_SF_URB_ENTRY_READ_OFFSET_SHIFT;
-   dw2 = GEN6_SF_VIEWPORT_TRANSFORM_ENABLE |
-  GEN6_SF_STATISTICS_ENABLE;
+
+   dw2 = GEN6_SF_STATISTICS_ENABLE;
+
+   /* Enable viewport transform only if no HiZ operation is progress
+*
+* From page 11 of the SandyBridge PRM, Volume 2, Part 1, Section 1.3, 3D
+* Primitives Overview:
+* RECTLIST: Viewport Mapping must be DISABLED (as is typical with the
+* use of screen- space coordinates).
+*/
+   if (brw-hiz.op == 0) {
+  dw2 |= GEN6_SF_VIEWPORT_TRANSFORM_ENABLE;
+   }
+
dw3 = 0;
dw4 = 0;
dw16 = 0;
diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c 
b/src/mesa/drivers/dri/i965/gen6_wm_state.c
index 07e9995..bbc421f 100644
--- a/src/mesa/drivers/dri/i965/gen6_wm_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c
@@ -144,6 +144,23 @@ upload_wm_state(struct brw_context *brw)
dw4 |= (brw-wm.prog_data-first_curbe_grf_16 
   GEN6_WM_DISPATCH_START_GRF_SHIFT_2);
 
+   switch (brw-hiz.op) {
+   case BRW_HIZ_OP_NONE:
+  break;
+   case BRW_HIZ_OP_DEPTH_CLEAR:
+  dw4 |= GEN6_WM_DEPTH_CLEAR;
+  break;
+   case BRW_HIZ_OP_DEPTH_RESOLVE:
+  dw4 |= GEN6_WM_DEPTH_RESOLVE;
+  break;
+   case BRW_HIZ_OP_HIZ_RESOLVE:
+  dw4

[Mesa-dev] [PATCH 17/19] i965: After emitting a HiZ buffer, mark that it needs a HiZ resolve

2011-09-23 Thread Chad Versace
Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i965/brw_misc_state.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c 
b/src/mesa/drivers/dri/i965/brw_misc_state.c
index 5adf2d7..1121f61 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -377,6 +377,8 @@ static void emit_depthbuffer(struct brw_context *brw)
   /* Emit hiz buffer. */
   if (has_hiz) {
 struct intel_hiz_control *hiz = depth_irb-region-hiz;
+assert(hiz-need_resolve != INTEL_HIZ_NEED_HIZ_RESOLVE);
+
 BEGIN_BATCH(3);
 OUT_BATCH((_3DSTATE_HIER_DEPTH_BUFFER  16) | (3 - 2));
 OUT_BATCH(hiz-region-pitch * hiz-region-cpp - 1);
@@ -384,6 +386,10 @@ static void emit_depthbuffer(struct brw_context *brw)
   I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
   0);
 ADVANCE_BATCH();
+
+if (!brw-hiz.op) {
+   hiz-need_resolve = INTEL_HIZ_NEED_DEPTH_RESOLVE;
+}
   } else {
 BEGIN_BATCH(3);
 OUT_BATCH((_3DSTATE_HIER_DEPTH_BUFFER  16) | (3 - 2));
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 18/19] i965: Do needed HiZ meta-ops before drawing

2011-09-23 Thread Chad Versace
In brw_try_draw_prims(), perform a HiZ resolve on the attached depthbuffer
and perform a depth resolve on each enabled depth texture, if needed.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i965/brw_draw.c |   43 ++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
b/src/mesa/drivers/dri/i965/brw_draw.c
index af02332..91f45d2 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -43,6 +43,10 @@
 #include brw_state.h
 
 #include intel_batchbuffer.h
+#include intel_mipmap_tree.h
+#include intel_regions.h
+
+#include intel_fbo.h
 
 #define FILE_DEBUG_FLAG DEBUG_PRIMS
 
@@ -275,6 +279,42 @@ static void brw_merge_inputs( struct brw_context *brw,
   brw-state.dirty.brw |= BRW_NEW_INPUT_DIMENSIONS;
 }
 
+/**
+ * \brief Perform needed HiZ ops before preparing for draw
+ *
+ * If needed, perform a HiZ resolve on the attached depthbuffer and
+ * perform a depth resolve on each enabled depth texture.
+ */
+static void
+brw_predraw_hiz_ops(struct brw_context *brw)
+{
+   struct gl_context *ctx = brw-intel.ctx;
+   struct intel_context *intel = brw-intel;
+
+   /* Maybe perform HiZ resolve on attached depthbuffer. */
+   struct intel_renderbuffer *depth_irb =
+intel_get_renderbuffer(ctx-DrawBuffer, BUFFER_DEPTH);
+   if (depth_irb) {
+  struct intel_region *region = depth_irb-region;
+  if (region-hiz.need_resolve == INTEL_HIZ_NEED_HIZ_RESOLVE) {
+intel-vtbl.resolve_hizbuffer(intel, region);
+  }
+   }
+
+   /* Perform depth resolves on enabled depth textures. */
+   for (int i = 0; i  BRW_MAX_TEX_UNIT; i++) {
+  const struct gl_texture_unit *tex_unit = ctx-Texture.Unit[i];
+  if (!tex_unit-_ReallyEnabled)
+continue;
+  struct intel_texture_object *tex_obj =
+   intel_texture_object(tex_unit-_Current);
+  struct intel_region *region = tex_obj-mt-region;
+  if (region-hiz.need_resolve == INTEL_HIZ_NEED_DEPTH_RESOLVE) {
+intel-vtbl.resolve_depthbuffer(intel, region);
+  }
+   }
+}
+
 /* May fail if out of video memory for texture or vbo upload, or on
  * fallback conditions.
  */
@@ -292,6 +332,9 @@ static GLboolean brw_try_draw_prims( struct gl_context *ctx,
GLboolean warn = GL_FALSE;
GLuint i;
 
+   /* HiZ meta-ops must occur before we update the draw state. */
+   brw_predraw_hiz_ops(brw);
+
if (ctx-NewState)
   _mesa_update_state( ctx );
 
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 19/19] i965/gen7: Manipulate gen7 state batches for HiZ meta-ops

2011-09-23 Thread Chad Versace
From: Kenneth Graunke kenn...@whitecape.org

Signed-off-by: Chad Versace c...@chad-versace.us
Signed-off-by: Kenneth Graunke kenn...@whitecape.org
---
 src/mesa/drivers/dri/i965/gen7_clip_state.c |   17 ++
 src/mesa/drivers/dri/i965/gen7_misc_state.c |   33 +-
 src/mesa/drivers/dri/i965/gen7_sf_state.c   |   13 +-
 src/mesa/drivers/dri/i965/gen7_wm_state.c   |   26 +
 4 files changed, 81 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen7_clip_state.c 
b/src/mesa/drivers/dri/i965/gen7_clip_state.c
index c23ba8c..e6c699e 100644
--- a/src/mesa/drivers/dri/i965/gen7_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_clip_state.c
@@ -36,6 +36,23 @@ upload_clip_state(struct brw_context *brw)
uint32_t provoking, userclip;
uint32_t dw1 = GEN6_CLIP_STATISTICS_ENABLE;
 
+   if (brw-hiz.op) {
+  /* HiZ operations emit a rectangle primitive, which requires clipping to
+   * be disabled. From page 10 of the Sandy Bridge PRM Volume 2 Part 1
+   * Section 1.3 3D Primitives Overview:
+   *RECTLIST:
+   *Either the CLIP unit should be DISABLED, or the CLIP unit's Clip
+   *Mode should be set to a value other than CLIPMODE_NORMAL.
+   */
+  BEGIN_BATCH(4);
+  OUT_BATCH(_3DSTATE_CLIP  16 | (4 - 2));
+  OUT_BATCH(0);
+  OUT_BATCH(0);
+  OUT_BATCH(0);
+  ADVANCE_BATCH();
+  return;
+   }
+
/* _NEW_BUFFERS */
GLboolean render_to_fbo = brw-intel.ctx.DrawBuffer-Name != 0;
 
diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c 
b/src/mesa/drivers/dri/i965/gen7_misc_state.c
index 7544f96..c045b80 100644
--- a/src/mesa/drivers/dri/i965/gen7_misc_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c
@@ -66,6 +66,8 @@ static void prepare_depthbuffer(struct brw_context *brw)
 
if (drb)
   brw_add_validated_bo(brw, drb-region-buffer);
+   if (drb  drb-region-hiz.region)
+  brw_add_validated_bo(brw, drb-region-hiz.region-buffer);
if (srb)
   brw_add_validated_bo(brw, srb-region-buffer);
 }
@@ -79,6 +81,7 @@ static void emit_depthbuffer(struct brw_context *brw)
/* _NEW_BUFFERS */
struct intel_renderbuffer *drb = intel_get_renderbuffer(fb, BUFFER_DEPTH);
struct intel_renderbuffer *srb = intel_get_renderbuffer(fb, BUFFER_STENCIL);
+   bool has_hiz = intel_framebuffer_has_hiz(fb);
 
/* Gen7 doesn't support packed depth/stencil */
assert(srb == NULL || srb != drb);
@@ -122,7 +125,7 @@ static void emit_depthbuffer(struct brw_context *brw)
   OUT_BATCH(GEN7_3DSTATE_DEPTH_BUFFER  16 | (7 - 2));
   OUT_BATCH(((region-pitch * region-cpp) - 1) |
(gen7_depth_format(brw)  18) |
-   (0  22) /* no HiZ buffer */ |
+   ((has_hiz  1)  22) /* enable HiZ */ |
((srb != NULL  ctx-Stencil.WriteMask != 0)  27) |
((ctx-Depth.Mask != 0)  28) |
(BRW_SURFACE_2D  29));
@@ -136,12 +139,28 @@ static void emit_depthbuffer(struct brw_context *brw)
   ADVANCE_BATCH();
}
 
-   BEGIN_BATCH(4);
-   OUT_BATCH(GEN7_3DSTATE_HIER_DEPTH_BUFFER  16 | (4 - 2));
-   OUT_BATCH(0);
-   OUT_BATCH(0);
-   OUT_BATCH(0);
-   ADVANCE_BATCH();
+   if (has_hiz) {
+  struct intel_hiz_control *hiz = drb-region-hiz;
+  assert(hiz-need_resolve != INTEL_HIZ_NEED_HIZ_RESOLVE);
+
+  BEGIN_BATCH(3);
+  OUT_BATCH(GEN7_3DSTATE_HIER_DEPTH_BUFFER  16 | (3 - 2));
+  OUT_BATCH(hiz-region-pitch * hiz-region-cpp - 1);
+  OUT_RELOC(hiz-region-buffer,
+   I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
+   0);
+  ADVANCE_BATCH();
+
+  if (!brw-hiz.op) {
+hiz-need_resolve = INTEL_HIZ_NEED_DEPTH_RESOLVE;
+  }
+   } else {
+  BEGIN_BATCH(3);
+  OUT_BATCH(GEN7_3DSTATE_HIER_DEPTH_BUFFER  16 | (3 - 2));
+  OUT_BATCH(0);
+  OUT_BATCH(0);
+  ADVANCE_BATCH();
+   }
 
if (srb == NULL) {
   BEGIN_BATCH(3);
diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c 
b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index b1bec1a..6505fdb 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -152,7 +152,18 @@ upload_sf_state(struct brw_context *brw)
/* _NEW_BUFFERS */
bool render_to_fbo = brw-intel.ctx.DrawBuffer-Name != 0;
 
-   dw1 = GEN6_SF_STATISTICS_ENABLE | GEN6_SF_VIEWPORT_TRANSFORM_ENABLE;
+   dw1 = GEN6_SF_STATISTICS_ENABLE;
+
+   /* Enable viewport transform only if no HiZ operation is progress
+*
+* From page 11 of the SandyBridge PRM, Volume 2, Part 1, Section 1.3, 3D
+* Primitives Overview:
+* RECTLIST: Viewport Mapping must be DISABLED (as is typical with the
+* use of screen- space coordinates).
+*/
+   if (brw-hiz.op == 0) {
+  dw1 |= GEN6_SF_VIEWPORT_TRANSFORM_ENABLE;
+   }
 
/* _NEW_BUFFERS */
dw1 |= (gen7_depth_format(brw)  
GEN7_SF_DEPTH_BUFFER_SURFACE_FORMAT_SHIFT);
diff --git a/src/mesa/drivers

[Mesa-dev] [PATCH 11/19 v2] intel: Remove intel_renderbuffer::hiz_region

2011-09-23 Thread Chad Versace
And replace it with intel_renderbuffer::region::hiz::region.

v2: In intel_process_dri2_buffer*(), don't call intel_get_renderbuffer() to
get the depthbuffer. The variable 'rb' already points to it.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i965/brw_misc_state.c |   27 +++--
 src/mesa/drivers/dri/intel/intel_context.c |   10 +--
 src/mesa/drivers/dri/intel/intel_fbo.c |   36 ++-
 src/mesa/drivers/dri/intel/intel_fbo.h |3 --
 4 files changed, 29 insertions(+), 47 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c 
b/src/mesa/drivers/dri/i965/brw_misc_state.c
index ce4fc84..5adf2d7 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -206,8 +206,8 @@ static void prepare_depthbuffer(struct brw_context *brw)
 
if (drb)
   brw_add_validated_bo(brw, drb-region-buffer);
-   if (drb  drb-hiz_region)
-  brw_add_validated_bo(brw, drb-hiz_region-buffer);
+   if (drb  drb-region-hiz.region)
+  brw_add_validated_bo(brw, drb-region-hiz.region-buffer);
if (srb)
   brw_add_validated_bo(brw, srb-region-buffer);
 }
@@ -220,7 +220,7 @@ static void emit_depthbuffer(struct brw_context *brw)
/* _NEW_BUFFERS */
struct intel_renderbuffer *depth_irb = intel_get_renderbuffer(fb, 
BUFFER_DEPTH);
struct intel_renderbuffer *stencil_irb = intel_get_renderbuffer(fb, 
BUFFER_STENCIL);
-   struct intel_region *hiz_region = depth_irb ? depth_irb-hiz_region : NULL;
+   bool has_hiz = intel_framebuffer_has_hiz(fb);
unsigned int len;
 
/* 3DSTATE_DEPTH_BUFFER, 3DSTATE_STENCIL_BUFFER are both
@@ -313,7 +313,7 @@ static void emit_depthbuffer(struct brw_context *brw)
   uint32_t tile_x, tile_y, offset;
 
   /* If using separate stencil, hiz must be enabled. */
-  assert(!stencil_irb || hiz_region);
+  assert(!stencil_irb || has_hiz);
 
   switch (region-cpp) {
   case 2:
@@ -322,7 +322,7 @@ static void emit_depthbuffer(struct brw_context *brw)
   case 4:
 if (intel-depth_buffer_is_float)
format = BRW_DEPTHFORMAT_D32_FLOAT;
-else if (hiz_region)
+else if (has_hiz)
format = BRW_DEPTHFORMAT_D24_UNORM_X8_UINT;
 else
format = BRW_DEPTHFORMAT_D24_UNORM_S8_UINT;
@@ -335,14 +335,14 @@ static void emit_depthbuffer(struct brw_context *brw)
   offset = intel_renderbuffer_tile_offsets(depth_irb, tile_x, tile_y);
 
   assert(intel-gen  6 || region-tiling == I915_TILING_Y);
-  assert(!hiz_region || region-tiling == I915_TILING_Y);
+  assert(!has_hiz || region-tiling == I915_TILING_Y);
 
   BEGIN_BATCH(len);
   OUT_BATCH(_3DSTATE_DEPTH_BUFFER  16 | (len - 2));
   OUT_BATCH(((region-pitch * region-cpp) - 1) |
(format  18) |
-   ((hiz_region ? 1 : 0)  21) | /* separate stencil enable */
-   ((hiz_region ? 1 : 0)  22) | /* hiz enable */
+   ((has_hiz ? 1 : 0)  21) | /* separate stencil enable */
+   ((has_hiz ? 1 : 0)  22) | /* hiz enable */
(BRW_TILEWALK_YMAJOR  26) |
((region-tiling != I915_TILING_NONE)  27) |
(BRW_SURFACE_2D  29));
@@ -365,7 +365,7 @@ static void emit_depthbuffer(struct brw_context *brw)
   ADVANCE_BATCH();
}
 
-   if (hiz_region || stencil_irb) {
+   if (has_hiz || stencil_irb) {
   /*
* In the 3DSTATE_DEPTH_BUFFER batch emitted above, the 'separate
* stencil enable' and 'hiz enable' bits were set. Therefore we must
@@ -375,11 +375,12 @@ static void emit_depthbuffer(struct brw_context *brw)
*/
 
   /* Emit hiz buffer. */
-  if (hiz_region) {
+  if (has_hiz) {
+struct intel_hiz_control *hiz = depth_irb-region-hiz;
 BEGIN_BATCH(3);
 OUT_BATCH((_3DSTATE_HIER_DEPTH_BUFFER  16) | (3 - 2));
-OUT_BATCH(hiz_region-pitch * hiz_region-cpp - 1);
-OUT_RELOC(hiz_region-buffer,
+OUT_BATCH(hiz-region-pitch * hiz-region-cpp - 1);
+OUT_RELOC(hiz-region-buffer,
   I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
   0);
 ADVANCE_BATCH();
@@ -417,7 +418,7 @@ static void emit_depthbuffer(struct brw_context *brw)
 * 3DSTATE_CLEAR_PARAMS packet must follow the DEPTH_BUFFER_STATE packet
 * when HiZ is enabled and the DEPTH_BUFFER_STATE changes.
 */
-   if (intel-gen = 6 || hiz_region) {
+   if (intel-gen = 6 || has_hiz) {
   if (intel-gen == 6)
 intel_emit_post_sync_nonzero_flush(intel);
 
diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
b/src/mesa/drivers/dri/intel/intel_context.c
index caac24a..9b17c0d 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -1318,8 +1318,8 @@ intel_process_dri2_buffer_with_separate_stencil(struct 
intel_context *intel,
rb-region 
rb-region-name

[Mesa-dev] [PATCH] intel: Remove intel_renderbuffer::hiz_region

2011-09-23 Thread Chad Versace
And replace it with intel_renderbuffer::region::hiz::region.

v2: In intel_process_dri2_buffer*(), don't call intel_get_renderbuffer() to
get the depthbuffer. The variable 'rb' already points to it.

v3: Actually do what I intended in the v2 change (oops). Replace depth_irb
with rb.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/i965/brw_misc_state.c |   27 +++--
 src/mesa/drivers/dri/intel/intel_context.c |   10 +--
 src/mesa/drivers/dri/intel/intel_fbo.c |   36 ++-
 src/mesa/drivers/dri/intel/intel_fbo.h |3 --
 4 files changed, 29 insertions(+), 47 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c 
b/src/mesa/drivers/dri/i965/brw_misc_state.c
index ce4fc84..5adf2d7 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -206,8 +206,8 @@ static void prepare_depthbuffer(struct brw_context *brw)
 
if (drb)
   brw_add_validated_bo(brw, drb-region-buffer);
-   if (drb  drb-hiz_region)
-  brw_add_validated_bo(brw, drb-hiz_region-buffer);
+   if (drb  drb-region-hiz.region)
+  brw_add_validated_bo(brw, drb-region-hiz.region-buffer);
if (srb)
   brw_add_validated_bo(brw, srb-region-buffer);
 }
@@ -220,7 +220,7 @@ static void emit_depthbuffer(struct brw_context *brw)
/* _NEW_BUFFERS */
struct intel_renderbuffer *depth_irb = intel_get_renderbuffer(fb, 
BUFFER_DEPTH);
struct intel_renderbuffer *stencil_irb = intel_get_renderbuffer(fb, 
BUFFER_STENCIL);
-   struct intel_region *hiz_region = depth_irb ? depth_irb-hiz_region : NULL;
+   bool has_hiz = intel_framebuffer_has_hiz(fb);
unsigned int len;
 
/* 3DSTATE_DEPTH_BUFFER, 3DSTATE_STENCIL_BUFFER are both
@@ -313,7 +313,7 @@ static void emit_depthbuffer(struct brw_context *brw)
   uint32_t tile_x, tile_y, offset;
 
   /* If using separate stencil, hiz must be enabled. */
-  assert(!stencil_irb || hiz_region);
+  assert(!stencil_irb || has_hiz);
 
   switch (region-cpp) {
   case 2:
@@ -322,7 +322,7 @@ static void emit_depthbuffer(struct brw_context *brw)
   case 4:
 if (intel-depth_buffer_is_float)
format = BRW_DEPTHFORMAT_D32_FLOAT;
-else if (hiz_region)
+else if (has_hiz)
format = BRW_DEPTHFORMAT_D24_UNORM_X8_UINT;
 else
format = BRW_DEPTHFORMAT_D24_UNORM_S8_UINT;
@@ -335,14 +335,14 @@ static void emit_depthbuffer(struct brw_context *brw)
   offset = intel_renderbuffer_tile_offsets(depth_irb, tile_x, tile_y);
 
   assert(intel-gen  6 || region-tiling == I915_TILING_Y);
-  assert(!hiz_region || region-tiling == I915_TILING_Y);
+  assert(!has_hiz || region-tiling == I915_TILING_Y);
 
   BEGIN_BATCH(len);
   OUT_BATCH(_3DSTATE_DEPTH_BUFFER  16 | (len - 2));
   OUT_BATCH(((region-pitch * region-cpp) - 1) |
(format  18) |
-   ((hiz_region ? 1 : 0)  21) | /* separate stencil enable */
-   ((hiz_region ? 1 : 0)  22) | /* hiz enable */
+   ((has_hiz ? 1 : 0)  21) | /* separate stencil enable */
+   ((has_hiz ? 1 : 0)  22) | /* hiz enable */
(BRW_TILEWALK_YMAJOR  26) |
((region-tiling != I915_TILING_NONE)  27) |
(BRW_SURFACE_2D  29));
@@ -365,7 +365,7 @@ static void emit_depthbuffer(struct brw_context *brw)
   ADVANCE_BATCH();
}
 
-   if (hiz_region || stencil_irb) {
+   if (has_hiz || stencil_irb) {
   /*
* In the 3DSTATE_DEPTH_BUFFER batch emitted above, the 'separate
* stencil enable' and 'hiz enable' bits were set. Therefore we must
@@ -375,11 +375,12 @@ static void emit_depthbuffer(struct brw_context *brw)
*/
 
   /* Emit hiz buffer. */
-  if (hiz_region) {
+  if (has_hiz) {
+struct intel_hiz_control *hiz = depth_irb-region-hiz;
 BEGIN_BATCH(3);
 OUT_BATCH((_3DSTATE_HIER_DEPTH_BUFFER  16) | (3 - 2));
-OUT_BATCH(hiz_region-pitch * hiz_region-cpp - 1);
-OUT_RELOC(hiz_region-buffer,
+OUT_BATCH(hiz-region-pitch * hiz-region-cpp - 1);
+OUT_RELOC(hiz-region-buffer,
   I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
   0);
 ADVANCE_BATCH();
@@ -417,7 +418,7 @@ static void emit_depthbuffer(struct brw_context *brw)
 * 3DSTATE_CLEAR_PARAMS packet must follow the DEPTH_BUFFER_STATE packet
 * when HiZ is enabled and the DEPTH_BUFFER_STATE changes.
 */
-   if (intel-gen = 6 || hiz_region) {
+   if (intel-gen = 6 || has_hiz) {
   if (intel-gen == 6)
 intel_emit_post_sync_nonzero_flush(intel);
 
diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
b/src/mesa/drivers/dri/intel/intel_context.c
index caac24a..3f66ae1 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -1318,8 +1318,8

Re: [Mesa-dev] [PATCH 00/19] i965: Do HiZ and depth resolves

2011-09-26 Thread Chad Versace

I'm choosing to shelve this series for now. Please continue along; don't waste 
too
much time looking at these patches.

I am concerned by several of the Piglit regressions I've found, and want to
fix those before committing the series. I'll repost when my Piglit results
have less red and black.

--
Chad Versace
c...@chad-versace.us

On 09/23/2011 05:37 PM, Chad Versace wrote:

By default, HiZ is still disabled. This series causes no Piglit regressions
when HiZ is disabled.

When HiZ *is* enabled, it is now stable enough to run gnome-shell, nexuiz, and
openarena without any artifacts. Mipmapped depth textures, however, are still
broken, as well as many Piglit tests.

Chad Versace (18):
   intel: Add HiZ operations to intel_context.vtbl
   i965: Initialize intel_context.vtbl after calling intelInitContext
   i965: Add stub functions for HiZ operations
   i965: Set HiZ operations in brw vtbl
   intel: Add HiZ control state to intel_region
   intel: Add 'mode' param to intel_region_map
   intel: Execute HiZ resolve ops in intel_region_map
   intel: Use intel_region_map/unmap in intel_renderbuffer_map/unmap
   intel: Move definition of intel_framebuffer_get_hiz_region from .h to
 .c
   intel: Add function intel_renderbuffer_hiz_alloc
   intel: Remove intel_renderbuffer::hiz_region
   i965: Add HiZ operation state to brw_context
   i965: Complete stubs for HiZ operation meta-ops
   i965/gen6: Don't set intel_context.reduced_primitive on Gen= 6
   i965: Change type of brw_context.primitive from GLenum to hardware
 primitive
   i965: Manipulate state batches for HiZ operation meta-ops
   i965: After emitting a HiZ buffer, mark that it needs a HiZ resolve
   i965: Do needed HiZ meta-ops before drawing

Kenneth Graunke (1):
   i965/gen7: Manipulate gen7 state batches for HiZ meta-ops

  src/mesa/drivers/dri/i965/Makefile.sources  |1 +
  src/mesa/drivers/dri/i965/brw_context.c |3 +-
  src/mesa/drivers/dri/i965/brw_context.h |   37 +++-
  src/mesa/drivers/dri/i965/brw_draw.c|  114 ++---
  src/mesa/drivers/dri/i965/brw_gs.c  |   44 ++--
  src/mesa/drivers/dri/i965/brw_gs.h  |2 +-
  src/mesa/drivers/dri/i965/brw_hiz.c |  318 +++
  src/mesa/drivers/dri/i965/brw_hiz.h |   43 +++
  src/mesa/drivers/dri/i965/brw_misc_state.c  |   33 ++-
  src/mesa/drivers/dri/i965/brw_vtbl.c|   10 +
  src/mesa/drivers/dri/i965/gen6_clip_state.c |   17 ++
  src/mesa/drivers/dri/i965/gen6_depthstencil.c   |   22 ++-
  src/mesa/drivers/dri/i965/gen6_sf_state.c   |   16 +-
  src/mesa/drivers/dri/i965/gen6_wm_state.c   |   28 ++-
  src/mesa/drivers/dri/i965/gen7_clip_state.c |   17 ++
  src/mesa/drivers/dri/i965/gen7_misc_state.c |   33 ++-
  src/mesa/drivers/dri/i965/gen7_sf_state.c   |   13 +-
  src/mesa/drivers/dri/i965/gen7_wm_state.c   |   26 ++
  src/mesa/drivers/dri/intel/intel_context.c  |   14 +-
  src/mesa/drivers/dri/intel/intel_context.h  |   13 +-
  src/mesa/drivers/dri/intel/intel_fbo.c  |   65 +++--
  src/mesa/drivers/dri/intel/intel_fbo.h  |   23 +-
  src/mesa/drivers/dri/intel/intel_mipmap_tree.c  |   11 +-
  src/mesa/drivers/dri/intel/intel_mipmap_tree.h  |1 +
  src/mesa/drivers/dri/intel/intel_regions.c  |   24 ++-
  src/mesa/drivers/dri/intel/intel_regions.h  |   29 ++-
  src/mesa/drivers/dri/intel/intel_span.c |   13 +-
  src/mesa/drivers/dri/intel/intel_tex.c  |6 +-
  src/mesa/drivers/dri/intel/intel_tex.h  |6 +-
  src/mesa/drivers/dri/intel/intel_tex_image.c|2 +
  src/mesa/drivers/dri/intel/intel_tex_validate.c |   15 +-
  31 files changed, 851 insertions(+), 148 deletions(-)
  create mode 100644 src/mesa/drivers/dri/i965/brw_hiz.c
  create mode 100644 src/mesa/drivers/dri/i965/brw_hiz.h



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa: Allow override of GL version with environment variables

2011-09-26 Thread Chad Versace
It is necessary to manually set the GL version to 3.0 in order to run
Piglit tests using glGetUniform*().

This patch allows one to override the version of an OpenGL, OpenGL ES1, or
OpenGL ES2 context by setting the environment variable MESA_GL_VERSION,
MESA_GLES1_VERSION, or MESA_GLES2_VERSION.

CC: Paul Berry stereotype...@gmail.com
Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/main/version.c |   55 +-
 1 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 80fa0c2..128c3af 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -27,7 +27,40 @@
 #include version.h
 #include git_sha1.h
 
+/**
+ * \brief Override GL version
+ *
+ */
+static void
+override_version(struct gl_context *ctx, GLuint *major, GLuint *minor)
+{
+   const char *env_var;
+   const char *version;
+   int n;
+
+   switch (ctx-API) {
+   case API_OPENGL:
+  env_var = MESA_GL_VERSION;
+  break;
+   case API_OPENGLES:
+  env_var = MESA_GLES1_VERSION;
+  break;
+   case API_OPENGLES2:
+  env_var = MESA_GLES2_VERSION;
+  break;
+   }
 
+   version = getenv(env_var);
+   if (!version) {
+  return;
+   }
+
+   n = sscanf(version, %d.%d., major, minor);
+   if (n != 2) {
+  fprintf(stderr, error: invalid value for %s: %s\n, env_var, version);
+  return;
+   }
+}
 
 /**
  * Examine enabled GL extensions to determine GL version.
@@ -183,6 +216,9 @@ compute_version(struct gl_context *ctx)
 
ctx-VersionMajor = major;
ctx-VersionMinor = minor;
+
+   override_version(ctx, ctx-VersionMajor, ctx-VersionMinor);
+
ctx-VersionString = (char *) malloc(max);
if (ctx-VersionString) {
   _mesa_snprintf(ctx-VersionString, max,
@@ -213,13 +249,20 @@ compute_version_es1(struct gl_context *ctx)
   ctx-Extensions.SGIS_generate_mipmap 
   ctx-Extensions.ARB_vertex_buffer_object);
 
+   /* Set to 0 so that we can detect if the version is not set. */
+   ctx-VersionMajor = 0;
+
if (ver_1_1) {
   ctx-VersionMajor = 1;
   ctx-VersionMinor = 1;
} else if (ver_1_0) {
   ctx-VersionMajor = 1;
   ctx-VersionMinor = 0;
-   } else {
+   }
+
+   override_version(ctx, ctx-VersionMajor, ctx-VersionMinor);
+
+   if (ctx-VersionMajor == 0) {
   _mesa_problem(ctx, Incomplete OpenGL ES 1.0 support.);
}
 
@@ -253,10 +296,18 @@ compute_version_es2(struct gl_context *ctx)
   ctx-Extensions.ARB_fragment_shader 
   ctx-Extensions.ARB_texture_non_power_of_two 
   ctx-Extensions.EXT_blend_equation_separate);
+
+   /* Set to 0 so that we can detect if the version is not set. */
+   ctx-VersionMajor = 0;
+
if (ver_2_0) {
   ctx-VersionMajor = 2;
   ctx-VersionMinor = 0;
-   } else {
+   }
+
+   override_version(ctx, ctx-VersionMajor, ctx-VersionMinor);
+
+   if (ctx-VersionMajor == 0) {
   _mesa_problem(ctx, Incomplete OpenGL ES 2.0 support.);
}
 
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2] mesa: Allow override of GL version with environment variable

2011-09-26 Thread Chad Versace
[idr and kwg, I see your point. I've removed the overrides for GLES1 and
GLES2.]

It is necessary to manually set the GL version to 3.0 in order to run
Piglit tests using glGetUniform*().

This patch allows one to override the version of the OpenGL context by
setting the environment variable MESA_GL_VERSION_OVERRIDE.

v2
---
- [brianp] Change variable name to MESA_GL_VERSION_OVERRIDE.
- [brianp] Document in envvars.html.
- [idr, kwg] Remove overrides for GLES1 and GLES2.

Reviewed-by: Brian Paul bri...@vmware.com
Signed-off-by: Chad Versace c...@chad-versace.us
---
 docs/envvars.html   |2 ++
 src/mesa/main/version.c |   24 
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/docs/envvars.html b/docs/envvars.html
index 986d2f8..7280f2b 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -58,6 +58,8 @@ 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.
+liMESA_GL_VERSION_OVERRIDE - sets the GL version. For example, the value 
3.0
+will enable support for GL 3.0.
 liMESA_GLSL - a href=shading.html#envvarsshading language compiler 
options/a
 /ul
 
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 80fa0c2..bd6feeb 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -27,7 +27,28 @@
 #include version.h
 #include git_sha1.h
 
+/**
+ * Override GL version by setting environment variable
+ * MESA_GL_VERSION_OVERRIDE.
+ */
+static void
+override_version(struct gl_context *ctx, GLuint *major, GLuint *minor)
+{
+   const char *env_var = MESA_GL_VERSION_OVERRIDE;
+   const char *version;
+   int n;
+
+   version = getenv(env_var);
+   if (!version) {
+  return;
+   }
 
+   n = sscanf(version, %d.%d., major, minor);
+   if (n != 2) {
+  fprintf(stderr, error: invalid value for %s: %s\n, env_var, version);
+  return;
+   }
+}
 
 /**
  * Examine enabled GL extensions to determine GL version.
@@ -183,6 +204,9 @@ compute_version(struct gl_context *ctx)
 
ctx-VersionMajor = major;
ctx-VersionMinor = minor;
+
+   override_version(ctx, ctx-VersionMajor, ctx-VersionMinor);
+
ctx-VersionString = (char *) malloc(max);
if (ctx-VersionString) {
   _mesa_snprintf(ctx-VersionString, max,
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] mesa: Allow override of GL version with environment variable

2011-09-27 Thread Chad Versace



On 09/26/2011 01:57 PM, Brian Paul wrote:

On 09/26/2011 02:50 PM, Chad Versace wrote:

[idr and kwg, I see your point. I've removed the overrides for GLES1 and
GLES2.]

It is necessary to manually set the GL version to 3.0 in order to run
Piglit tests using glGetUniform*().

This patch allows one to override the version of the OpenGL context by
setting the environment variable MESA_GL_VERSION_OVERRIDE.

v2
---
- [brianp] Change variable name to MESA_GL_VERSION_OVERRIDE.
- [brianp] Document in envvars.html.
- [idr, kwg] Remove overrides for GLES1 and GLES2.

Reviewed-by: Brian Paulbri...@vmware.com
Signed-off-by: Chad Versacec...@chad-versace.us
---
docs/envvars.html | 2 ++
src/mesa/main/version.c | 24 
2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/docs/envvars.html b/docs/envvars.html
index 986d2f8..7280f2b 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -58,6 +58,8 @@ 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.
+liMESA_GL_VERSION_OVERRIDE - sets the GL version. For example, the value 
3.0
+will enable support for GL 3.0.


The description is a little inaccurate. I'd say something like setting this 
variable changes the value returned by glGetString(GL_VERSION). Mesa will not really 
implement all the features of the given version if it's higher than what's normally 
reported.

-Brian


Ok. I'll change the description to what you suggested.

--
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 10/19] intel: Add function intel_renderbuffer_hiz_alloc

2011-09-27 Thread Chad Versace

On 09/26/2011 02:19 PM, Eric Anholt wrote:

On Fri, 23 Sep 2011 17:37:40 -0700, Chad Versacec...@chad-versace.us  wrote:

This function allocates the HiZ region and initializes the HiZ control
state for a depthbuffer.

It is wise to define the logic for HiZ region allocation in a single
location, since when MSAA arrives that logic will become more complicated.

Signed-off-by: Chad Versacec...@chad-versace.us
---
  src/mesa/drivers/dri/intel/intel_fbo.c |   21 +
  src/mesa/drivers/dri/intel/intel_fbo.h |8 
  2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c 
b/src/mesa/drivers/dri/intel/intel_fbo.c
index 0828af4..bf57e30 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -110,6 +110,27 @@ intel_framebuffer_get_hiz_region(struct gl_framebuffer *fb)
return NULL;
  }

+bool
+intel_renderbuffer_alloc_hiz(struct intel_context *intel,
+ struct intel_renderbuffer *depth_irb)
+{
+   struct intel_region *depth_region = depth_irb-region;
+   struct intel_hiz_control *hiz =depth_irb-region-hiz;
+
+   hiz-region = intel_region_alloc(intel-intelScreen,
+   I915_TILING_Y,
+   depth_region-cpp,
+   depth_region-width,
+   depth_region-height,
+   GL_TRUE);
+   if (!hiz-region)
+  return false;
+
+   hiz-need_resolve = INTEL_HIZ_NEED_NO_RESOLVE;
+   hiz-depth_format = depth_irb-Base.Format;
+   return true;
+}


So, if I allocate a new renderbuffer and do a glClear-equivalent (so
Test enabled and Func == GL_ALWAYS) but not explicitly glClear, will the
depth behavior be correct?  Basically: I'm wondering if there's any
other state to be set up in hiz at alloc time.


I can't think of anything else.

struct intel_hiz_control is intended to contain the information
necessary to record 1) if a resolve op is necessary and 2) the information
needed to execute that op, given that the fundamental object we're tracking
is the depthbuffer's (or texture's) region. So, with that in mind, I can't
think of any other data we may need.

--
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 15/19] i965: Change type of brw_context.primitive from GLenum to hardware primitive

2011-09-27 Thread Chad Versace

On 09/26/2011 12:05 PM, Eric Anholt wrote:

On Fri, 23 Sep 2011 17:37:45 -0700, Chad Versacec...@chad-versace.us  wrote:

For example, GL_TRIANLES is converted to _3DPRIM_TRILIST.


missing a G


Thanks.




-static const GLenum reduced_prim[GL_POLYGON+1] = {
-   GL_POINTS,
-   GL_LINES,
-   GL_LINES,
-   GL_LINES,
-   GL_TRIANGLES,
-   GL_TRIANGLES,
-   GL_TRIANGLES,
-   GL_TRIANGLES,
-   GL_TRIANGLES,
-   GL_TRIANGLES
+static const GLenum
+brw_get_reduced_prim(uint32_t hw_prim)
+{
+   switch (hw_prim) {
+   case _3DPRIM_POINTLIST:  return GL_POINTS;
+   case _3DPRIM_LINELIST:   return GL_LINES;
+   case _3DPRIM_LINELOOP:   return GL_LINES;
+   case _3DPRIM_LINESTRIP:  return GL_LINES;
+   case _3DPRIM_TRILIST:return GL_TRIANGLES;
+   case _3DPRIM_TRISTRIP:   return GL_TRIANGLES;
+   case _3DPRIM_TRIFAN: return GL_TRIANGLES;
+   case _3DPRIM_QUADLIST:   return GL_TRIANGLES;
+   case _3DPRIM_QUADSTRIP:  return GL_TRIANGLES;
+   case _3DPRIM_POLYGON:return GL_TRIANGLES;
+   default: assert(0); return 0;
+   }
  };


I always get scared by changes from tables to switch statements in hot
paths because I don't trust gcc.  I haven't tested to see whether it
does the wrong thing, though.


I investigated what gcc did here with -O3, and it did not do the obvious thing.
So I'll convert these back to lookup tables in v2.




@@ -79,41 +83,40 @@ static const GLenum reduced_prim[GL_POLYGON+1] = {
   * programs be immune to the active primitive (ie. cope with all
   * possibilities).  That may not be realistic however.
   */
-static GLuint brw_set_prim(struct brw_context *brw,
+static void brw_set_prim(struct brw_context *brw,
   const struct _mesa_prim *prim)
  {
 struct gl_context *ctx =brw-intel.ctx;
-   GLenum mode = prim-mode;
+   uint32_t hw_prim;

 DBG(PRIM: %s\n, _mesa_lookup_enum_by_nr(prim-mode));

 /* Slight optimization to avoid the GS program when not needed:
  */
-   if (mode == GL_QUAD_STRIP
-   ctx-Light.ShadeModel != GL_FLAT
-   ctx-Polygon.FrontMode == GL_FILL
-   ctx-Polygon.BackMode == GL_FILL)
-  mode = GL_TRIANGLE_STRIP;
-
-   if (prim-mode == GL_QUADS  prim-count == 4
+   if (prim-mode == GL_QUAD_STRIP
 ctx-Light.ShadeModel != GL_FLAT
 ctx-Polygon.FrontMode == GL_FILL
 ctx-Polygon.BackMode == GL_FILL) {
-  mode = GL_TRIANGLE_FAN;
+  hw_prim = _3DPRIM_TRISTRIP;
+   } else if (prim-mode == GL_QUADS  prim-count == 4
+ ctx-Light.ShadeModel != GL_FLAT
+ ctx-Polygon.FrontMode == GL_FILL
+ ctx-Polygon.BackMode == GL_FILL) {
+  hw_prim = _3DPRIM_TRIFAN;
+   } else {
+  hw_prim = prim_to_hw_prim[prim-mode];
 }


Hmm, you know, this little optimization only matters to pre-snb (I would
guess that it's a marginally bad thing on snb).  That doesn't leave much
of this function shared between the two.


How about I precede this commit with
i965: Split brw_set_prim into brw/gen6 variants

The slight optimization to avoid the GS program in brw_set_prim() is not

used by Gen 6, since Gen 6 doesn't use a GS program. Also, Gen 6 doesn't use
reduced primitives.




-   if (mode != brw-primitive) {
-  brw-primitive = mode;
+   if (hw_prim != brw-primitive) {
+  brw-primitive = hw_prim;
brw-state.dirty.brw |= BRW_NEW_PRIMITIVE;

if (brw-intel.gen  6
- reduced_prim[mode] != brw-intel.reduced_primitive) {
-brw-intel.reduced_primitive = reduced_prim[mode];
+ brw-intel.reduced_primitive != brw_get_reduced_prim(hw_prim)) {
+brw-intel.reduced_primitive = brw_get_reduced_prim(hw_prim);
 brw-state.dirty.brw |= BRW_NEW_REDUCED_PRIMITIVE;
}
 }
-
-   return prim_to_hw_prim[mode];
  }


--
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 16/19] i965: Manipulate state batches for HiZ operation meta-ops

2011-09-27 Thread Chad Versace
, this commit can be deleted.

--
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 17/19] i965: After emitting a HiZ buffer, mark that it needs a HiZ resolve

2011-09-27 Thread Chad Versace

On 09/26/2011 02:38 PM, Eric Anholt wrote:

On Fri, 23 Sep 2011 17:37:47 -0700, Chad Versacec...@chad-versace.us  wrote:

Signed-off-by: Chad Versacec...@chad-versace.us
---
  src/mesa/drivers/dri/i965/brw_misc_state.c |6 ++
  1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c 
b/src/mesa/drivers/dri/i965/brw_misc_state.c
index 5adf2d7..1121f61 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -377,6 +377,8 @@ static void emit_depthbuffer(struct brw_context *brw)
/* Emit hiz buffer. */
if (has_hiz) {
 struct intel_hiz_control *hiz =depth_irb-region-hiz;
+assert(hiz-need_resolve != INTEL_HIZ_NEED_HIZ_RESOLVE);
+
 BEGIN_BATCH(3);
 OUT_BATCH((_3DSTATE_HIER_DEPTH_BUFFER  16) | (3 - 2));
 OUT_BATCH(hiz-region-pitch * hiz-region-cpp - 1);
@@ -384,6 +386,10 @@ static void emit_depthbuffer(struct brw_context *brw)
   I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
   0);
 ADVANCE_BATCH();
+
+if (!brw-hiz.op) {
+   hiz-need_resolve = INTEL_HIZ_NEED_DEPTH_RESOLVE;
+}


This one makes me uncomfortable, because emit_depthbuffer isn't called
every single time drawing using the depthbuffer occurs.  However, I
can't come up with a way to fail:

If you had a swrast-driven depth access between two Render engine draws,
then there was a batch flush, so the second Render draw will
emit_depthbuffer() too.

If you had texturing from it, then for there to be defined behavior
(without whatever that GL extension is), you must have unbound the depth
buffer iirc, so that will result in an emit_depthbuffer() when
re-bound.

We don't have anything using the blitter in between draws, because lol Y
tiling.

So I think this is OK, but I'm still nervous.


Your nervousness is contagious. Now I'm prompted to find a better place
to set `hiz-need_resolve = DEPTH_RESOLVE`.

I think the proper location for the update is brw_try_draw_prims(). If the
DepthMask is enabled and the depthbuffer has hiz, then at the point of
emitting a primitive we know that a depth resolve must be needed.

--
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl 1.30: Fix numerical instabilities in asinh

2011-09-27 Thread Chad Versace

On 09/26/2011 04:19 PM, Paul Berry wrote:

The formula we were previously using for asinh:

 asinh x = ln(x + sqrt(x * x + 1))

is numerically unstable: when x is a large negative value, the quantity

 x + sqrt(x * x + 1)

is a small positive value (on the order of 1/(2|x|)).  Since the
logarithm function is very sensitive in this range, any error in the
computation of the square root manifests as a large error in the
result.

This patch changes the formula to:

 asinh x = sign(x) * ln(abs(x) + sqrt(x * x + 1))

which is only slightly more expensive to compute, and is numerically
stable for all x.

Fixes piglit tests
spec/glsl-1.30/execution/built-in-functions/[fv]s-asinh-*.
---
  src/glsl/builtins/ir/asinh |   40 
  1 files changed, 36 insertions(+), 4 deletions(-)


I would mention in the commit message that the new formula is
equivalent to the old. This isn't evident at first glance, and I
first thought that the new was perhaps just a good, stable approximation
of the old.

Reviewed-by: Chad Versace c...@chad-versace.us

--
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] mesa: Allow override of GL version with environment variable

2011-09-27 Thread Chad Versace

On 09/27/2011 09:29 AM, Ian Romanick wrote:

On 09/26/2011 01:50 PM, Chad Versace wrote:

[idr and kwg, I see your point. I've removed the overrides for GLES1 and
GLES2.]

It is necessary to manually set the GL version to 3.0 in order to run
Piglit tests using glGetUniform*().

This patch allows one to override the version of the OpenGL context by
setting the environment variable MESA_GL_VERSION_OVERRIDE.

v2
---
- [brianp] Change variable name to MESA_GL_VERSION_OVERRIDE.
- [brianp] Document in envvars.html.
- [idr, kwg] Remove overrides for GLES1 and GLES2.

Reviewed-by: Brian Paulbri...@vmware.com
Signed-off-by: Chad Versacec...@chad-versace.us


Other than the comment below and Brian's comment about the envvars.html 
description,

Reviewed-by: Ian Romanick ian.d.roman...@intel.com


---
docs/envvars.html | 2 ++
src/mesa/main/version.c | 24 
2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/docs/envvars.html b/docs/envvars.html
index 986d2f8..7280f2b 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -58,6 +58,8 @@ 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.
+liMESA_GL_VERSION_OVERRIDE - sets the GL version. For example, the value 
3.0
+will enable support for GL 3.0.
liMESA_GLSL -a href=shading.html#envvarsshading language compiler 
options/a
/ul

diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 80fa0c2..bd6feeb 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -27,7 +27,28 @@
#include version.h
#include git_sha1.h

+/**
+ * Override GL version by setting environment variable
+ * MESA_GL_VERSION_OVERRIDE.
+ */
+static void
+override_version(struct gl_context *ctx, GLuint *major, GLuint *minor)
+{
+ const char *env_var = MESA_GL_VERSION_OVERRIDE;
+ const char *version;
+ int n;
+
+ version = getenv(env_var);
+ if (!version) {
+ return;
+ }

+ n = sscanf(version, %d.%d., major, minor);

^
Spurious period?


I've removed the period.

It was lucky chance that the extra period didn't alter any behavior.


+ if (n != 2) {
+ fprintf(stderr, error: invalid value for %s: %s\n, env_var, version);
+ return;
+ }
+}

/**
* Examine enabled GL extensions to determine GL version.
@@ -183,6 +204,9 @@ compute_version(struct gl_context *ctx)

ctx-VersionMajor = major;
ctx-VersionMinor = minor;
+
+ override_version(ctx,ctx-VersionMajor,ctx-VersionMinor);
+
ctx-VersionString = (char *) malloc(max);
if (ctx-VersionString) {
_mesa_snprintf(ctx-VersionString, max,


--
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] mesa: Allow override of GL version with environment variable

2011-09-27 Thread Chad Versace

On 09/27/2011 09:48 AM, Dave Airlie wrote:

This patch allows one to override the version of the OpenGL context by
setting the environment variable MESA_GL_VERSION_OVERRIDE.

v2
---
- [brianp] Change variable name to MESA_GL_VERSION_OVERRIDE.
- [brianp] Document in envvars.html.
- [idr, kwg] Remove overrides for GLES1 and GLES2.

Reviewed-by: Brian Paulbri...@vmware.com
Signed-off-by: Chad Versacec...@chad-versace.us


Don't suppose you want to make the GLSL version override more generic as well?

Dave.


Actually, I do. How about MESA_GLSL_VERSION_OVERIDE?

--
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] mesa: Allow overriding GLSL version with environment varirable

2011-09-27 Thread Chad Versace
Override the context's GLSL version if the environment variable
MESA_GLSL_VERSION_OVERRIDE is set. Valid values for
MESA_GLSL_VERSION_OVERRIDE are integers, such as 130.

MESA_GLSL_VERSION_OVERRIDE has the same behavior as INTEL_GLSL_VERSION,
except that it applies to all drivers, not just Intel's. Since the former
supercedes the latter, this patch disables the latter.

CC: Dave Airlie airl...@gmail.com
Signed-off-by: Chad Versace c...@chad-versace.us
---
 docs/envvars.html |4 
 src/mesa/drivers/dri/intel/intel_extensions.c |3 ++-
 src/mesa/drivers/dri/r600/r600_context.c  |1 +
 src/mesa/main/context.c   |1 +
 src/mesa/main/version.c   |   24 
 src/mesa/main/version.h   |2 ++
 src/mesa/state_tracker/st_extensions.c|1 +
 7 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/docs/envvars.html b/docs/envvars.html
index 6402ec5..8c5c6ab 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -62,6 +62,10 @@ This is a work-around for that.
 glGetString(GL_VERSION). Valid values are point-separated version numbers,
 such as 3.0. Mesa will not really implement all the features of the given
 version if it's higher than what's normally reported.
+liMESA_GLSL_VERSION_OVERRIDE - changes the value returned by
+glGetString(GL_SHADING_LANGUAGE_VERSION). Valid values are integers, such as
+130.  Mesa will not really implement all the features of the given language 
version
+if it's higher than what's normally reported. (for developers only)
 liMESA_GLSL - a href=shading.html#envvarsshading language compiler 
options/a
 /ul
 
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c 
b/src/mesa/drivers/dri/intel/intel_extensions.c
index 6ccd5b3..e9a36eb 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -112,7 +112,8 @@ intelInitExtensions(struct gl_context *ctx)
ctx-Extensions.OES_EGL_image = true;
 #endif
 
-   ctx-Const.GLSLVersion = get_glsl_version();
+   ctx-Const.GLSLVersion = 120;
+   _mesa_override_glsl_version(ctx);
 
if (intel-gen = 5)
   ctx-Extensions.EXT_timer_query = true;
diff --git a/src/mesa/drivers/dri/r600/r600_context.c 
b/src/mesa/drivers/dri/r600/r600_context.c
index 247d551..3e296ef 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -173,6 +173,7 @@ static void r600InitConstValues(struct gl_context *ctx, 
radeonScreenPtr screen)
 }
 
 ctx-Const.GLSLVersion = 120;
+_mesa_override_glsl_version(ctx);
 
ctx-Const.MaxTextureImageUnits = 16;
/* 8 per clause on r6xx, 16 on r7xx
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index b20063c..2532c47 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -627,6 +627,7 @@ _mesa_init_constants(struct gl_context *ctx)
/* Shading language version */
if (ctx-API == API_OPENGL) {
   ctx-Const.GLSLVersion = 120;
+  _mesa_override_glsl_version(ctx);
}
else if (ctx-API == API_OPENGLES2) {
   ctx-Const.GLSLVersion = 100;
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index a5deeab..b06262e 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -52,6 +52,30 @@ override_version(struct gl_context *ctx, GLuint *major, 
GLuint *minor)
 }
 
 /**
+ * Override the context's GLSL version if the environment variable
+ * MESA_GLSL_VERSION_OVERRIDE is set. Valid values for
+ * MESA_GLSL_VERSION_OVERRIDE are integers, such as 130.
+ */
+void
+_mesa_override_glsl_version(struct gl_context *ctx)
+{
+   const char *env_var = MESA_GLSL_VERSION_OVERRIDE;
+   const char *version;
+   int n;
+
+   version = getenv(env_var);
+   if (!version) {
+  return;
+   }
+
+   n = sscanf(version, %d, ctx-Const.GLSLVersion);
+   if (n != 1) {
+  fprintf(stderr, error: invalid value for %s: %s\n, env_var, version);
+  return;
+   }
+}
+
+/**
  * Examine enabled GL extensions to determine GL version.
  * Return major and minor version numbers.
  */
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index 0a0512c..32e141f 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -56,5 +56,7 @@ struct gl_context;
 extern void
 _mesa_compute_version(struct gl_context *ctx);
 
+extern void
+_mesa_override_glsl_version(struct gl_context *ctx);
 
 #endif /* VERSION_H */
diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index ef284ad..5506db6 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -216,6 +216,7 @@ void st_init_limits(struct st_context *st)
   c-MaxProgramTexelOffset = screen-get_param(screen, 
PIPE_CAP_MAX_TEXEL_OFFSET);
 
   c-GLSLVersion = 120;
+  _mesa_override_glsl_version(c);
   c-UniformBooleanTrue = ~0;
}
 }
-- 
1.7.6.2

[Mesa-dev] [PATCH 2/2] intel: Remove unused function get_glsl_version()

2011-09-27 Thread Chad Versace
It was replaced by _mesa_override_glsl_version().

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/dri/intel/intel_extensions.c |   16 
 1 files changed, 0 insertions(+), 16 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c 
b/src/mesa/drivers/dri/intel/intel_extensions.c
index e9a36eb..104e096 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -33,22 +33,6 @@
 #include utils.h
 
 /**
- * \brief Get GLSL version from the environment.
- *
- * If the environment variable INTEL_GLSL_VERSION is set, convert its value
- * to an integer and return it. Otherwise, return the default version, 120.
- */
-static GLuint
-get_glsl_version()
-{
-const char * s = getenv(INTEL_GLSL_VERSION);
-if (s == NULL)
-return 120;
-else
-return (GLuint) atoi(s);
-}
-
-/**
  * Initializes potential list of extensions if ctx == NULL, or actually enables
  * extensions for a context.
  */
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 7/7] glsl: Add support for constant expression evaluation on round(), roundEven().

2011-09-27 Thread Chad Versace

On 09/27/2011 03:08 PM, Eric Anholt wrote:

They're both implemented the same in GLSL IR (since round() has
undefined behavior for N.5).

Fixes glsl-1.30/compiler/built-in-functions/round*
---
  src/glsl/ir_constant_expression.cpp |   10 ++
  1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir_constant_expression.cpp 
b/src/glsl/ir_constant_expression.cpp
index b3fe6cf..59a7e67 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -196,6 +196,13 @@ ir_expression::constant_expression_value()
}
break;

+   case ir_unop_round_even:
+  assert(op[0]-type-base_type == GLSL_TYPE_FLOAT);
+  for (unsigned c = 0; c  op[0]-type-components(); c++) {
+data.f[c] = rint(op[0]-value.f[c]);
+  }
+  break;
+
 case ir_unop_ceil:
assert(op[0]-type-base_type == GLSL_TYPE_FLOAT);
for (unsigned c = 0; c  op[0]-type-components(); c++) {
@@ -1324,6 +1331,9 @@ ir_call::constant_expression_value()
* op[1]-value.f[c];
 }
}
+   } else if (strcmp(callee, round) == 0 ||
+ strcmp(callee, roundEven) == 0) {
+  expr = new(mem_ctx) ir_expression(ir_unop_round_even, op[0]);
 } else if (strcmp(callee, sign) == 0) {
expr = new(mem_ctx) ir_expression(ir_unop_sign, type, op[0], NULL);
 } else if (strcmp(callee, sin) == 0) {


A minor performance nitpick:
I think it is better to use nearbyint() here rather than rint(). When
`rint(n) != n`, rint() takes the extra trouble to set FE_INEXACT, but
nearbyint() just does the rounding and nothing else.

Either way, the code is correct.
Reviewed-by: Chad Versace c...@chad-versace.us
--
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/7] ir_to_mesa: Don't assertion fail on remaining GLSL 1.30 ops.

2011-09-27 Thread Chad Versace

For pathes 1-6:
Reviewed-by: Chad Versace c...@chad-versace.us

I have a minor comment on patch 7.

--
Chad Versace
c...@chad-versace.us

On 09/27/2011 03:08 PM, Eric Anholt wrote:

For hardware drivers, we only have ir_to_mesa called for the purposes
of potential swrast fallbacks (basically never on a 1.30 driver),
which we don't really care about.  This will allow 1.30 to be
implemented without rewriting swrast for it.
---
  src/mesa/program/ir_to_mesa.cpp |   12 ++--
  1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 7b2c69f..c5b71b3 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1456,14 +1456,22 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
emit_scalar(ir, OPCODE_POW, result_dst, op[0], op[1]);
break;

-   case ir_unop_bit_not:
+  /* GLSL 1.30 integer ops are unsupported in Mesa IR, but since
+   * hardware backends have no way to avoid Mesa IR generation
+   * even if they don't use it, we need to emit something and
+   * continue.
+   */
 case ir_binop_lshift:
 case ir_binop_rshift:
 case ir_binop_bit_and:
 case ir_binop_bit_xor:
 case ir_binop_bit_or:
+  emit(ir, OPCODE_ADD, result_dst, op[0], op[1]);
+  break;
+
+   case ir_unop_bit_not:
 case ir_unop_round_even:
-  assert(!GLSL 1.30 features unsupported);
+  emit(ir, OPCODE_MOV, result_dst, op[0]);
break;

 case ir_quadop_vector:



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Convert _mesa_generate_mipmap to MapTexImage()-based access.

2011-09-28 Thread Chad Versace

This patch fixes many Piglit tests [failing due to assert(region-map_refcount 
== 0)]
on SNB when HiZ is enabled, and causes no regressions.

Tested-by: Chad Versace c...@chad-versace.us

On 09/27/2011 12:27 PM, Eric Anholt wrote:

From: Brian Paulbri...@vmware.com

Now that we can zero-copy generate the mipmaps into brand new
glTexImage()-generated storage using MapTextureImage(), we no longer
need to allocate image-Data in mipmap generate.  This requires
deleting the drivers' old overrides of the miptree tracking after
calling _mesa_generate_mipmap at the same time, or the drivers
promptly lose our newly-generated data.
---
  src/mesa/drivers/dri/intel/intel_tex.c |   30 +---
  src/mesa/drivers/dri/nouveau/nouveau_texture.c |   10 -
  src/mesa/drivers/dri/radeon/radeon_texture.c   |   50 +-
  src/mesa/main/mipmap.c |  270 +---
  src/mesa/main/mipmap.h |4 +-
  src/mesa/state_tracker/st_gen_mipmap.c |  205 +--
  6 files changed, 153 insertions(+), 416 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex.c 
b/src/mesa/drivers/dri/intel/intel_tex.c
index 55b3e34..bc7b1f6 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -163,37 +163,9 @@ intelGenerateMipmap(struct gl_context *ctx, GLenum target,
  struct gl_texture_object *texObj)
  {
 if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, texObj)) {
-  /* sw path: need to map texture images */
-  struct intel_context *intel = intel_context(ctx);
-  struct intel_texture_object *intelObj = intel_texture_object(texObj);
-  struct gl_texture_image *first_image = 
texObj-Image[0][texObj-BaseLevel];
-
fallback_debug(%s - fallback to swrast\n, __FUNCTION__);

-  if (_mesa_is_format_compressed(first_image-TexFormat)) {
- _mesa_generate_mipmap(ctx, target, texObj);
-  } else {
- intel_tex_map_level_images(intel, intelObj, texObj-BaseLevel);
- _mesa_generate_mipmap(ctx, target, texObj);
- intel_tex_unmap_level_images(intel, intelObj, texObj-BaseLevel);
-  }
-
-  if (!_mesa_is_format_compressed(first_image-TexFormat)) {
- GLuint nr_faces = (texObj-Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
- GLuint face, i;
- for (face = 0; face  nr_faces; face++) {
-for (i = texObj-BaseLevel + 1; i  texObj-MaxLevel; i++) {
-   struct intel_texture_image *intelImage =
-  intel_texture_image(texObj-Image[face][i]);
-   if (!intelImage)
-  break;
-   /* Unreference the miptree to signal that the new Data is a
-* bare pointer from mesa.
-*/
-   intel_miptree_release(intelImage-mt);
-}
- }
-  }
+  _mesa_generate_mipmap(ctx, target, texObj);
 }
 else {
_mesa_meta_GenerateMipmap(ctx, target, texObj);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 9dc2186..508c8a5 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -739,17 +739,7 @@ nouveau_generate_mipmap(struct gl_context *ctx, GLenum 
target,
  {
if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, t)) {
struct gl_texture_image *base = t-Image[0][t-BaseLevel];
-
-   nouveau_teximage_map(ctx, base, GL_MAP_READ_BIT,
-0, 0, base-Width, base-Height);
_mesa_generate_mipmap(ctx, target, t);
-   nouveau_teximage_unmap(ctx, base);
-
-   if (!_mesa_is_format_compressed(base-TexFormat)) {
-   store_mipmap(ctx, target, t-BaseLevel + 1,
-get_last_level(t), t);
-   }
-
} else {
_mesa_meta_GenerateMipmap(ctx, target, t);
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c 
b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 7f824ce..6bd8967 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -324,52 +324,6 @@ radeon_unmap_texture_image(struct gl_context *ctx,
radeon_bo_unmap(image-mt-bo);
  }

-/**
- * Wraps Mesa's implementation to ensure that the base level image is mapped.
- *
- * This relies on internal details of _mesa_generate_mipmap, in particular
- * the fact that the memory for recreated texture images is always freed.
- */
-static void radeon_generate_mipmap(struct gl_context *ctx, GLenum target,
-  struct gl_texture_object *texObj)
-{
-   radeonTexObj* t = radeon_tex_obj(texObj);
-   GLuint nr_faces = (t-base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
-   int i, face;
-   struct gl_texture_image *first_image

[Mesa-dev] [PATCH] mesa: Remove unused tnl items from dd_functions

2011-09-30 Thread Chad Versace
Remove NeedValidate and ValidateTnlModule.

Signed-off-by: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/common/driverfuncs.c |2 --
 src/mesa/main/dd.h|   19 ---
 2 files changed, 0 insertions(+), 21 deletions(-)

diff --git a/src/mesa/drivers/common/driverfuncs.c 
b/src/mesa/drivers/common/driverfuncs.c
index 3e28969..33da934 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -200,8 +200,6 @@ _mesa_init_driver_functions(struct dd_function_table 
*driver)
_mesa_init_sampler_object_functions(driver);
 
/* TL stuff */
-   driver-NeedValidate = GL_FALSE;
-   driver-ValidateTnlModule = NULL;
driver-CurrentExecPrimitive = 0;
driver-CurrentSavePrimitive = 0;
driver-NeedFlush = 0;
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 720e4f5..1ccba50 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -815,25 +815,6 @@ struct dd_function_table {
/*@{*/
 
/**
-* Bitmask of state changes that require the current TL module to be
-* validated, using ValidateTnlModule() below.
-*/
-   GLuint NeedValidate;
-
-   /**
-* Validate the current TL module. 
-*
-* This is called directly after UpdateState() when a state change that has
-* occurred matches the dd_function_table::NeedValidate bitmask above.  This
-* ensures all computed values are up to date, thus allowing the driver to
-* decide if the current TL module needs to be swapped out.
-*
-* This must be non-NULL if a driver installs a custom TL module and sets
-* the dd_function_table::NeedValidate bitmask, but may be NULL otherwise.
-*/
-   void (*ValidateTnlModule)( struct gl_context *ctx, GLuint new_state );
-
-   /**
 * Set by the driver-supplied TL engine.  
 *
 * Set to PRIM_OUTSIDE_BEGIN_END when outside glBegin()/glEnd().
-- 
1.7.6.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] configure: replace pkg-config calls $(PKG_CONFIG) in the makefiles.

2011-10-03 Thread Chad Versace
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 10/03/2011 03:20 PM, Stéphane Marchesin wrote:
 Us poor souls who cross compile mesa want to be able to specify which 
 pkg-config to pick, or at least just change one place.

Would setting PKG_CONFIG_PATH at configuration time solve your problem?

When I cross-compile or do other pkg-config hocus pocus, I invoke configure as
./configure ... PKG_CONFIG_PATH=/my-libdrm/pkgconfig

- -- 
Chad Versace
c...@chad-versace.us
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOijviAAoJEAIvNt057x8ijtgP/0zxUtnczMWFoMBh2atEy/oJ
/x3Bc3LE23jJeIFpsKquGWM20EFsW/CxmT+IdZSOKVqYPs2CRGe4Wy1VGmT19YWc
UfJK52HjoMrXxHEes9cGcM4RSnPhKGGkYD0eQwyODTrVC0RfbvSM+4cK7Yj3sH0s
adrqXPCYYTCy0lOYy0sE4Z1zX76PUEEpILCmlEMZO+eZS89NczrNGQsC9u/SPK7o
MtH+jbpBizXsoeTHBUnD85qd6zpY10K8bWLjDIeK5jLdEQP4nCmYb590vK1Qh4W2
meEL8VXmqRGTS0Vwe37CHYK3YEObYERFstLaK5nrxfWSI229INn10G1KDCQvZhJp
yhu19OpAUFmLYCs2c5A6k00iL7J1lYrltqLzUBV/HKyJnVYCfgLZMcu31TvrwiS2
PdMgjBNP/l/LcUcUS8Ki/9B7UeFigiS8p062Js+tF7cZkjbF3LHqcQ+s3ploWJsF
9HitXQB4ZtX6+0tkgerokP1N/rS9b+pTJCbuiWFZ8yy73KTpNCHjRs/Hrywfi5W4
c2c0mf8J2lQPv9BSPwX4RBpeqwNp4ZkI+0yhWkzmvtQv5wUwfour3uyTUq5JChMK
qydOVxTaGeW9pHmzRQ0hg0GPwbWLqF+lqG3HJAefKn9OcJ160iHYKf+IPnxI51BN
wfh2CdhUp6YJ2uH0bYhD
=qW6V
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


<    1   2   3   4   5   6   7   8   9   10   >