[Mesa-dev] [PATCH 1/2] gles1: Enable GL_EXT_texture_format_BGRA8888 in APIspec

2012-03-24 Thread Benjamin Franzke
The extension is already exposed for GLES1, but the APIspec
doesnt allow the usage of GL_BGRA_EXT in glTex(Sub)Image2D.
---
 src/mesa/main/APIspec.xml |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index eeae599..437b963 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -3829,6 +3829,7 @@
category name=OES_element_index_uint/
category name=OES_mapbuffer/
category name=EXT_texture_filter_anisotropic/
+   category name=EXT_texture_format_BGRA/
 
category name=ARB_texture_non_power_of_two/
!-- disabled due to missing enums
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 2/2] gles: Enable the GL_EXT_read_format_bgra extension

2012-03-24 Thread Benjamin Franzke
Also fixes the usage of GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES,
which may be set to a BGRA format e.g. for a MESA_FORMAT_ARGB fb.
---
 src/mesa/main/APIspec.xml  |2 ++
 src/mesa/main/extensions.c |1 +
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index 437b963..29975f6 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -3830,6 +3830,7 @@
category name=OES_mapbuffer/
category name=EXT_texture_filter_anisotropic/
category name=EXT_texture_format_BGRA/
+   category name=EXT_read_format_bgra/
 
category name=ARB_texture_non_power_of_two/
!-- disabled due to missing enums
@@ -4124,6 +4125,7 @@
category name=OES_packed_depth_stencil/
category name=OES_standard_derivatives/
category name=EXT_texture_format_BGRA/
+   category name=EXT_read_format_bgra/
 
category name=EXT_texture_compression_dxt1/
category name=EXT_blend_minmax/
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 732b9a6..7166739 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -198,6 +198,7 @@ static const struct extension extension_table[] = {
{ GL_EXT_texture_env_dot3,o(EXT_texture_env_dot3),
GL, 2000 },
{ GL_EXT_texture_filter_anisotropic,  
o(EXT_texture_filter_anisotropic),  GL | ES1 | ES2, 1999 },
{ GL_EXT_texture_format_BGRA, o(dummy_true),  
 ES1 | ES2, 2005 },
+   { GL_EXT_read_format_bgra,o(dummy_true),  
 ES1 | ES2, 2009 },
{ GL_EXT_texture_integer, o(EXT_texture_integer), 
GL, 2006 },
{ GL_EXT_texture_lod_bias,o(dummy_true),  
GL | ES1,   1999 },
{ GL_EXT_texture_mirror_clamp,
o(EXT_texture_mirror_clamp),GL, 2004 },
-- 
1.7.3.4

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


Re: [Mesa-dev] [PATCH 3/4] configure: Fix egl compilation without x11 headers

2012-03-05 Thread Benjamin Franzke
2012/3/1 Chad Versace chad.vers...@linux.intel.com:
 On 03/01/2012 11:39 AM, Benjamin Franzke wrote:
 2012/3/1 Chad Versace chad.vers...@linux.intel.com:
 On 02/29/2012 07:36 AM, Benjamin Franzke wrote:
 We dont want eglplatform.h to typedef egl native types
 to x11 types, when x11 headers are not available.
 ---
  configure.ac |    4 
  1 files changed, 4 insertions(+), 0 deletions(-)

 diff --git a/configure.ac b/configure.ac
 index 0caa1b1..92a0e52 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -1402,6 +1402,10 @@ if test x$enable_egl = xyes; then

      AC_CHECK_FUNC(mincore, [DEFINES=$DEFINES -DHAVE_MINCORE])

 +    if test $have_x != yes; then
 +        DEFINES=$DEFINES -DMESA_EGL_NO_X11_HEADERS
 +    fi
 +
      if test $enable_static != yes; then
          # build egl_glx when libGL is built
          if test x$enable_glx = xyes; then

 After examining the where the macro is used, in eglplatform.h ...

 --- snip ---
 #elif defined(__unix__)

 #ifdef MESA_EGL_NO_X11_HEADERS

 typedef void            *EGLNativeDisplayType;
 typedef khronos_uint32_t EGLNativePixmapType;
 typedef khronos_uint32_t EGLNativeWindowType;

 #else

 /* X11 (tentative)  */
 #include X11/Xlib.h
 #include X11/Xutil.h

 typedef Display *EGLNativeDisplayType;
 typedef Pixmap   EGLNativePixmapType;
 typedef Window   EGLNativeWindowType;

 #endif /* MESA_EGL_NO_X11_HEADERS */
 --- end snip ---

 I can't think of a valid reason for the #else branch to ever be taken.
 If you're building EGL on Unix/Linux, but not for gbm (__GBM__), Android 
 (ANDRDOID),
 Wayland (WL_EGL_PLATFORM), or X (the default), then for what platform
 are you building libEGL? (The question is not rhetorical).

 The platform headers for wayland/gbm are not included when compiling
 src/egl/main/* or some other common code in st/egl, that is when the
 else branch is taken.
 So currently we include Xlib.h when building without x11 platform,
 that fails if its not available.
 Will add a note to the commit message.

 It appears that the patch may introduce a bug in the 64-bit build of libEGL,
 but I'm not certain. Here's my reasoning.

 1. Suppose that
   - This patch is applied.
   - The system has no X headers installed.
   - Some Wayland application has a source file, broken.c, that
     #includes wayland-egl.h then EGL/egl.h.

 2. In eglapi.c, which defines eglCreateWindowSurface, EGLNativeWindowType
   will be defined as khronos_uint32_t.

 3. In broken.c, wayland-egl.h first defines WL_EGL_PLATFORM. Then
   EGLNativeWindowType will be defined as wl_egl_window*, a 64-bit type.

Yes, thanks for pointing that out.
We should just typedef them to khronos_uintptr_t instead.


 Without the patch, eglapi.c safely typedefs EGLNativeWindowType to XID, which 
 matches
 the system's pointer size.

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


[Mesa-dev] [PATCH 1/4] meta: Fix compilation without FEATURE_feedback

2012-02-29 Thread Benjamin Franzke
That is when building with --disable-opengl.
Fix for commit c5f4024a793f1209b1693aed9a46be9374ba4741.

CC: Chad Versace c...@chad-versace.us
---
 src/mesa/drivers/common/meta.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 6c8495d..f7fa7b9 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -174,10 +174,12 @@ struct save_state
struct gl_query_object *CondRenderQuery;
GLenum CondRenderMode;
 
+#if FEATURE_feedback
/** MESA_META_SELECT_FEEDBACK */
GLenum RenderMode;
struct gl_selection Select;
struct gl_feedback Feedback;
+#endif
 
/** Miscellaneous (always disabled) */
GLboolean Lighting;
@@ -700,6 +702,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
 _mesa_EndConditionalRender();
}
 
+#if FEATURE_feedback
if (state  MESA_META_SELECT_FEEDBACK) {
   save-RenderMode = ctx-RenderMode;
   if (ctx-RenderMode == GL_SELECT) {
@@ -710,6 +713,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
 _mesa_RenderMode(GL_RENDER);
   }
}
+#endif
 
/* misc */
{
@@ -984,6 +988,7 @@ _mesa_meta_end(struct gl_context *ctx)
  save-CondRenderMode);
}
 
+#if FEATURE_feedback
if (state  MESA_META_SELECT_FEEDBACK) {
   if (save-RenderMode == GL_SELECT) {
 _mesa_RenderMode(GL_SELECT);
@@ -993,6 +998,7 @@ _mesa_meta_end(struct gl_context *ctx)
 ctx-Feedback = save-Feedback;
   }
}
+#endif
 
/* misc */
if (save-Lighting) {
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 2/4] meta: Fix compilation without FEATURE_EXT_transform_feedback

2012-02-29 Thread Benjamin Franzke
That is when building with --disable-opengl.
Fix for commit cb045880b113b0042d8dfb7e4cdf76e6cc76c1d1.

CC: Paul Berry stereotype...@gmail.com
---
 src/mesa/drivers/common/meta.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index f7fa7b9..95336fc 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -184,7 +184,9 @@ struct save_state
/** Miscellaneous (always disabled) */
GLboolean Lighting;
GLboolean RasterDiscard;
+#if FEATURE_EXT_transform_feedback
GLboolean TransformFeedbackNeedsResume;
+#endif
 };
 
 /**
@@ -427,6 +429,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
memset(save, 0, sizeof(*save));
save-SavedState = state;
 
+#if FEATURE_EXT_transform_feedback
/* Pausing transform feedback needs to be done early, or else we won't be
 * able to change other state.
 */
@@ -435,6 +438,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
   !ctx-TransformFeedback.CurrentObject-Paused;
if (save-TransformFeedbackNeedsResume)
   _mesa_PauseTransformFeedback();
+#endif
 
if (state  MESA_META_ALPHA_TEST) {
   save-AlphaEnabled = ctx-Color.AlphaEnabled;
@@ -1007,8 +1011,10 @@ _mesa_meta_end(struct gl_context *ctx)
if (save-RasterDiscard) {
   _mesa_set_enable(ctx, GL_RASTERIZER_DISCARD, GL_TRUE);
}
+#if FEATURE_EXT_transform_feedback
if (save-TransformFeedbackNeedsResume)
   _mesa_ResumeTransformFeedback();
+#endif
 }
 
 
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 3/4] configure: Fix egl compilation without x11 headers

2012-02-29 Thread Benjamin Franzke
We dont want eglplatform.h to typedef egl native types
to x11 types, when x11 headers are not available.
---
 configure.ac |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0caa1b1..92a0e52 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1402,6 +1402,10 @@ if test x$enable_egl = xyes; then
 
 AC_CHECK_FUNC(mincore, [DEFINES=$DEFINES -DHAVE_MINCORE])
 
+if test $have_x != yes; then
+DEFINES=$DEFINES -DMESA_EGL_NO_X11_HEADERS
+fi
+
 if test $enable_static != yes; then
 # build egl_glx when libGL is built
 if test x$enable_glx = xyes; then
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 4/4] configure: Allow compiling egl_dri2 without xcb dri2

2012-02-29 Thread Benjamin Franzke
That is only when the egl x11 platform is not choosen to be build.
---
 configure.ac |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 92a0e52..345d865 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1418,12 +1418,13 @@ if test x$enable_egl = xyes; then
 DEFINES=$DEFINES -DHAVE_LIBUDEV
 fi
 if test x$enable_dri = xyes; then
+EGL_DRIVER_DRI2=dri2
+
 # build egl_dri2 when xcb-dri2 is available
 PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 xcb-xfixes],
  [have_xcb_dri2=yes],[have_xcb_dri2=no])
 
 if test $have_xcb_dri2 = yes; then
-EGL_DRIVER_DRI2=dri2
 DEFINES=$DEFINES -DHAVE_XCB_DRI2
 # workaround a bug in xcb-dri2 generated by xcb-proto 1.6
save_LIBS=$LIBS
@@ -1431,6 +1432,10 @@ if test x$enable_egl = xyes; then
   [DEFINES=$DEFINES 
-DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN])
LIBS=$save_LIBS
 fi
+case $with_egl_platforms$have_xcb_dri2 in
+*x11*no|no)
+AC_MSG_ERROR([egl_dri2 requires x11-xcb, xcb-dri2 and 
xcb-xfixes]) ;;
+esac
fi
 
 EGL_DRIVERS_DIRS=$EGL_DRIVERS_DIRS $EGL_DRIVER_DRI2
-- 
1.7.3.4

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


Re: [Mesa-dev] [PATCH 1] wayland-egl: Add api to get window/pixmap attributes (enable libva over wayland)

2012-02-23 Thread Benjamin Franzke
Hi,

Sorry for not responding earlier..
There are some objections from my side:
1. These functions only cover the driver-independent lookups.
   But for the wl_egl_pixmap there was a need to access driver_private:
   http://cgit.freedesktop.org/~bnf/libva/tree/va/wayland/va_wayland.c?h=wayland
   Thats not covered by this patch, so the private header would still be needed.

   Note: Of course thats a hack, as commented in the code.
I rather think of a drm-specific vfunc now, that allows set/get by drm name.
But having that in the public wayland-egl header is not an option,
since that
should be driver/platform independent.
So we need to share something just between mesa and libva somehow.

2. We dont like the wayland-egl.h much, if we could drop it easily, we
would do it.
   So expanding it has always a bitter taste, and I'd like not to add
more stuff,
   thats hard to drop later, if possible.

Unfortunately I dont have a better answer now, which is why the header
was copied over.

2012/2/23 Zhao, Halley halley.z...@intel.com:
 Resend the patch, it is required to enable libva over wayland.



 Ian/Eric:

 Could you help to review this patch?



 == patch description ==:

 wl_egl_window/wl_egl_pixmap are implemented in mesa, however these drawables
 can also be update in video/camera modules.

 An example is that libva also manage buffer object for it, so the attributes
 of the drawable should be accessed outside of mesa.

 With this patch, we can remove the hack to copy wayland-egl-priv.h from mesa
 to libva.



 Libva related changes are here for your reference:
 https://gitorious.org/libva-wayland/libva-wayland/commits/wayland

 It bases on Benjamin’s work to enable libva for wayland:
 http://cgit.freedesktop.org/~bnf/libva/log/?h=wayland



 == patch details ==:



 src/egl/wayland/wayland-egl/wayland-egl.c |   29
 +

 1 files changed, 29 insertions(+), 0 deletions(-)



 diff --git a/src/egl/wayland/wayland-egl/wayland-egl.c
 b/src/egl/wayland/wayland-egl/wayland-egl.c

 index e950b4a..b7efab8 100644

 --- a/src/egl/wayland/wayland-egl/wayland-egl.c

 +++ b/src/egl/wayland/wayland-egl/wayland-egl.c

 @@ -81,3 +81,32 @@ wl_egl_pixmap_create_buffer(struct wl_egl_pixmap
 *egl_pixmap)

 {

    return egl_pixmap-buffer;

 }

 +

 +WL_EGL_EXPORT void

 +wl_egl_window_get_size(struct wl_egl_window *egl_window,

 +   int *width, int *height)

 +{

 +   if (width)

 +    *width = egl_window-width;

 +   if (height)

 +    *height = egl_window-height;

 +}

 +

 +WL_EGL_EXPORT struct wl_surface*

 +wl_egl_window_get_surface(struct wl_egl_window *win)

 +{

 +    if (win)

 +    return win-surface;

 +    else

 +    return NULL;

 +}

 +

 +WL_EGL_EXPORT void

 +wl_egl_pixmap_get_size(struct wl_egl_pixmap *egl_pixmap,

 +   int *width, int *height)

 +{

 +   if (width)

 +    *width = egl_pixmap-width;

 +   if (height)

 +    *height = egl_pixmap-height;

 +}

 --

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


Re: [Mesa-dev] [Patch 2] wayland-drm: export wayland-drm-client-protocol.h for installation (enable libva over wayland)

2012-02-23 Thread Benjamin Franzke
If we really want the drm protocol header to be public, i'd prefer to
have it in a seperate repository.
But Kristian didnt want that.
But in the meantime, whats so bad in having that simple protocol file
copied over?

2012/2/23 Zhao, Halley halley.z...@intel.com:
 Resend the patch, it is required to enable libva over wayland.



 == patch description ==

 Besides graphics, other modules (like video/camera) also depends on drm for
 buffer management.

 So wayland drm protocol header file should be installed.



 Libva related changes are here for your reference:
 https://gitorious.org/libva-wayland/libva-wayland/commits/wayland

 It bases on Benjamin’s work to enable libva for wayland:
 http://cgit.freedesktop.org/~bnf/libva/log/?h=wayland



 With this patch, we can avoid the hack to copy wayland-drm.xml from mesa to
 libva.



 == patch details ==

 src/egl/wayland/wayland-drm/Makefile.am |    3 ++-

 1 files changed, 2 insertions(+), 1 deletions(-)



 diff --git a/src/egl/wayland/wayland-drm/Makefile.am
 b/src/egl/wayland/wayland-drm/Makefile.am

 index cf15eda..2e68ac4 100644

 --- a/src/egl/wayland/wayland-drm/Makefile.am

 +++ b/src/egl/wayland/wayland-drm/Makefile.am

 @@ -7,8 +7,9 @@ noinst_LTLIBRARIES = libwayland-drm.la

 libwayland_drm_la_SOURCES = wayland-drm.c wayland-drm-protocol.c

 noinst_HEADERS = wayland-drm.h



 +include_HEADERS = wayland-drm-client-protocol.h

 +

 BUILT_SOURCES = wayland-drm-protocol.c \

 - wayland-drm-client-protocol.h \

    wayland-drm-server-protocol.h

 CLEANFILES = $(BUILT_SOURCES)



 --

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


Re: [Mesa-dev] Quick EGL questions

2012-02-09 Thread Benjamin Franzke
2012/2/9 Thomas Hellstrom thellst...@vmware.com:
 Hi!

 I have a couple of quick EGL questions that I hope someone knows the answer
 to:

 1) I'm trying to test the vmwgfx_dri driver with EGL driver egl_dri2,
 platform drm, but it doesn't seem like this
 configuration supports EGL_MESA_screen_surface so basically all relevant EGL
 demos fail. Is this the case, or
 is it more likely that we are missing something in the vmwgfx driver?

Yes, egl_dri2 intentionally doesnt support EGL_MESA_screen_surface.
The plan was to deprecate (and later remove) that one,
and it replace with an egl surface type for gbm.

There are already patches for this on the wayland devel list:
http://lists.freedesktop.org/archives/wayland-devel/2012-January/001856.html

In the meantime you may want to get src/egl/opengl/eglkms.c working.


 2) Why is --enable-shared-glapi needed with the drm EGL platform?

The gbm dri backend and egl_dri2 code both use a dri_screen, and share that.
When gbm_dri loads a dri driver, those require some _glapi_* symbols.
In a non-shared-glapi configuration they are either in libGL, libGLESv2, etc
But we cant link gbm against any of those, since the application
should choose which one to link to, thats why we need to link against
the shared glapi.


 Thanks,

 Thomas

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


Re: [Mesa-dev] [PATCH] add wayland cflags when building wayland-egl

2012-01-29 Thread Benjamin Franzke
Thanks, commited.

2012/1/29  juan.j.z...@linux.intel.com:
 From: Juan Zhao juan.j.z...@linux.intel.com

 to fix the header file missing when building wayland-egl
 ---
  src/egl/wayland/wayland-egl/Makefile.am |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)

 diff --git a/src/egl/wayland/wayland-egl/Makefile.am 
 b/src/egl/wayland/wayland-egl/Makefile.am
 index a19a5fc..7d20a1a 100644
 --- a/src/egl/wayland/wayland-egl/Makefile.am
 +++ b/src/egl/wayland/wayland-egl/Makefile.am
 @@ -1,7 +1,8 @@
  pkgconfigdir = $(libdir)/pkgconfig
  pkgconfig_DATA = wayland-egl.pc

 -AM_CFLAGS = $(DEFINES)
 +AM_CFLAGS = $(DEFINES) \
 +           $(WAYLAND_CFLAGS)

  lib_LTLIBRARIES = libwayland-egl.la
  noinst_HEADERS = wayland-egl-priv.h
 --
 1.7.2.2

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


[Mesa-dev] [PATCH] st/dri: Support 24bit formats in dri2_allocate_buffer

2012-01-29 Thread Benjamin Franzke
Prior commit 576161289df68eedade591fbca4013329c9e5ded,
the parameter format was bpp, thus both 24bit and 32bit formats were
requested with format set to 32. Handle 24bit seperately now.

Fixes RGBX formats in wayland platform for egl_dri2 (EGL_ALPHA_SIZE=0).

Note: This is a candidate for the 8.0 branch.
---
 src/gallium/state_trackers/dri/drm/dri2.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/dri/drm/dri2.c 
b/src/gallium/state_trackers/dri/drm/dri2.c
index afd91ee..4c08a02 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -316,6 +316,9 @@ dri2_allocate_buffer(__DRIscreen *sPriv,
 
switch (format) {
   case 32:
+ pf = PIPE_FORMAT_B8G8R8A8_UNORM;
+ break;
+  case 24:
  pf = PIPE_FORMAT_B8G8R8X8_UNORM;
  break;
   case 16:
-- 
1.7.3.4

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


Re: [Mesa-dev] Mesa (master): automake: src/egl/wayland

2012-01-26 Thread Benjamin Franzke
) supports shared 
 libraries... yes
 checking whether -lc should be explicitly linked in... no
 checking dynamic linker characteristics... GNU/Linux ld.so
 checking how to hardcode library paths into programs... immediate
 checking whether stripping libraries is possible... yes
 checking if libtool supports shared libraries... yes
 checking whether to build shared libraries... yes
 checking whether to build static libraries... no
 checking how to run the C preprocessor... gcc -E
 checking for gcc... (cached) gcc
 checking whether we are using the GNU C compiler... (cached) yes
 checking whether gcc accepts -g... (cached) yes
 checking for gcc option to accept ISO C89... (cached) none needed
 checking dependency style of gcc... (cached) gcc3
 checking for g++... g++
 checking whether we are using the GNU C++ compiler... yes
 checking whether g++ accepts -g... yes
 checking dependency style of g++... gcc3
 checking whether we are using the GNU C++ compiler... (cached) yes
 checking whether g++ accepts -g... (cached) yes
 checking dependency style of g++... (cached) gcc3
 checking how to run the C++ preprocessor... g++ -E
 checking for ld used by g++... /usr/bin/ld -m elf_x86_64
 checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
 checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared 
 libraries... yes
 checking for g++ option to produce PIC... -fPIC -DPIC
 checking if g++ PIC flag -fPIC -DPIC works... yes
 checking if g++ static flag -static works... yes
 checking if g++ supports -c -o file.o... yes
 checking if g++ supports -c -o file.o... (cached) yes
 checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared 
 libraries... yes
 checking dynamic linker characteristics... GNU/Linux ld.so
 checking how to hardcode library paths into programs... immediate
 checking for gmake... no
 checking for make... make
 checking for python2... no
 checking for python... python
 checking for a sed that does not truncate output... (cached) /bin/sed
 checking for makedepend... /usr/bin/makedepend
 checking for flex... /usr/bin/flex
 checking for bison... /usr/bin/bison
 checking for gtest-config... no
 checking if compiling with clang... no
 checking whether gcc version is sufficient... yes
 checking for pkg-config... /usr/bin/pkg-config
 checking pkg-config is at least version 0.9.0... yes
 checking whether gcc supports -fvisibility=hidden... yes
 checking whether g++ supports -fvisibility=hidden... yes
 checking whether to enable assembly... yes, x86_64
 checking for gcc option to produce PIC... -fPIC
 checking for dlopen... no
 checking for dlopen in -ldl... yes
 checking for posix_memalign... yes
 checking for LIBDRM... yes
 checking pkg-config files for X11 are available... yes
 checking for X11... yes
 checking for GLPROTO... yes
 checking for DRI2PROTO... yes
 checking for XF86VIDMODE... yes
 checking for DRIGL... yes
 checking for xcb_glx_create_context_attribs_arb_checked in -lxcb-glx... no
 checking expat.h usability... yes
 checking expat.h presence... yes
 checking for expat.h... yes
 checking for XML_ParserCreate in -lexpat... yes
 checking for mincore... yes
 checking for LIBUDEV... yes
 checking for XCB_DRI2... no
 checking for XORG... yes
 checking for LIBDRM_XORG... yes
 checking for LIBKMS_XORG... yes
 checking for XEXT... yes
 checking for gawk... (cached) mawk
 checking for grep that handles long lines and -e... (cached) /bin/grep
 checking for nm... /usr/bin/nm -B
 ./configure: line 20795: syntax error near unexpected token 
 `'$(top_srcdir)/src/egl/wayland/wayland-drm/protocol''
 ./configure: line 20795: `                
 WAYLAND_SCANNER_RULES('$(top_srcdir)/src/egl/wayland/wayland-drm/protocol')'

 Jose

 - Original Message -
 Module: Mesa
 Branch: master
 Commit: 8b902056d53e0e14f7d58ac7f95091ab06abc72e
 URL:
    
 http://cgit.freedesktop.org/mesa/mesa/commit/?id=8b902056d53e0e14f7d58ac7f95091ab06abc72e

 Author: Benjamin Franzke benjaminfran...@googlemail.com
 Date:   Tue Jan 24 20:38:01 2012 +0100

 automake: src/egl/wayland

 So we can use the wayland scanner makro, which is way
 better than our previous runtime-pkgconfig hack.

 Reviewed-by: Matt Turner matts...@gmail.com

 ---

  configs/autoconf.in                           |    7 ---
  configs/default                               |    7 ---
  configure.ac                                  |   24 +++--
  src/egl/drivers/dri2/Makefile                 |    2 +-
  src/egl/main/Makefile                         |    2 +-
  src/egl/wayland/.gitignore                    |    9 +++
  src/egl/wayland/Makefile                      |   30 --
  src/egl/wayland/Makefile.am                   |    1 +
  src/egl/wayland/wayland-drm/.gitignore        |    3 -
  src/egl/wayland/wayland-drm/Makefile          |   47
  
  src/egl/wayland/wayland-drm/Makefile.am       |   15 +
  src/egl/wayland/wayland-egl/Makefile          |   71
  -
  src/egl/wayland

[Mesa-dev] [PATCH] automake: src/egl/wayland

2012-01-25 Thread Benjamin Franzke
So we can use the wayland scanner makro, which is way
better than our previous runtime-pkgconfig hack.
---
 configs/autoconf.in   |7 ---
 configs/default   |7 ---
 configure.ac  |   24 +++--
 src/egl/drivers/dri2/Makefile |2 +-
 src/egl/main/Makefile |2 +-
 src/egl/wayland/.gitignore|9 +++
 src/egl/wayland/Makefile  |   30 --
 src/egl/wayland/Makefile.am   |1 +
 src/egl/wayland/wayland-drm/.gitignore|3 -
 src/egl/wayland/wayland-drm/Makefile  |   47 
 src/egl/wayland/wayland-drm/Makefile.am   |   15 +
 src/egl/wayland/wayland-egl/Makefile  |   71 -
 src/egl/wayland/wayland-egl/Makefile.am   |9 +++
 src/egl/wayland/wayland-egl/wayland-egl.pc.in |   14 ++---
 src/gallium/targets/egl-static/Makefile   |2 +-
 15 files changed, 50 insertions(+), 193 deletions(-)
 create mode 100644 src/egl/wayland/.gitignore
 delete mode 100644 src/egl/wayland/Makefile
 create mode 100644 src/egl/wayland/Makefile.am
 delete mode 100644 src/egl/wayland/wayland-drm/.gitignore
 delete mode 100644 src/egl/wayland/wayland-drm/Makefile
 create mode 100644 src/egl/wayland/wayland-drm/Makefile.am
 delete mode 100644 src/egl/wayland/wayland-egl/Makefile
 create mode 100644 src/egl/wayland/wayland-egl/Makefile.am

diff --git a/configs/autoconf.in b/configs/autoconf.in
index 38fe317..3de3412 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -75,7 +75,6 @@ GLESv1_CM_LIB = GLESv1_CM
 GLESv2_LIB = GLESv2
 VG_LIB = OpenVG
 GLAPI_LIB = glapi
-WAYLAND_EGL_LIB = wayland-egl
 
 # Library names (actual file names)
 GL_LIB_NAME = @GL_LIB_NAME@
@@ -87,7 +86,6 @@ GLESv1_CM_LIB_NAME = @GLESv1_CM_LIB_NAME@
 GLESv2_LIB_NAME = @GLESv2_LIB_NAME@
 VG_LIB_NAME = @VG_LIB_NAME@
 GLAPI_LIB_NAME = @GLAPI_LIB_NAME@
-WAYLAND_EGL_LIB_NAME = @WAYLAND_EGL_LIB_NAME@
 
 # Globs used to install the lib and all symlinks
 GL_LIB_GLOB = @GL_LIB_GLOB@
@@ -99,7 +97,6 @@ GLESv1_CM_LIB_GLOB = @GLESv1_CM_LIB_GLOB@
 GLESv2_LIB_GLOB = @GLESv2_LIB_GLOB@
 VG_LIB_GLOB = @VG_LIB_GLOB@
 GLAPI_LIB_GLOB = @GLAPI_LIB_GLOB@
-WAYLAND_EGL_LIB_GLOB = @WAYLAND_EGL_LIB_GLOB@
 
 # Directories to build
 LIB_DIR = @LIB_DIR@
@@ -143,7 +140,6 @@ GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv1_CM_LIB_DEPS@
 GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv2_LIB_DEPS@
 VG_LIB_DEPS = $(EXTRA_LIB_PATH) @VG_LIB_DEPS@
 GLAPI_LIB_DEPS = $(EXTRA_LIB_PATH) @GLAPI_LIB_DEPS@
-WAYLAND_EGL_LIB_DEPS = $(EXTRA_LIB_PATH) @WAYLAND_EGL_LIB_DEPS@
 
 # DRI dependencies
 MESA_MODULES = @MESA_MODULES@
@@ -202,9 +198,6 @@ GLESv2_PC_LIB_PRIV = @GLESv2_PC_LIB_PRIV@
 EGL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@
 EGL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@
 EGL_PC_CFLAGS = @GL_PC_CFLAGS@
-WAYLAND_EGL_PC_REQ_PRIV = @WAYLAND_EGL_PC_REQ_PRIV@
-WAYLAND_EGL_PC_LIB_PRIV = @WAYLAND_EGL_PC_LIB_PRIV@
-WAYLAND_EGL_PC_CFLAGS = @WAYLAND_EGL_PC_CFLAGS@
 
 XCB_DRI2_CFLAGS = @XCB_DRI2_CFLAGS@
 XCB_DRI2_LIBS = @XCB_DRI2_LIBS@
diff --git a/configs/default b/configs/default
index 7e1aceb..43cb510 100644
--- a/configs/default
+++ b/configs/default
@@ -62,7 +62,6 @@ GLESv1_CM_LIB = GLESv1_CM
 GLESv2_LIB = GLESv2
 VG_LIB = OpenVG
 GLAPI_LIB = glapi
-WAYLAND_EGL_LIB = wayland-egl
 
 # Library names (actual file names)
 GL_LIB_NAME = lib$(GL_LIB).so
@@ -74,7 +73,6 @@ GLESv1_CM_LIB_NAME = lib$(GLESv1_CM_LIB).so
 GLESv2_LIB_NAME = lib$(GLESv2_LIB).so
 VG_LIB_NAME = lib$(VG_LIB).so
 GLAPI_LIB_NAME = lib$(GLAPI_LIB).so
-WAYLAND_EGL_LIB_NAME = lib$(WAYLAND_EGL_LIB).so
 
 # globs used to install the lib and all symlinks
 GL_LIB_GLOB = $(GL_LIB_NAME)*
@@ -86,7 +84,6 @@ GLESv1_CM_LIB_GLOB = $(GLESv1_CM_LIB_NAME)*
 GLESv2_LIB_GLOB = $(GLESv2_LIB_NAME)*
 VG_LIB_GLOB = $(VG_LIB_NAME)*
 GLAPI_LIB_GLOB = $(GLAPI_LIB_NAME)*
-WAYLAND_EGL_LIB_GLOB = $(WAYLAND_EGL_LIB_NAME)*
 
 DRI_CFLAGS = $(CFLAGS)
 DRI_CXXFLAGS = $(CXXFLAGS)
@@ -134,7 +131,6 @@ GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
 GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
 VG_LIB_DEPS= $(EXTRA_LIB_PATH) -lpthread
 GLAPI_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
-WAYLAND_EGL_LIB_DEPS = $(EXTRA_LIB_PATH) -lwayland-client -ldrm
 
 # Program dependencies - specific GL libraries added in Makefiles
 X11_LIBS = -lX11
@@ -179,6 +175,3 @@ GLESv2_PC_CFLAGS =
 VG_PC_REQ_PRIV =
 VG_PC_LIB_PRIV =
 VG_PC_CFLAGS =
-WAYLAND_EGL_PC_REQ_PRIV =
-WAYLAND_EGL_PC_LIB_PRIV =
-WAYLAND_EGL_PC_CFLAGS =
diff --git a/configure.ac b/configure.ac
index 18a40fc..07d359b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -413,7 +413,6 @@ GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
 GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
 VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
 GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
-WAYLAND_EGL_LIB_NAME='lib$(WAYLAND_EGL_LIB).'${LIB_EXTENSION}
 
 

[Mesa-dev] [PATCH] st/mesa: Fix recurring surfaceless contexts

2012-01-24 Thread Benjamin Franzke
A current incomplete framebuffer was incorrectly used as a
st_framebuffer. When accessing st_framebuffer childs bad things happen:
e.g. st_framebuffer::iface was used to check whether its an incomplete
fb, instead we need to compare st_framebuffer::Base against
mesa_get_incomplete_framebuffer.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44919
Note: This is a candidate for the 8.0 branch.
---
 src/mesa/state_tracker/st_manager.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index 63920a3..7efc173 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -688,7 +688,9 @@ st_framebuffer_reuse_or_create(struct gl_framebuffer *fb,
 {
struct st_framebuffer *cur = st_ws_framebuffer(fb), *stfb = NULL;
 
-   if (cur  cur-iface == stfbi) {
+   /* dummy framebuffers cant be used as st_framebuffer */
+   if (cur  cur-Base != _mesa_get_incomplete_framebuffer() 
+   cur-iface == stfbi) {
   /* reuse the current stfb */
   st_framebuffer_reference(stfb, cur);
}
@@ -779,7 +781,7 @@ st_manager_flush_frontbuffer(struct st_context *st)
   return;
 
/* never a dummy fb */
-   assert(stfb-iface);
+   assert(stfb-Base != _mesa_get_incomplete_framebuffer());
stfb-iface-flush_front(stfb-iface, ST_ATTACHMENT_FRONT_LEFT);
 }
 
-- 
1.7.3.4

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


Re: [Mesa-dev] swrast tfp cleanup

2011-11-02 Thread Benjamin Franzke
2011/11/2 George Sapountzis gsapount...@gmail.com:
 Hi,

 [please cc: me in any replies]

 I rebased (with minor cleanups) the patches submitted by Benjamin
 Franzke and put them at:

Thanks for reminding. I wanted to wait for feedback, but there was no
answer (same as for my comments on the original patches on the list),
and forgot to push the patches then.

It would have been fair, when you'd have used git-am for applying the
patches to keep me as author. So if you are ok, I'm going to push my
original patches.

 http://cgit.freedesktop.org/~gsap7/mesa/log/?h=tfp

 The commits contain links to relevant emails. I tested the patches on
 xephyr, please review and test that it still works for you. I will
 push to master at the the end of the week if nobody objects.

 regards,
 George.

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


Re: [Mesa-dev] implicit declaration of function wl_drm_create

2011-10-18 Thread Benjamin Franzke
2011/10/18 chris wwzbw...@163.com:
 Dear

 Could anyone tell me where is the wl_drm_create function defined? I can't
 find it anywhere, no definition can be found. No google information can be
 searched! Why?

Seems like you're compiling mesa 7.11 again wayland master, but they
are incompatible.
The wl_drm_create function is no longer generated from the protocol file,
wl_display_bind has to be used with current wayland, and there are
other incompatibilities.

You should use mesa from git instead.
(You could also try whether mesa 7.11 builds/runs fine against the
wayland 0.8 branch.
But I'm not sure if thats working, and if its still legacy stuff your
using then..
I'd really suggest to use mesa master instead.)



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


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


Re: [Mesa-dev] [PATCH 4/5] st/egl: correctly return configs under wayland

2011-09-08 Thread Benjamin Franzke
 
 *display,
  }

  static boolean
 +wayland_shm_display_add_configs(struct wayland_shm_display *shmdpy)
 +{
 +   struct wayland_config *configs;
 +   enum pipe_format formats[2];
 +   int i, num_formats = 0;
 +
 +   /* assume all formats are supported */
 +   formats[num_formats++] = PIPE_FORMAT_B8G8R8A8_UNORM;
 +   formats[num_formats++] = PIPE_FORMAT_B8G8R8X8_UNORM;
 +
 +   configs = CALLOC(num_formats, sizeof(*configs));
 +   if (!configs)
 +      return FALSE;
 +
 +   for (i = 0; i  num_formats; i++) {
 +      struct native_config *nconf = configs[i].base;
 +
 +      nconf-buffer_mask =
 +         (1  NATIVE_ATTACHMENT_FRONT_LEFT) |
 +         (1  NATIVE_ATTACHMENT_BACK_LEFT);
 +
 +      nconf-color_format = formats[i];
 +
 +      nconf-window_bit = TRUE;
 +      nconf-pixmap_bit = TRUE;
 +   }
 +
 +   shmdpy-base.configs = configs;
 +   shmdpy-base.num_configs = num_formats;
 +
 +   return TRUE;
 +}
 +
 +static boolean
  wayland_shm_display_init_screen(struct native_display *ndpy)
  {
    struct wayland_shm_display *shmdpy = wayland_shm_display(ndpy);
 @@ -128,6 +162,9 @@ wayland_shm_display_init_screen(struct native_display 
 *ndpy)
    if (!shmdpy-wl_shm)
       return FALSE;

 +   if (!wayland_shm_display_add_configs(shmdpy))
 +      return FALSE;
 +
    winsys = wayland_create_sw_winsys(shmdpy-base.dpy);
    if (!winsys)
       return FALSE;
 diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.c 
 b/src/gallium/state_trackers/egl/wayland/native_wayland.c
 index 29c9b46..14cc908 100644
 --- a/src/gallium/state_trackers/egl/wayland/native_wayland.c
 +++ b/src/gallium/state_trackers/egl/wayland/native_wayland.c
 @@ -44,31 +44,11 @@ wayland_display_get_configs (struct native_display *ndpy, 
 int *num_configs)
    const struct native_config **configs;
    int i;

 -   if (!display-config) {
 -      struct native_config *nconf;
 -      display-config = CALLOC(2, sizeof(*display-config));
 -      if (!display-config)
 -         return NULL;
 -
 -      for (i = 0; i  2; ++i) {
 -         nconf = display-config[i].base;
 -
 -         nconf-buffer_mask =
 -            (1  NATIVE_ATTACHMENT_FRONT_LEFT) |
 -            (1  NATIVE_ATTACHMENT_BACK_LEFT);
 -
 -         nconf-window_bit = TRUE;
 -         nconf-pixmap_bit = TRUE;
 -      }
 -
 -      display-config[0].base.color_format = PIPE_FORMAT_B8G8R8A8_UNORM;
 -      display-config[1].base.color_format = PIPE_FORMAT_B8G8R8X8_UNORM;
 -   }
 -
 -   configs = MALLOC(2 * sizeof(*configs));
 +   configs = MALLOC(display-num_configs * sizeof(*configs));
    if (configs) {
 -      configs[0] = display-config[0].base;
 -      configs[1] = display-config[1].base;
 +      for (i = 0; i  display-num_configs; i++) {
 +         configs[i] = display-configs[i].base;
 +      }
       if (num_configs)
          *num_configs = 2;
    }
 diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.h 
 b/src/gallium/state_trackers/egl/wayland/native_wayland.h
 index 5390f2f..93e670b 100644
 --- a/src/gallium/state_trackers/egl/wayland/native_wayland.h
 +++ b/src/gallium/state_trackers/egl/wayland/native_wayland.h
 @@ -39,10 +39,12 @@ struct wayland_surface;
  struct wayland_display {
    struct native_display base;

 -   struct wayland_config *config;
    struct wl_display *dpy;
    boolean own_dpy;

 +   struct wayland_config *configs;
 +   int num_configs;
 +
    struct wl_buffer *(*create_buffer)(struct wayland_display *display,
                                       struct wayland_surface *surface,
                                       enum native_attachment attachment);
 --
 1.7.5.4


From b903cf0b74038e932404214afb658cb6e20b0238 Mon Sep 17 00:00:00 2001
From: Benjamin Franzke benjaminfran...@googlemail.com
Date: Thu, 8 Sep 2011 08:03:34 +0200
Subject: [PATCH 1/2] st/egl: correctly return configs under wayland

Handle format events and return configs for the supported formats.

(Based on Chia-I Wu's patch)
---
 .../state_trackers/egl/wayland/native_drm.c|   25 ++--
 .../state_trackers/egl/wayland/native_shm.c|   37 --
 .../state_trackers/egl/wayland/native_wayland.c|   41 +---
 .../state_trackers/egl/wayland/native_wayland.h|   12 +-
 4 files changed, 92 insertions(+), 23 deletions(-)

diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c b/src/gallium/state_trackers/egl/wayland/native_drm.c
index 05c32f4..9f6757b 100644
--- a/src/gallium/state_trackers/egl/wayland/native_drm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
@@ -77,8 +77,8 @@ wayland_drm_display_destroy(struct native_display *ndpy)
   wl_drm_destroy(drmdpy-wl_drm);
if (drmdpy-device_name)
   FREE(drmdpy-device_name);
-   if (drmdpy-base.config)
-  FREE(drmdpy-base.config);
+   if (drmdpy-base.configs)
+  FREE(drmdpy-base.configs);
if (drmdpy-base.own_dpy)
   wl_display_destroy(drmdpy-base.dpy);
 
@@ -97,7 +97,7 @@ wayland_create_drm_buffer(struct wayland_display *display

Re: [Mesa-dev] [PATCH 5/5] st/egl: add premultiplied alpha support to wayland

2011-09-08 Thread Benjamin Franzke
2011/9/8 Chia-I Wu olva...@gmail.com:
 From: Chia-I Wu o...@lunarg.com

 Return true for NATIVE_PARAM_PREMULTIPLIED_ALPHA when all formats with
 alpha support premultiplied alpha.  Currently, it means when argb32 and
 argb32_pre are both supported.
 ---
  .../state_trackers/egl/wayland/native_drm.c        |    8 ++--
  .../state_trackers/egl/wayland/native_shm.c        |    6 +-
  .../state_trackers/egl/wayland/native_wayland.c    |   18 ++
  .../state_trackers/egl/wayland/native_wayland.h    |    3 +++
  4 files changed, 32 insertions(+), 3 deletions(-)

 diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c 
 b/src/gallium/state_trackers/egl/wayland/native_drm.c
 index facab32..e177e7c 100644
 --- a/src/gallium/state_trackers/egl/wayland/native_drm.c
 +++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
 @@ -114,8 +114,8 @@ wayland_create_drm_buffer(struct wayland_display *display,

    switch (surface-color_format) {
    case PIPE_FORMAT_B8G8R8A8_UNORM:
 -      /* assume premultiplied */
 -      format = WL_DRM_FORMAT_PREMULTIPLIED_ARGB32;
 +      format = (surface-premultiplied_alpha) ?
 +         WL_DRM_FORMAT_PREMULTIPLIED_ARGB32 : WL_DRM_FORMAT_ARGB32;
       break;
    case PIPE_FORMAT_B8G8R8X8_UNORM:
       format = WL_DRM_FORMAT_XRGB32;
 @@ -255,6 +255,10 @@ wayland_drm_display_init_screen(struct native_display 
 *ndpy)
    if (!wayland_drm_display_add_configs(drmdpy))
       return FALSE;

 +   /* check that premultiplied alpha is supported for all formats with alpha 
 */
 +   if (!drmdpy-argb32 || drmdpy-argb32_pre)
 +      drmdpy-base.param_premultiplied_alpha = TRUE;

Why enable premultiplied alpha if argb32 is not exposed?
What isnt covered with just: if (drmdpy-argb32_pre)?.

 +
    drmdpy-base.base.screen =
       drmdpy-event_handler-new_drm_screen(drmdpy-base.base,
                                             NULL, drmdpy-fd);
 diff --git a/src/gallium/state_trackers/egl/wayland/native_shm.c 
 b/src/gallium/state_trackers/egl/wayland/native_shm.c
 index 5882e74..e2d2437 100644
 --- a/src/gallium/state_trackers/egl/wayland/native_shm.c
 +++ b/src/gallium/state_trackers/egl/wayland/native_shm.c
 @@ -95,7 +95,8 @@ wayland_create_shm_buffer(struct wayland_display *display,

    switch (surface-color_format) {
    case PIPE_FORMAT_B8G8R8A8_UNORM:
 -      format = WL_SHM_FORMAT_PREMULTIPLIED_ARGB32;
 +      format = (surface-premultiplied_alpha) ?
 +         WL_SHM_FORMAT_PREMULTIPLIED_ARGB32 : WL_SHM_FORMAT_ARGB32;
       break;
    case PIPE_FORMAT_B8G8R8X8_UNORM:
       format = WL_SHM_FORMAT_XRGB32;
 @@ -165,6 +166,9 @@ wayland_shm_display_init_screen(struct native_display 
 *ndpy)
    if (!wayland_shm_display_add_configs(shmdpy))
       return FALSE;

 +   /* assume all formats are supported */
 +   shmdpy-base.param_premultiplied_alpha = TRUE;
 +
    winsys = wayland_create_sw_winsys(shmdpy-base.dpy);
    if (!winsys)
       return FALSE;
 diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.c 
 b/src/gallium/state_trackers/egl/wayland/native_wayland.c
 index 14cc908..b2dab8f 100644
 --- a/src/gallium/state_trackers/egl/wayland/native_wayland.c
 +++ b/src/gallium/state_trackers/egl/wayland/native_wayland.c
 @@ -60,9 +60,13 @@ static int
  wayland_display_get_param(struct native_display *ndpy,
                           enum native_param_type param)
  {
 +   struct wayland_display *display = wayland_display(ndpy);
    int val;

    switch (param) {
 +   case NATIVE_PARAM_PREMULTIPLIED_ALPHA:
 +      val = display-param_premultiplied_alpha;
 +      break;
    case NATIVE_PARAM_USE_NATIVE_BUFFER:
    case NATIVE_PARAM_PRESERVE_BUFFER:
    case NATIVE_PARAM_MAX_SWAP_INTERVAL:
 @@ -283,6 +287,20 @@ wayland_surface_present(struct native_surface *nsurf,
    if (ctrl-preserve || ctrl-swap_interval)
       return FALSE;

 +   /* force buffers to be re-created if they will be presented differently */
 +   if (surface-premultiplied_alpha != ctrl-premultiplied_alpha) {
 +      enum wayland_buffer_type buffer;
 +
 +      for (buffer = 0; buffer  WL_BUFFER_COUNT; ++buffer) {
 +         if (surface-buffer[buffer]) {
 +            wl_buffer_destroy(surface-buffer[buffer]);
 +            surface-buffer[buffer] = NULL;
 +         }
 +      }
 +
 +      surface-premultiplied_alpha = ctrl-premultiplied_alpha;
 +   }
 +
    switch (ctrl-natt) {
    case NATIVE_ATTACHMENT_FRONT_LEFT:
       ret = TRUE;
 diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.h 
 b/src/gallium/state_trackers/egl/wayland/native_wayland.h
 index 93e670b..6cf98a8 100644
 --- a/src/gallium/state_trackers/egl/wayland/native_wayland.h
 +++ b/src/gallium/state_trackers/egl/wayland/native_wayland.h
 @@ -44,6 +44,8 @@ struct wayland_display {

    struct wayland_config *configs;
    int num_configs;
 +   /* true if all formats with alpha support premultiplied alpha */
 +   boolean param_premultiplied_alpha;

    struct wl_buffer *(*create_buffer)(struct wayland_display 

Re: [Mesa-dev] [PATCH 4/5] st/egl: correctly return configs under wayland

2011-09-08 Thread Benjamin Franzke
2011/9/8 Chia-I Wu olva...@gmail.com:
 On Thu, Sep 8, 2011 at 3:11 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 First thanks for taking this on.

 There are some things I'd like to have addtionally/differently:

 Supported shm formats are exposed via a format event as well
 (like the supported drm formats), so the config creation logic is the
 same for drm and shm, and I think it can remain in native_wayland.c

 We need roundtrips to check that we get at least one supported format.

 I've attached two patches (heavily based on your last two) that do this,
 are you ok with using them?
 That is great.  Sure.

 I've noted two minor issues or typos, fixed by the attached patch.
 One is that param_premultiplied_alpha can be set in the common code
 and only when the display has both HAS_ARGB32 and HAS_PREMUL_ARGB32.
 The other is that we should not claim PIPE_FORMAT_B8G8R8A8_UNORM
 without HAS_ARGB32.  If it looks good to you, I will commit an updated
 version of your patches.

Ok I see the point, though i can imagine compositors may want
to expose only premultilplied argb, which egl users couldnt use then,
but your right, we shouldnt expose alpha at all if one isnt available.
So I'm fine with you commiting that change.


 2011/9/8 Chia-I Wu olva...@gmail.com:
 From: Chia-I Wu o...@lunarg.com

 When wl_drm is avaiable and enabled, handle format events and return
 configs for the supported formats.  Otherwise, assume all formats of
 wl_shm are supported.
 ---
  .../state_trackers/egl/wayland/native_drm.c        |   70 
 +++-
  .../state_trackers/egl/wayland/native_shm.c        |   41 +++-
  .../state_trackers/egl/wayland/native_wayland.c    |   28 +---
  .../state_trackers/egl/wayland/native_wayland.h    |    4 +-
  4 files changed, 113 insertions(+), 30 deletions(-)

 diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c 
 b/src/gallium/state_trackers/egl/wayland/native_drm.c
 index 05c32f4..facab32 100644
 --- a/src/gallium/state_trackers/egl/wayland/native_drm.c
 +++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
 @@ -58,6 +58,11 @@ struct wayland_drm_display {
    int fd;
    char *device_name;
    boolean authenticated;
 +
 +   /* supported formats */
 +   boolean argb32;
 +   boolean argb32_pre;
 +   boolean xrgb32;
  };

  static INLINE struct wayland_drm_display *
 @@ -77,8 +82,8 @@ wayland_drm_display_destroy(struct native_display *ndpy)
       wl_drm_destroy(drmdpy-wl_drm);
    if (drmdpy-device_name)
       FREE(drmdpy-device_name);
 -   if (drmdpy-base.config)
 -      FREE(drmdpy-base.config);
 +   if (drmdpy-base.configs)
 +      FREE(drmdpy-base.configs);
    if (drmdpy-base.own_dpy)
       wl_display_destroy(drmdpy-base.dpy);

 @@ -124,6 +129,50 @@ wayland_create_drm_buffer(struct wayland_display 
 *display,
                                width, height, wsh.stride, format);
  }

 +static boolean
 +wayland_drm_display_add_configs(struct wayland_drm_display *drmdpy)
 +{
 +   struct wayland_config *configs;
 +   enum pipe_format formats[2];
 +   int i, num_formats = 0;
 +
 +   /*
 +    * Only argb32 counts here.  If we make (!argbb32  argb32_pre) count, 
 we
 +    * will not be able to support the case where
 +    * native_present_control::premultiplied_alpha is FALSE.
 +    */
 +   if (drmdpy-argb32)
 +      formats[num_formats++] = PIPE_FORMAT_B8G8R8A8_UNORM;
 +
 +   if (drmdpy-xrgb32)
 +      formats[num_formats++] = PIPE_FORMAT_B8G8R8X8_UNORM;
 +
 +   if (!num_formats)
 +      return FALSE;
 +
 +   configs = CALLOC(num_formats, sizeof(*configs));
 +   if (!configs)
 +      return FALSE;
 +
 +   for (i = 0; i  num_formats; i++) {
 +      struct native_config *nconf = configs[i].base;
 +
 +      nconf-buffer_mask =
 +         (1  NATIVE_ATTACHMENT_FRONT_LEFT) |
 +         (1  NATIVE_ATTACHMENT_BACK_LEFT);
 +
 +      nconf-color_format = formats[i];
 +
 +      nconf-window_bit = TRUE;
 +      nconf-pixmap_bit = TRUE;
 +   }
 +
 +   drmdpy-base.configs = configs;
 +   drmdpy-base.num_configs = num_formats;
 +
 +   return TRUE;
 +}
 +
  static void
  drm_handle_device(void *data, struct wl_drm *drm, const char *device)
  {
 @@ -148,7 +197,19 @@ drm_handle_device(void *data, struct wl_drm *drm, 
 const char *device)
  static void
  drm_handle_format(void *data, struct wl_drm *drm, uint32_t format)
  {
 -   /* TODO */
 +   struct wayland_drm_display *drmdpy = data;
 +
 +   switch (format) {
 +   case WL_DRM_FORMAT_ARGB32:
 +      drmdpy-argb32 = TRUE;
 +      break;
 +   case WL_DRM_FORMAT_PREMULTIPLIED_ARGB32:
 +      drmdpy-argb32_pre = TRUE;
 +      break;
 +   case WL_DRM_FORMAT_XRGB32:
 +      drmdpy-xrgb32 = TRUE;
 +      break;
 +   }
  }

  static void
 @@ -191,6 +252,9 @@ wayland_drm_display_init_screen(struct native_display 
 *ndpy)
    if (!drmdpy-authenticated)
       return FALSE;

 +   if (!wayland_drm_display_add_configs(drmdpy))
 +      return FALSE;
 +
    drmdpy-base.base.screen =
       drmdpy-event_handler-new_drm_screen

Re: [Mesa-dev] [PATCH 5/5] st/egl: add premultiplied alpha support to wayland

2011-09-08 Thread Benjamin Franzke
2011/9/8 Chia-I Wu olva...@gmail.com:
 On Thu, Sep 8, 2011 at 3:13 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 2011/9/8 Chia-I Wu olva...@gmail.com:
 From: Chia-I Wu o...@lunarg.com

 Return true for NATIVE_PARAM_PREMULTIPLIED_ALPHA when all formats with
 alpha support premultiplied alpha.  Currently, it means when argb32 and
 argb32_pre are both supported.
 ---
  .../state_trackers/egl/wayland/native_drm.c        |    8 ++--
  .../state_trackers/egl/wayland/native_shm.c        |    6 +-
  .../state_trackers/egl/wayland/native_wayland.c    |   18 
 ++
  .../state_trackers/egl/wayland/native_wayland.h    |    3 +++
  4 files changed, 32 insertions(+), 3 deletions(-)

 diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c 
 b/src/gallium/state_trackers/egl/wayland/native_drm.c
 index facab32..e177e7c 100644
 --- a/src/gallium/state_trackers/egl/wayland/native_drm.c
 +++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
 @@ -114,8 +114,8 @@ wayland_create_drm_buffer(struct wayland_display 
 *display,

    switch (surface-color_format) {
    case PIPE_FORMAT_B8G8R8A8_UNORM:
 -      /* assume premultiplied */
 -      format = WL_DRM_FORMAT_PREMULTIPLIED_ARGB32;
 +      format = (surface-premultiplied_alpha) ?
 +         WL_DRM_FORMAT_PREMULTIPLIED_ARGB32 : WL_DRM_FORMAT_ARGB32;
       break;
    case PIPE_FORMAT_B8G8R8X8_UNORM:
       format = WL_DRM_FORMAT_XRGB32;
 @@ -255,6 +255,10 @@ wayland_drm_display_init_screen(struct native_display 
 *ndpy)
    if (!wayland_drm_display_add_configs(drmdpy))
       return FALSE;

 +   /* check that premultiplied alpha is supported for all formats with 
 alpha */
 +   if (!drmdpy-argb32 || drmdpy-argb32_pre)
 +      drmdpy-base.param_premultiplied_alpha = TRUE;

 Why enable premultiplied alpha if argb32 is not exposed?
 What isnt covered with just: if (drmdpy-argb32_pre)?.
 Yes, it is simpler.  What I intended to do is to enable pre-multiplied
 alpha when all formats that have alpha also support pre-multiplied
 alpha.  In the case there is no format that has alpha
 (!drmdpy-argb32), pre-multiplied alpha can be enabled.

Ok, I see, my idea was to enable only whats actually useful for a configuration,
but I dont know whats the general egl rule here. So I'm ok with both.

 +
    drmdpy-base.base.screen =
       drmdpy-event_handler-new_drm_screen(drmdpy-base.base,
                                             NULL, drmdpy-fd);
 diff --git a/src/gallium/state_trackers/egl/wayland/native_shm.c 
 b/src/gallium/state_trackers/egl/wayland/native_shm.c
 index 5882e74..e2d2437 100644
 --- a/src/gallium/state_trackers/egl/wayland/native_shm.c
 +++ b/src/gallium/state_trackers/egl/wayland/native_shm.c
 @@ -95,7 +95,8 @@ wayland_create_shm_buffer(struct wayland_display *display,

    switch (surface-color_format) {
    case PIPE_FORMAT_B8G8R8A8_UNORM:
 -      format = WL_SHM_FORMAT_PREMULTIPLIED_ARGB32;
 +      format = (surface-premultiplied_alpha) ?
 +         WL_SHM_FORMAT_PREMULTIPLIED_ARGB32 : WL_SHM_FORMAT_ARGB32;
       break;
    case PIPE_FORMAT_B8G8R8X8_UNORM:
       format = WL_SHM_FORMAT_XRGB32;
 @@ -165,6 +166,9 @@ wayland_shm_display_init_screen(struct native_display 
 *ndpy)
    if (!wayland_shm_display_add_configs(shmdpy))
       return FALSE;

 +   /* assume all formats are supported */
 +   shmdpy-base.param_premultiplied_alpha = TRUE;
 +
    winsys = wayland_create_sw_winsys(shmdpy-base.dpy);
    if (!winsys)
       return FALSE;
 diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.c 
 b/src/gallium/state_trackers/egl/wayland/native_wayland.c
 index 14cc908..b2dab8f 100644
 --- a/src/gallium/state_trackers/egl/wayland/native_wayland.c
 +++ b/src/gallium/state_trackers/egl/wayland/native_wayland.c
 @@ -60,9 +60,13 @@ static int
  wayland_display_get_param(struct native_display *ndpy,
                           enum native_param_type param)
  {
 +   struct wayland_display *display = wayland_display(ndpy);
    int val;

    switch (param) {
 +   case NATIVE_PARAM_PREMULTIPLIED_ALPHA:
 +      val = display-param_premultiplied_alpha;
 +      break;
    case NATIVE_PARAM_USE_NATIVE_BUFFER:
    case NATIVE_PARAM_PRESERVE_BUFFER:
    case NATIVE_PARAM_MAX_SWAP_INTERVAL:
 @@ -283,6 +287,20 @@ wayland_surface_present(struct native_surface *nsurf,
    if (ctrl-preserve || ctrl-swap_interval)
       return FALSE;

 +   /* force buffers to be re-created if they will be presented differently 
 */
 +   if (surface-premultiplied_alpha != ctrl-premultiplied_alpha) {
 +      enum wayland_buffer_type buffer;
 +
 +      for (buffer = 0; buffer  WL_BUFFER_COUNT; ++buffer) {
 +         if (surface-buffer[buffer]) {
 +            wl_buffer_destroy(surface-buffer[buffer]);
 +            surface-buffer[buffer] = NULL;
 +         }
 +      }
 +
 +      surface-premultiplied_alpha = ctrl-premultiplied_alpha;
 +   }
 +
    switch (ctrl-natt) {
    case NATIVE_ATTACHMENT_FRONT_LEFT:
       ret = TRUE;
 diff --git a/src

Re: [Mesa-dev] [PATCH] st/egl: Prepare for EGL_ALPHA_FORMAT

2011-09-02 Thread Benjamin Franzke
2011/9/2 Chia-I Wu o...@lunarg.com:
 On Thu, Sep 1, 2011 at 5:53 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 In preparation for wayland ALPHA_FORMAT usage,
 see commit 7b1d94e5d1f53ac5f59000176aea1d02fc9a1181.

 Changes:
  - New native_config surface_type bit: alpha_format_pre_bit
  - Introduction of native_surface_attribs
   (as new parameter in create_{window,pixmap}_surface)
  - New attrib alpha_format in native_surface_attribs
 EGL_VG_ALPHA_FORMAT_PRE is supposed to only change the behavior of
 st/vega.  It is suggested that the window system should not rely on
 it.  I wonder if there are other (clean) ways do achieve the same
 goal..

Yes, this is kind of a strange thing in the eglspec, to have an
attribute that shouldnt be relied on/used..?

As EGL wants EGL_VG_ALPHA_FORMAT only for OpenVG, we probably need an
extension or so.
Kristian can give better information what he plans here.

 That said, I am thinking modeling it with

  - Add struct native_surface_present and have
   native_surface::present() takes the surface and the struct as its
   arguments.  This is just a clean up step.
  - Add NATIVE_PARAM_USE_VG_ALPHA_FORMAT_PRE to the display parameter.
   When it is true, set EGL_VG_ALPHA_FORMAT_PRE_BIT for all configs.

Sounds good in genral, but I wanted to expose EGL_VG_ALPHA_FORMAT_PRE_BIT
only for configs which have an alpha format,
this comes into account when talking about the following point:

   As st/vega does not support pre-multiplied alpha, EGL_OPENVG_BIT
   should be cleared meanwhile.

...Thats abit of a problem, with that we couldnt use openvg with wayland,
since all configs have EGL_OPENVG_BIT cleared (because of the previous point).
  - Add a boolean to native_surface_present to indicate the
   presented buffer should be treated as with pre-multiplied alpha or
   not.

I'm not sure about that, dont we need to know about that attribute at
surface creation time,
to respect it when choosing a format that reflects that?
My main problem here is that I dont know how to choose between
premultiplied and non-premultiplied in gallium (thought this would be
a new format?).

 I've also attached a diff to native.h.

 The changes are based on the assumptions that

  - The display server allows EGL to control how a presented buffer
   is composited: assuming premultiplied alpha or not.

This is currently broken in wayland (due to the latest changes), but the idea is
that the compositor knows whether a wl_buffer has premulitplied alpha or not.
  - The display server expects EGL to expose the functionality through
   EGL_VG_ALPHA_FORMAT.

The display server in general doesnt care how things are done client side,
but in wayland+egl we currently try to expose buffer formats using EGLConfigs
with the use of vendor specific wayland interfaces (wl_drm in the mesa case),
that are implemented in egl (both client- and serverside).
So yes.

 Are the assumptions true under wayland?  Thoughts?

 CC: Chia-I Wu o...@lunarg.com
 ---
  .../state_trackers/egl/android/native_android.cpp  |    3 ++-
  src/gallium/state_trackers/egl/common/egl_g3d.c    |    3 +++
  .../state_trackers/egl/common/egl_g3d_api.c        |   13 +++--
  .../state_trackers/egl/common/egl_g3d_image.c      |    2 +-
  src/gallium/state_trackers/egl/common/native.h     |   11 +--
  .../state_trackers/egl/common/native_helper.c      |    2 +-
  src/gallium/state_trackers/egl/drm/native_drm.c    |    3 ++-
  src/gallium/state_trackers/egl/gdi/native_gdi.c    |    3 ++-
  .../state_trackers/egl/wayland/native_wayland.c    |    6 --
  src/gallium/state_trackers/egl/x11/native_dri2.c   |    6 --
  src/gallium/state_trackers/egl/x11/native_ximage.c |    6 --
  11 files changed, 43 insertions(+), 15 deletions(-)

 diff --git a/src/gallium/state_trackers/egl/android/native_android.cpp 
 b/src/gallium/state_trackers/egl/android/native_android.cpp
 index 338427d..e4a74b3 100644
 --- a/src/gallium/state_trackers/egl/android/native_android.cpp
 +++ b/src/gallium/state_trackers/egl/android/native_android.cpp
 @@ -494,7 +494,8 @@ android_surface_destroy(struct native_surface *nsurf)
  static struct native_surface *
  android_display_create_window_surface(struct native_display *ndpy,
                                       EGLNativeWindowType win,
 -                                      const struct native_config *nconf)
 +                                      const struct native_config *nconf,
 +                                      const struct native_surface_attribs 
 *attr)
  {
    struct android_display *adpy = android_display(ndpy);
    struct android_config *aconf = android_config(nconf);
 diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c 
 b/src/gallium/state_trackers/egl/common/egl_g3d.c
 index b5e3d99..233867b 100644
 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c
 +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
 @@ -262,6 +262,9 @@ init_config_attributes(_EGLConfig *conf, const

[Mesa-dev] [PATCH] st/egl: Prepare for EGL_ALPHA_FORMAT

2011-09-01 Thread Benjamin Franzke
In preparation for wayland ALPHA_FORMAT usage,
see commit 7b1d94e5d1f53ac5f59000176aea1d02fc9a1181.

Changes:
 - New native_config surface_type bit: alpha_format_pre_bit
 - Introduction of native_surface_attribs
   (as new parameter in create_{window,pixmap}_surface)
 - New attrib alpha_format in native_surface_attribs

CC: Chia-I Wu o...@lunarg.com
---
 .../state_trackers/egl/android/native_android.cpp  |3 ++-
 src/gallium/state_trackers/egl/common/egl_g3d.c|3 +++
 .../state_trackers/egl/common/egl_g3d_api.c|   13 +++--
 .../state_trackers/egl/common/egl_g3d_image.c  |2 +-
 src/gallium/state_trackers/egl/common/native.h |   11 +--
 .../state_trackers/egl/common/native_helper.c  |2 +-
 src/gallium/state_trackers/egl/drm/native_drm.c|3 ++-
 src/gallium/state_trackers/egl/gdi/native_gdi.c|3 ++-
 .../state_trackers/egl/wayland/native_wayland.c|6 --
 src/gallium/state_trackers/egl/x11/native_dri2.c   |6 --
 src/gallium/state_trackers/egl/x11/native_ximage.c |6 --
 11 files changed, 43 insertions(+), 15 deletions(-)

diff --git a/src/gallium/state_trackers/egl/android/native_android.cpp 
b/src/gallium/state_trackers/egl/android/native_android.cpp
index 338427d..e4a74b3 100644
--- a/src/gallium/state_trackers/egl/android/native_android.cpp
+++ b/src/gallium/state_trackers/egl/android/native_android.cpp
@@ -494,7 +494,8 @@ android_surface_destroy(struct native_surface *nsurf)
 static struct native_surface *
 android_display_create_window_surface(struct native_display *ndpy,
   EGLNativeWindowType win,
-  const struct native_config *nconf)
+  const struct native_config *nconf,
+  const struct native_surface_attribs 
*attr)
 {
struct android_display *adpy = android_display(ndpy);
struct android_config *aconf = android_config(nconf);
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c 
b/src/gallium/state_trackers/egl/common/egl_g3d.c
index b5e3d99..233867b 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -262,6 +262,9 @@ init_config_attributes(_EGLConfig *conf, const struct 
native_config *nconf,
   surface_type |= EGL_PBUFFER_BIT;
}
 
+   if (nconf-alpha_format_pre_bit)
+  surface_type |= EGL_VG_ALPHA_FORMAT_PRE_BIT;
+
conf-Conformant = api_mask;
conf-RenderableType = api_mask;
 
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c 
b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index f897054..1b81e78 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -217,6 +217,13 @@ struct egl_g3d_create_surface_arg {
} u;
 };
 
+static void
+egl_g3d_fill_surface_attribs(struct egl_g3d_surface *gsurf,
+ struct native_surface_attribs *attr)
+{
+   attr-alpha_format = gsurf-base.VGAlphaFormat;
+}
+
 static _EGLSurface *
 egl_g3d_create_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
struct egl_g3d_create_surface_arg *arg,
@@ -226,6 +233,7 @@ egl_g3d_create_surface(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLConfig *conf,
struct egl_g3d_config *gconf = egl_g3d_config(conf);
struct egl_g3d_surface *gsurf;
struct native_surface *nsurf;
+   struct native_surface_attribs nsurf_attr;
const char *err;
 
switch (arg-type) {
@@ -255,16 +263,17 @@ egl_g3d_create_surface(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLConfig *conf,
   FREE(gsurf);
   return NULL;
}
+   egl_g3d_fill_surface_attribs(gsurf, nsurf_attr);
 
/* create the native surface */
switch (arg-type) {
case EGL_WINDOW_BIT:
   nsurf = gdpy-native-create_window_surface(gdpy-native,
-arg-u.win, gconf-native);
+arg-u.win, gconf-native, nsurf_attr);
   break;
case EGL_PIXMAP_BIT:
   nsurf = gdpy-native-create_pixmap_surface(gdpy-native,
-arg-u.pix, gconf-native);
+arg-u.pix, gconf-native, nsurf_attr);
   break;
 #ifdef EGL_MESA_screen_surface
case EGL_SCREEN_BIT_MESA:
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.c 
b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
index 4d90c40..6d3315a 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
@@ -48,7 +48,7 @@ egl_g3d_reference_native_pixmap(_EGLDisplay *dpy, 
EGLNativePixmapType pix)
struct pipe_resource *textures[NUM_NATIVE_ATTACHMENTS];
enum native_attachment natt;
 
-   nsurf = gdpy-native-create_pixmap_surface(gdpy-native, pix, NULL);
+   nsurf = gdpy-native-create_pixmap_surface(gdpy-native, pix, NULL, NULL);
if (!nsurf)
   return NULL;
 
diff --git a/src/gallium/state_trackers/egl/common/native.h 

Re: [Mesa-dev] [PATCH 3/3] state_trackers/dri/sw: Implement texture_from_pixmap.

2011-08-31 Thread Benjamin Franzke
It looks like this should be converted to a new dri_drawable hook
(like allocate_textures),
so the the drisw specific bits would be in sw/drisw.c (the hook in
drm/dri2.c would just be a noop).
This is the way the other stuff in st/dri is implemented and
dri_drawable.c wouldnt need to be cloned.

2011/8/30 Stéphane Marchesin marc...@chromium.org:
 Signed-off-by: Stuart Abercrombie sabercrom...@chromium.org
 Signed-off-by: Stéphane Marchesin marc...@chromium.org
 ---
  src/gallium/state_trackers/dri/sw/dri_drawable.c |   50 
 +++---
  1 files changed, 43 insertions(+), 7 deletions(-)

 diff --git a/src/gallium/state_trackers/dri/sw/dri_drawable.c 
 b/src/gallium/state_trackers/dri/sw/dri_drawable.c
 index 7b8de31..05c64b6 100644
 --- a/src/gallium/state_trackers/dri/sw/dri_drawable.c
 +++ b/src/gallium/state_trackers/dri/sw/dri_drawable.c
 @@ -37,7 +37,8 @@
  #include util/u_format.h
  #include util/u_memory.h
  #include util/u_inlines.h
 -
 +
 +#include state_tracker/st_context.h

  static boolean
  dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
 @@ -195,14 +196,23 @@ dri_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
  {
    struct dri_context *ctx = dri_context(pDRICtx);
    struct dri_drawable *drawable = dri_drawable(dPriv);
 -   struct pipe_resource *pt;
 -
 +   struct pipe_resource *res;
 +   struct st_context *stctx = (struct st_context *)ctx-st;
 +   struct pipe_context *pipe = stctx-pipe;
 +   struct pipe_transfer *tex_xfer;
 +   char *map;
 +   __DRIscreen *sPriv = dPriv-driScreenPriv;
 +   int x, y, w, h, line, ximage_stride;
 +
 +   sPriv-swrast_loader-getDrawableInfo(dPriv, x, y, w, h, 
 dPriv-loaderPrivate);
 +
    dri_drawable_validate_att(drawable, ST_ATTACHMENT_FRONT_LEFT);

 -   pt = drawable-textures[ST_ATTACHMENT_FRONT_LEFT];
 +   /* Use the pipe resource associated with the X drawable */
 +   res = drawable-textures[ST_ATTACHMENT_FRONT_LEFT];

 -   if (pt) {
 -      enum pipe_format internal_format = pt-format;
 +   if (res) {
 +      enum pipe_format internal_format = res-format;

       if (format == __DRI_TEXTURE_FORMAT_RGB)  {
          /* only need to cover the formats recognized by dri_fill_st_visual */
 @@ -218,9 +228,35 @@ dri_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
          }
       }

 +
 +      tex_xfer = pipe_get_transfer(pipe, res,
 +                                    0, 0,    // level, layer
 +                                    PIPE_TRANSFER_WRITE,
 +                                    x, y,
 +                                    w, h);
 +
 +
 +      map = pipe_transfer_map(pipe, tex_xfer);
 +
 +      /* Copy the Drawable content to the mapped texture buffer */
 +      sPriv-swrast_loader-getImage(dPriv, x, y, w, h, map,
 +                                  dPriv-loaderPrivate);
 +
 +      /* The pipe transfer has a pitch rounded up to the nearest 64 pixels.
 +         We assume 32 bit pixels. */
 +      ximage_stride = w * 4;
 +      for (line = h-1; line; --line) {
 +         memmove(map[line * tex_xfer-stride], map[line * ximage_stride], 
 ximage_stride);
 +      }
 +
 +      pipe_transfer_unmap(pipe, tex_xfer);
 +
 +      pipe_transfer_destroy(pipe, tex_xfer);
 +
       ctx-st-teximage(ctx-st,
             (target == GL_TEXTURE_2D) ? ST_TEXTURE_2D : ST_TEXTURE_RECT,
 -            0, internal_format, pt, FALSE);
 +            0, internal_format, res, FALSE);
 +
    }
  }

 --
 1.7.5.3.367.ga9930

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

___
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 Benjamin Franzke
2011/8/24 Chia-I Wu olva...@gmail.com:
 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
 @@ -577,6 +577,12 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
       return dri2_initialize_wayland(drv, disp);
  #endif
  #endif
 +#ifdef HAVE_ANDROID_PLATFORM
 +   case _EGL_PLATFORM_ANDROID:
 +      if (disp-Options.TestOnly)
 +         return EGL_TRUE;
 +      return dri2_initialize_android(drv, disp);
 +#endif

    default:
       return EGL_FALSE;
 @@ -1083,6 +1089,81 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, 
 _EGLContext *ctx,
  }
  #endif

 +#ifdef HAVE_ANDROID_PLATFORM
 +
 +static _EGLImage *
 +dri2_create_image_android_native_buffer(_EGLDisplay *disp,
 +                                        EGLClientBuffer buffer)
 +{
 +   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
 +   struct android_native_buffer_t *buf =
 +      (struct android_native_buffer_t *) buffer;
 +   struct gralloc_drm_handle_t *handle;
 +   struct dri2_egl_image *dri2_img;
 +   EGLint format;
 +
 +   if (!buf || buf-common.magic != ANDROID_NATIVE_BUFFER_MAGIC ||
 +       buf-common.version != sizeof(*buf)) {
 +      _eglError(EGL_BAD_PARAMETER, eglCreateEGLImageKHR);
 +      return NULL;
 +   }
 +
 +   /* check that the buffer is allocated by drm_gralloc and cast */
 +   handle = gralloc_drm_handle(buf-handle);
 +   if (!handle || !handle-name) {
 +      _eglError(EGL_BAD_PARAMETER, eglCreateEGLImageKHR);
 +      return NULL;
 +   }
 +
 +   switch (buf-format) {
 +   case HAL_PIXEL_FORMAT_BGRA_:
 +      format = __DRI_IMAGE_FORMAT_ARGB;
 +      break;
 +   case HAL_PIXEL_FORMAT_RGB_565:
 +      format = __DRI_IMAGE_FORMAT_RGB565;

Hm, I saw this also in the st/egl code, but forgot to ask there,
why is rgb565 reverse in comparison to the other native android formats?
(This is more a question for st/egl/android/native_android.cpp,
but both codes could probably use a comment?)
 +      break;
 +   case HAL_PIXEL_FORMAT_RGBA_:
 +   case HAL_PIXEL_FORMAT_RGBX_:
 +   case HAL_PIXEL_FORMAT_RGB_888:
 +   case HAL_PIXEL_FORMAT_RGBA_5551:
 +   case HAL_PIXEL_FORMAT_RGBA_:
 +      /* unsupported */
 +   default:
 +      _eglLog(_EGL_WARNING, unsupported native buffer format 0x%x, 
 buf-format);
 +      return NULL;
 +      break;
 +   }
 +
 +   dri2_img = calloc(1, sizeof(*dri2_img));
 +   if (!dri2_img) {
 +      _eglError(EGL_BAD_ALLOC, droid_create_image_mesa_drm);
 +      return NULL;
 +   }
 +
 +   if (!_eglInitImage(dri2_img-base, disp)) {
 +      free(dri2_img);
 +      return NULL;
 +   }
 +
 +   dri2_img-dri_image =
 +      dri2_dpy-image-createImageFromName(dri2_dpy-dri_screen,
 +                                          buf-width,
 +                                          buf-height,
 +                                          format,
 +                                          handle-name,
 +                                          buf-stride,
 +                                          dri2_img);
 +   if (!dri2_img-dri_image) {
 +      free(dri2_img);
 +      _eglError(EGL_BAD_ALLOC, droid_create_image_mesa_drm);
 +      return NULL;
 +   }
 +
 +   return dri2_img-base;
 +}
 +
 +#endif /* HAVE_ANDROID_PLATFORM */
 +

An image type specific to a platform should be only implemented (and available)
in that platform, like its done for image-from-pixmap in the other platforms.

  _EGLImage *
  dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
                      _EGLContext *ctx, EGLenum target,
 @@ -1099,6 +1180,10 @@ dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay 
 *disp,
    case EGL_WAYLAND_BUFFER_WL:
       return dri2_create_image_wayland_wl_buffer(disp, ctx, buffer, 
 attr_list);
  #endif
 +#ifdef HAVE_ANDROID_PLATFORM
 +   case EGL_NATIVE_BUFFER_ANDROID:
 +      return dri2_create_image_android_native_buffer(disp, buffer);
 +#endif

With the previous comment, this would be part of a
droid_create_image() in platform_android.c.
    default:
       _eglError(EGL_BAD_PARAMETER, dri2_create_image_khr);
       return 

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

2011-08-24 Thread Benjamin Franzke
2011/8/24 Chia-I Wu olva...@gmail.com:
 On Wed, Aug 24, 2011 at 7:01 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 2011/8/24 Chia-I Wu olva...@gmail.com:
 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
 @@ -577,6 +577,12 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
       return dri2_initialize_wayland(drv, disp);
  #endif
  #endif
 +#ifdef HAVE_ANDROID_PLATFORM
 +   case _EGL_PLATFORM_ANDROID:
 +      if (disp-Options.TestOnly)
 +         return EGL_TRUE;
 +      return dri2_initialize_android(drv, disp);
 +#endif

    default:
       return EGL_FALSE;
 @@ -1083,6 +1089,81 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay 
 *disp, _EGLContext *ctx,
  }
  #endif

 +#ifdef HAVE_ANDROID_PLATFORM
 +
 +static _EGLImage *
 +dri2_create_image_android_native_buffer(_EGLDisplay *disp,
 +                                        EGLClientBuffer buffer)
 +{
 +   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
 +   struct android_native_buffer_t *buf =
 +      (struct android_native_buffer_t *) buffer;
 +   struct gralloc_drm_handle_t *handle;
 +   struct dri2_egl_image *dri2_img;
 +   EGLint format;
 +
 +   if (!buf || buf-common.magic != ANDROID_NATIVE_BUFFER_MAGIC ||
 +       buf-common.version != sizeof(*buf)) {
 +      _eglError(EGL_BAD_PARAMETER, eglCreateEGLImageKHR);
 +      return NULL;
 +   }
 +
 +   /* check that the buffer is allocated by drm_gralloc and cast */
 +   handle = gralloc_drm_handle(buf-handle);
 +   if (!handle || !handle-name) {
 +      _eglError(EGL_BAD_PARAMETER, eglCreateEGLImageKHR);
 +      return NULL;
 +   }
 +
 +   switch (buf-format) {
 +   case HAL_PIXEL_FORMAT_BGRA_:
 +      format = __DRI_IMAGE_FORMAT_ARGB;
 +      break;
 +   case HAL_PIXEL_FORMAT_RGB_565:
 +      format = __DRI_IMAGE_FORMAT_RGB565;
 Hm, I saw this also in the st/egl code, but forgot to ask there,
 why is rgb565 reverse in comparison to the other native android formats?
 (This is more a question for st/egl/android/native_android.cpp,
 but both codes could probably use a comment?)
 By convention, the channel order of __DRI_IMAGE_FORMAT_ is the
 opposite of that of PIPE_FORMAT_.  For example,
 __DRI_IMAGE_FORMAT_RGB565 maps to PIPE_FORMAT_B5G6R5_UNORM.

Right, that wasnt my problem, rather what the HAL_PIXEL_FORMAT's mean
(that they have different byte orders..).

 As for HAL_PIXEL_FORMAT_, there is no rule...  The switch-statement in
 st/egl defines what a HAL_PIXEL_FORMAT really means.  As for egl_dri2
 here, I will add this comment

  /* see the table in droid_add_configs_for_visuals */

Yea, a reference to that table is good, since that really helps to
understand the mapping.

 +      break;
 +   case HAL_PIXEL_FORMAT_RGBA_:
 +   case HAL_PIXEL_FORMAT_RGBX_:
 +   case HAL_PIXEL_FORMAT_RGB_888:
 +   case HAL_PIXEL_FORMAT_RGBA_5551:
 +   case HAL_PIXEL_FORMAT_RGBA_:
 +      /* unsupported */
 +   default:
 +      _eglLog(_EGL_WARNING, unsupported native buffer format 0x%x, 
 buf-format);
 +      return NULL;
 +      break;
 +   }
 +
 +   dri2_img = calloc(1, sizeof(*dri2_img));
 +   if (!dri2_img) {
 +      _eglError(EGL_BAD_ALLOC, droid_create_image_mesa_drm);
 +      return NULL;
 +   }
 +
 +   if (!_eglInitImage(dri2_img-base, disp)) {
 +      free(dri2_img);
 +      return NULL;
 +   }
 +
 +   dri2_img-dri_image =
 +      dri2_dpy-image-createImageFromName(dri2_dpy-dri_screen,
 +                                          buf-width,
 +                                          buf-height,
 +                                          format,
 +                                          handle-name,
 +                                          buf-stride,
 +                                          dri2_img);
 +   if (!dri2_img-dri_image) {
 +      free(dri2_img);
 +      _eglError(EGL_BAD_ALLOC, droid_create_image_mesa_drm);
 +      return NULL;
 +   }
 +
 +   return dri2_img-base;
 +}
 +
 +#endif /* HAVE_ANDROID_PLATFORM */
 +

 An image type specific to a platform should be only implemented (and 
 available

Re: [Mesa-dev] [PATCHv2 13/21] android: build st/egl with android backend

2011-08-19 Thread Benjamin Franzke
2011/8/19 Chia-I Wu olva...@gmail.com:
 This builds the static library libmesa_st_egl from st/egl.
 ---
  src/gallium/Android.mk                    |    1 +
  src/gallium/state_trackers/egl/Android.mk |   56 
 +
  2 files changed, 57 insertions(+), 0 deletions(-)
  create mode 100644 src/gallium/state_trackers/egl/Android.mk

 diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk
 index 9a2fd2a..bf89e1a 100644
 --- a/src/gallium/Android.mk
 +++ b/src/gallium/Android.mk
 @@ -27,6 +27,7 @@ GALLIUM_TOP := $(call my-dir)
  GALLIUM_COMMON_MK := $(GALLIUM_TOP)/Android.common.mk

  SUBDIRS := \
 +       state_trackers/egl \
        auxiliary

  mkfiles := $(patsubst %,$(GALLIUM_TOP)/%/Android.mk,$(SUBDIRS))
 diff --git a/src/gallium/state_trackers/egl/Android.mk 
 b/src/gallium/state_trackers/egl/Android.mk
 new file mode 100644
 index 000..5425814
 --- /dev/null
 +++ b/src/gallium/state_trackers/egl/Android.mk
 @@ -0,0 +1,56 @@
 +# Mesa 3-D graphics library
 +#
 +# 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_PATH := $(call my-dir)
 +
 +common_SOURCES := \
 +       common/egl_g3d.c \
 +       common/egl_g3d_api.c \
 +       common/egl_g3d_image.c \
 +       common/egl_g3d_st.c \
 +       common/egl_g3d_sync.c \
 +       common/native_helper.c
 +
 +android_SOURCES := \
 +       android/native_android.cpp
 +
 +include $(CLEAR_VARS)
 +
 +LOCAL_SRC_FILES := \
 +       $(common_SOURCES) \
 +       $(android_SOURCES)
 +
 +LOCAL_CFLAGS := -DHAVE_ANDROID_BACKEND
 +
 +LOCAL_C_INCLUDES := \
 +       $(GALLIUM_TOP)/state_trackers/egl \
 +       $(GALLIUM_TOP)/winsys/sw \
 +       $(MESA_TOP)/src/egl/main \
 +       $(DRM_TOP) \
 +       $(DRM_TOP)/include/drm \

Since libdrm isnt used inside st/egl directly, I think you can drop these here.
Or are these paths needed for drm_gralloc?
 +       $(DRM_GRALLOC_TOP)
 +
 +LOCAL_MODULE := libmesa_st_egl
 +
 +include $(GALLIUM_COMMON_MK)
 +include $(BUILD_STATIC_LIBRARY)
 --
 1.7.5.4

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

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


Re: [Mesa-dev] [PATCHv2 10/21] targets/egl-static: do not rely on libudev on Android

2011-08-19 Thread Benjamin Franzke
2011/8/19 Chia-I Wu olva...@gmail.com:
 There is no libudev on Android.  Use DRM to get the PCI ID directly.
 ---
  src/gallium/targets/egl-static/egl.c |   62 
 ++
  1 files changed, 62 insertions(+), 0 deletions(-)

 diff --git a/src/gallium/targets/egl-static/egl.c 
 b/src/gallium/targets/egl-static/egl.c
 index 568f549..38ba6c2 100644
 --- a/src/gallium/targets/egl-static/egl.c
 +++ b/src/gallium/targets/egl-static/egl.c
 @@ -109,6 +109,68 @@ out:
    return (*chip_id = 0);
  }

 +#elif defined(PIPE_OS_ANDROID)

Just want to mention that I appreciate doing this really only for android,
and not as a fallback for no-libudev in general. (which would probably end up
with more problems for none intel/radeon users and strange bugs..)
 +
 +#include xf86drm.h
 +/* for i915 */
 +#include i915_drm.h
 +/* for radeon */
 +#include radeon_drm.h
 +
 +static boolean
 +drm_fd_get_pci_id(int fd, int *vendor_id, int *chip_id)
 +{
 +   drmVersionPtr version;
 +
 +   *chip_id = -1;
 +
 +   version = drmGetVersion(fd);
 +   if (!version) {
 +      _eglLog(_EGL_WARNING, invalid drm fd);
 +      return FALSE;
 +   }
 +   if (!version-name) {
 +      _eglLog(_EGL_WARNING, unable to determine the driver name);
 +      drmFreeVersion(version);
 +      return FALSE;
 +   }
 +
 +   if (strcmp(version-name, i915) == 0) {

Shouldnt util_strcmp from util/u_string.h be used instead?
 +      struct drm_i915_getparam gp;
 +      int ret;
 +
 +      *vendor_id = 0x8086;
 +
 +      memset(gp, 0, sizeof(gp));
 +      gp.param = I915_PARAM_CHIPSET_ID;
 +      gp.value = chip_id;
 +      ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, gp, sizeof(gp));
 +      if (ret) {
 +         _eglLog(_EGL_WARNING, failed to get param for i915);
 +        *chip_id = -1;
 +      }
 +   }
 +   else if (strcmp(version-name, radeon) == 0) {
 +      struct drm_radeon_info info;
 +      int ret;
 +
 +      *vendor_id = 0x1002;
 +
 +      memset(info, 0, sizeof(info));
 +      info.request = RADEON_INFO_DEVICE_ID;
 +      info.value = (long) chip_id;

Just a little nitpick: value is of type uint64_t, so the cast should
rather be to an unsigned type.

Besides that:
Reviewed-by: Benjamin Franzke benjaminfran...@googlemail.com

 +      ret = drmCommandWriteRead(fd, DRM_RADEON_INFO, info, sizeof(info));
 +      if (ret) {
 +         _eglLog(_EGL_WARNING, failed to get info for radeon);
 +        *chip_id = -1;
 +      }
 +   }
 +
 +   drmFreeVersion(version);
 +
 +   return (*chip_id = 0);
 +}
 +
  #else

  static boolean
 --
 1.7.5.4

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

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


Re: [Mesa-dev] [PATCHv2 10/21] targets/egl-static: do not rely on libudev on Android

2011-08-19 Thread Benjamin Franzke
2011/8/19 Chia-I Wu olva...@gmail.com:
 On Fri, Aug 19, 2011 at 5:59 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 2011/8/19 Chia-I Wu olva...@gmail.com:
 There is no libudev on Android.  Use DRM to get the PCI ID directly.
 ---
  src/gallium/targets/egl-static/egl.c |   62 
 ++
  1 files changed, 62 insertions(+), 0 deletions(-)

 diff --git a/src/gallium/targets/egl-static/egl.c 
 b/src/gallium/targets/egl-static/egl.c
 index 568f549..38ba6c2 100644
 --- a/src/gallium/targets/egl-static/egl.c
 +++ b/src/gallium/targets/egl-static/egl.c
 @@ -109,6 +109,68 @@ out:
    return (*chip_id = 0);
  }

 +#elif defined(PIPE_OS_ANDROID)
 Just want to mention that I appreciate doing this really only for android,
 and not as a fallback for no-libudev in general. (which would probably end up
 with more problems for none intel/radeon users and strange bugs..)
 Can you elaborate?  I have no intention to make it a fallback, but I
 am curious about the potential problems.

The problem I meant is that it wouldnt work for nouveau right now, e.g. with the
wayland or drm platforms we would endup with failed to get driver
name for fd ...

 +
 +#include xf86drm.h
 +/* for i915 */
 +#include i915_drm.h
 +/* for radeon */
 +#include radeon_drm.h
 +
 +static boolean
 +drm_fd_get_pci_id(int fd, int *vendor_id, int *chip_id)
 +{
 +   drmVersionPtr version;
 +
 +   *chip_id = -1;
 +
 +   version = drmGetVersion(fd);
 +   if (!version) {
 +      _eglLog(_EGL_WARNING, invalid drm fd);
 +      return FALSE;
 +   }
 +   if (!version-name) {
 +      _eglLog(_EGL_WARNING, unable to determine the driver name);
 +      drmFreeVersion(version);
 +      return FALSE;
 +   }
 +
 +   if (strcmp(version-name, i915) == 0) {

 Shouldnt util_strcmp from util/u_string.h be used instead?
 Yes, will do.
 +      struct drm_i915_getparam gp;
 +      int ret;
 +
 +      *vendor_id = 0x8086;
 +
 +      memset(gp, 0, sizeof(gp));
 +      gp.param = I915_PARAM_CHIPSET_ID;
 +      gp.value = chip_id;
 +      ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, gp, sizeof(gp));
 +      if (ret) {
 +         _eglLog(_EGL_WARNING, failed to get param for i915);
 +        *chip_id = -1;
 +      }
 +   }
 +   else if (strcmp(version-name, radeon) == 0) {
 +      struct drm_radeon_info info;
 +      int ret;
 +
 +      *vendor_id = 0x1002;
 +
 +      memset(info, 0, sizeof(info));
 +      info.request = RADEON_INFO_DEVICE_ID;
 +      info.value = (long) chip_id;

 Just a little nitpick: value is of type uint64_t, so the cast should
 rather be to an unsigned type.
 I will make it unsigned long.
 Besides that:
 Reviewed-by: Benjamin Franzke benjaminfran...@googlemail.com
 Thanks.
 +      ret = drmCommandWriteRead(fd, DRM_RADEON_INFO, info, sizeof(info));
 +      if (ret) {
 +         _eglLog(_EGL_WARNING, failed to get info for radeon);
 +        *chip_id = -1;
 +      }
 +   }
 +
 +   drmFreeVersion(version);
 +
 +   return (*chip_id = 0);
 +}
 +
  #else

  static boolean
 --
 1.7.5.4

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





 --
 o...@lunarg.com

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


[Mesa-dev] [PATCH] dri2: Add __DRI_BUFFER_COUNT token

2011-08-15 Thread Benjamin Franzke
Remove definition from egl_dri2.
Defining this is egl_dri2.h breaks as soon as
a new dri2 buffer token is added like with commit
4501a5d6e8d00fd0d87625352ed5ba1a8861f72e.
---
 include/GL/internal/dri_interface.h |1 +
 src/egl/drivers/dri2/egl_dri2.h |2 --
 2 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 4fe9e94..6d8c614 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -693,6 +693,7 @@ struct __DRIswrastExtensionRec {
 #define __DRI_BUFFER_FAKE_FRONT_RIGHT  8
 #define __DRI_BUFFER_DEPTH_STENCIL 9  /** Only available with DRI2 1.1 */
 #define __DRI_BUFFER_HIZ   10
+#define __DRI_BUFFER_COUNT 11
 
 struct __DRIbufferRec {
 unsigned int attachment;
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index a729718..db93eec 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -123,8 +123,6 @@ enum wayland_buffer_type {
WL_BUFFER_THIRD,
WL_BUFFER_COUNT
 };
-
-#define __DRI_BUFFER_COUNT 10
 #endif
 
 enum dri2_surface_type {
-- 
1.7.3.4

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


Re: [Mesa-dev] Mesa (master): egl: Native Display autodetection

2011-08-15 Thread Benjamin Franzke
2011/8/15 Cooper Yuan coopery...@gmail.com:
 so, export EGL_PLATFORM=drm, is still working, right?

Yes, and has a higher priority than the autodetection.

 On Mon, Aug 15, 2011 at 3:47 PM, Benjamin Franzke
 b...@kemper.freedesktop.org wrote:

 Module: Mesa
 Branch: master
 Commit: 85fe9484945cb57ffd49df248b0e5057eba6af04
 URL:
  http://cgit.freedesktop.org/mesa/mesa/commit/?id=85fe9484945cb57ffd49df248b0e5057eba6af04

 Author: Benjamin Franzke benjaminfran...@googlemail.com
 Date:   Tue Aug  9 14:23:18 2011 +0200

 egl: Native Display autodetection

 EGL doesnt define howto manage different native platforms.
 So mesa has a builtime configurable default platform,
 whith non-standard envvar (EGL_PLATFORM) overwrites.
 This caused unneeded bugreports, when EGL_PLATFORM was forgotten.

 Detection is grouped into basic types of NativeDisplays (which itself
 needs to be detected).  The final decision is based on characteristcs
 of these basic types:

  File Desciptor based platforms (fbdev):
    - fstat(2) to check for being a fd that belongs to a character device
    - check kernel subsystem (todo)

  Pointer to structuctures (x11, wayland, drm/gbm):
    - mincore(2) to check whether its valid pointer to some memory.
    - magic elements (e.g. pointers to exported symbols):
      o wayland display stores interface type pointer (first elm.)
      o gbm stores pointer to its constructor (first elm.)
      o x11 as a fallback (FIXME?)

 Reviewed-by: Kristian Høgsberg k...@bitplanet.net

 ---

  configure.ac              |    2 +
  src/egl/main/Makefile     |   13 ++
  src/egl/main/eglapi.c     |    8 ++--
  src/egl/main/egldisplay.c |  100
 +++-
  src/egl/main/egldisplay.h |    2 +-
  5 files changed, 117 insertions(+), 8 deletions(-)

 diff --git a/configure.ac b/configure.ac
 index 1b1823a..9195da9 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -1370,6 +1370,8 @@ if test x$enable_egl = xyes; then
     EGL_LIB_DEPS=$DLOPEN_LIBS $SELINUX_LIBS -lpthread
     EGL_DRIVERS_DIRS=

 +    AC_CHECK_FUNC(mincore, [DEFINES=$DEFINES -DHAVE_MINCORE])
 +
     if test $enable_static != yes; then
         # build egl_glx when libGL is built
         if test x$enable_glx = xyes; then
 diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
 index 775fbbe..c100fbf 100644
 --- a/src/egl/main/Makefile
 +++ b/src/egl/main/Makefile
 @@ -93,6 +93,19 @@ ifeq ($(firstword $(EGL_PLATFORMS)),fbdev)
  EGL_NATIVE_PLATFORM=_EGL_PLATFORM_FBDEV
  endif

 +ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
 +LOCAL_CFLAGS += -DHAVE_X11_PLATFORM
 +endif
 +ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
 +LOCAL_CFLAGS += -DHAVE_WAYLAND_PLATFORM
 +endif
 +ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
 +LOCAL_CFLAGS += -DHAVE_DRM_PLATFORM
 +endif
 +ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
 +LOCAL_CFLAGS += -DHAVE_FBDEV_PLATFORM
 +endif
 +
  LOCAL_CFLAGS += \
        -D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM) \
        -D_EGL_DRIVER_SEARCH_DIR=\$(EGL_DRIVER_INSTALL_DIR)\
 diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
 index 0ba7794..5d186c6 100644
 --- a/src/egl/main/eglapi.c
 +++ b/src/egl/main/eglapi.c
 @@ -301,7 +301,7 @@ _eglUnlockDisplay(_EGLDisplay *dpy)
  EGLDisplay EGLAPIENTRY
  eglGetDisplay(EGLNativeDisplayType nativeDisplay)
  {
 -   _EGLPlatformType plat = _eglGetNativePlatform();
 +   _EGLPlatformType plat = _eglGetNativePlatform(nativeDisplay);
    _EGLDisplay *dpy = _eglFindDisplay(plat, (void *) nativeDisplay);
    return _eglGetDisplayHandle(dpy);
  }
 @@ -538,7 +538,7 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig
 config,
    EGLSurface ret;

    _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
 -   if (disp-Platform != _eglGetNativePlatform())
 +   if (disp-Platform != _eglGetNativePlatform(disp-PlatformDisplay))
       RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);

    surf = drv-API.CreateWindowSurface(drv, disp, conf, window,
 attrib_list);
 @@ -559,7 +559,7 @@ eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig
 config,
    EGLSurface ret;

    _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
 -   if (disp-Platform != _eglGetNativePlatform())
 +   if (disp-Platform != _eglGetNativePlatform(disp-PlatformDisplay))
       RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_NO_SURFACE);

    surf = drv-API.CreatePixmapSurface(drv, disp, conf, pixmap,
 attrib_list);
 @@ -720,7 +720,7 @@ eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
 EGLNativePixmapType target)
    EGLBoolean ret;

    _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
 -   if (disp-Platform != _eglGetNativePlatform())
 +   if (disp-Platform != _eglGetNativePlatform(disp-PlatformDisplay))
       RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_FALSE);
    ret = drv-API.CopyBuffers(drv, disp, surf, target);

 diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
 index 60f3177..2849dd9 100644
 --- a/src/egl/main/egldisplay.c
 +++ b/src/egl/main/egldisplay.c

[Mesa-dev] [PATCH 1/3][RFC] egl: Native Display autodetection

2011-08-09 Thread Benjamin Franzke
EGL doesnt define howto manage different native platforms.
So mesa has a builtime configurable default platform,
whith non-standard envvar (EGL_PLATFORM) overwrites.
This caused unneeded bugreports, when EGL_PLATFORM was forgotten.

Detection is grouped into basic types of NativeDisplays (which itself
needs to be detected).  The final decision is based on characteristcs
of these basic types:

  File Desciptor based platforms (fbdev):
- fstat(2) to check for being a fd that belongs to a character device
- check kernel subsystem (todo)

  Pointer to structuctures (x11, wayland, drm/gbm):
- mincore(2) to check whether its valid pointer to some memory.
- magic elements (e.g. pointers to exported symbols):
  o wayland display stores interface type pointer (first elm.)
  o gbm stores pointer to its constructor (first elm.)
  o x11 as a fallback (FIXME?)

Reviewed-by: Kristian Høgsberg k...@bitplanet.net
---
 configure.ac  |2 +
 src/egl/main/Makefile |   13 ++
 src/egl/main/eglapi.c |8 ++--
 src/egl/main/egldisplay.c |   95 +++-
 src/egl/main/egldisplay.h |2 +-
 5 files changed, 112 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1b1823a..9195da9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1370,6 +1370,8 @@ if test x$enable_egl = xyes; then
 EGL_LIB_DEPS=$DLOPEN_LIBS $SELINUX_LIBS -lpthread
 EGL_DRIVERS_DIRS=
 
+AC_CHECK_FUNC(mincore, [DEFINES=$DEFINES -DHAVE_MINCORE])
+
 if test $enable_static != yes; then
 # build egl_glx when libGL is built
 if test x$enable_glx = xyes; then
diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
index 775fbbe..c100fbf 100644
--- a/src/egl/main/Makefile
+++ b/src/egl/main/Makefile
@@ -93,6 +93,19 @@ ifeq ($(firstword $(EGL_PLATFORMS)),fbdev)
 EGL_NATIVE_PLATFORM=_EGL_PLATFORM_FBDEV
 endif
 
+ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
+LOCAL_CFLAGS += -DHAVE_X11_PLATFORM
+endif
+ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
+LOCAL_CFLAGS += -DHAVE_WAYLAND_PLATFORM
+endif
+ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
+LOCAL_CFLAGS += -DHAVE_DRM_PLATFORM
+endif
+ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
+LOCAL_CFLAGS += -DHAVE_FBDEV_PLATFORM
+endif
+
 LOCAL_CFLAGS += \
-D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM) \
-D_EGL_DRIVER_SEARCH_DIR=\$(EGL_DRIVER_INSTALL_DIR)\
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 0ba7794..5d186c6 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -301,7 +301,7 @@ _eglUnlockDisplay(_EGLDisplay *dpy)
 EGLDisplay EGLAPIENTRY
 eglGetDisplay(EGLNativeDisplayType nativeDisplay)
 {
-   _EGLPlatformType plat = _eglGetNativePlatform();
+   _EGLPlatformType plat = _eglGetNativePlatform(nativeDisplay);
_EGLDisplay *dpy = _eglFindDisplay(plat, (void *) nativeDisplay);
return _eglGetDisplayHandle(dpy);
 }
@@ -538,7 +538,7 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
EGLSurface ret;
 
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
-   if (disp-Platform != _eglGetNativePlatform())
+   if (disp-Platform != _eglGetNativePlatform(disp-PlatformDisplay))
   RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
 
surf = drv-API.CreateWindowSurface(drv, disp, conf, window, attrib_list);
@@ -559,7 +559,7 @@ eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
EGLSurface ret;
 
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
-   if (disp-Platform != _eglGetNativePlatform())
+   if (disp-Platform != _eglGetNativePlatform(disp-PlatformDisplay))
   RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_NO_SURFACE);
 
surf = drv-API.CreatePixmapSurface(drv, disp, conf, pixmap, attrib_list);
@@ -720,7 +720,7 @@ eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, 
EGLNativePixmapType target)
EGLBoolean ret;
 
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
-   if (disp-Platform != _eglGetNativePlatform())
+   if (disp-Platform != _eglGetNativePlatform(disp-PlatformDisplay))
   RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_FALSE);
ret = drv-API.CopyBuffers(drv, disp, surf, target);
 
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 60f3177..bd4fe19 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -43,6 +43,23 @@
 #include eglmutex.h
 #include egllog.h
 
+/* Includes for _eglNativePlatformDetectNativeDisplay */
+#ifdef HAVE_MINCORE
+#include unistd.h
+#include sys/mman.h
+#endif
+#ifdef HAVE_WAYLAND_PLATFORM
+#include wayland-client.h
+#endif
+#ifdef HAVE_DRM_PLATFORM
+#include gbm.h
+#endif
+#ifdef HAVE_FBDEV_PLATFORM
+#include stdint.h
+#include sys/types.h
+#include sys/stat.h
+#endif
+
 
 /**
  * Return the native platform by parsing EGL_PLATFORM.
@@ -82,19 +99,91 @@ _eglGetNativePlatformFromEnv(void)
return plat;
 }
 
+static EGLBoolean
+_eglPointerIsDereferencable(void *p)
+{
+#ifdef HAVE_MINCORE
+   

[Mesa-dev] [PATCH 3/3] egl: Log (debug) native platform type

2011-08-09 Thread Benjamin Franzke
Reviewed-by: Kristian Høgsberg k...@bitplanet.net
---
 src/egl/main/egldisplay.c |   29 ++---
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 5421f5f..27399c3 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -60,6 +60,17 @@
 #include sys/stat.h
 #endif
 
+/* map --with-egl-platforms names to platform types */
+static const struct {
+   _EGLPlatformType platform;
+   const char *name;
+} egl_platforms[_EGL_NUM_PLATFORMS] = {
+   { _EGL_PLATFORM_WINDOWS, gdi },
+   { _EGL_PLATFORM_X11, x11 },
+   { _EGL_PLATFORM_WAYLAND, wayland },
+   { _EGL_PLATFORM_DRM, drm },
+   { _EGL_PLATFORM_FBDEV, fbdev }
+};
 
 /**
  * Return the native platform by parsing EGL_PLATFORM.
@@ -67,17 +78,6 @@
 static _EGLPlatformType
 _eglGetNativePlatformFromEnv(void)
 {
-   /* map --with-egl-platforms names to platform types */
-   static const struct {
-  _EGLPlatformType platform;
-  const char *name;
-   } egl_platforms[_EGL_NUM_PLATFORMS] = {
-  { _EGL_PLATFORM_WINDOWS, gdi },
-  { _EGL_PLATFORM_X11, x11 },
-  { _EGL_PLATFORM_WAYLAND, wayland },
-  { _EGL_PLATFORM_DRM, drm },
-  { _EGL_PLATFORM_FBDEV, fbdev }
-   };
_EGLPlatformType plat = _EGL_INVALID_PLATFORM;
const char *plat_name;
EGLint i;
@@ -176,15 +176,22 @@ _EGLPlatformType
 _eglGetNativePlatform(EGLNativeDisplayType nativeDisplay)
 {
_EGLPlatformType native_platform;
+   char *detection_method;
 
native_platform = _eglGetNativePlatformFromEnv();
+   detection_method = environment overwrite;
if (native_platform == _EGL_INVALID_PLATFORM) {
   native_platform = _eglNativePlatformDetectNativeDisplay(nativeDisplay);
+  detection_method = autodetected;
   if (native_platform == _EGL_INVALID_PLATFORM) {
  native_platform = _EGL_NATIVE_PLATFORM;
+ detection_method = build-time configuration;
   }
}
 
+   _eglLog(_EGL_DEBUG, Native platform type: %s (%s),
+   egl_platforms[native_platform].name, detection_method);
+
return native_platform;
 }
 
-- 
1.7.3.4

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


Re: [Mesa-dev] [PATCH 1/3][RFC] egl: Native Display autodetection

2011-08-09 Thread Benjamin Franzke
2011/8/10 Chia-I Wu olva...@gmail.com:
 On Tue, Aug 9, 2011 at 10:53 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 EGL doesnt define howto manage different native platforms.
 So mesa has a builtime configurable default platform,
 whith non-standard envvar (EGL_PLATFORM) overwrites.
 This caused unneeded bugreports, when EGL_PLATFORM was forgotten.

 Detection is grouped into basic types of NativeDisplays (which itself
 needs to be detected).  The final decision is based on characteristcs
 of these basic types:

  File Desciptor based platforms (fbdev):
    - fstat(2) to check for being a fd that belongs to a character device
    - check kernel subsystem (todo)

  Pointer to structuctures (x11, wayland, drm/gbm):
    - mincore(2) to check whether its valid pointer to some memory.
    - magic elements (e.g. pointers to exported symbols):
      o wayland display stores interface type pointer (first elm.)
      o gbm stores pointer to its constructor (first elm.)
      o x11 as a fallback (FIXME?)
 The first and third patches look good to me.  But the second patch
 seems like an extension to EGL to me.  How is it useful in practice
 and how can the spec be updated?

I'd rather see having different native platform types as an extension,
and being able to use all of those in one process as an intuitional consequence.

So updating the spec from this point of view is a bit unlikely, since
it would involve
introduction of some kind of a native display type enumeration or so..

But I dont have a good use case either, and would be ok with leaving
out that patch.



 Reviewed-by: Kristian Høgsberg k...@bitplanet.net
 ---
  configure.ac              |    2 +
  src/egl/main/Makefile     |   13 ++
  src/egl/main/eglapi.c     |    8 ++--
  src/egl/main/egldisplay.c |   95 
 +++-
  src/egl/main/egldisplay.h |    2 +-
  5 files changed, 112 insertions(+), 8 deletions(-)

 diff --git a/configure.ac b/configure.ac
 index 1b1823a..9195da9 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -1370,6 +1370,8 @@ if test x$enable_egl = xyes; then
     EGL_LIB_DEPS=$DLOPEN_LIBS $SELINUX_LIBS -lpthread
     EGL_DRIVERS_DIRS=

 +    AC_CHECK_FUNC(mincore, [DEFINES=$DEFINES -DHAVE_MINCORE])
 +
     if test $enable_static != yes; then
         # build egl_glx when libGL is built
         if test x$enable_glx = xyes; then
 diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
 index 775fbbe..c100fbf 100644
 --- a/src/egl/main/Makefile
 +++ b/src/egl/main/Makefile
 @@ -93,6 +93,19 @@ ifeq ($(firstword $(EGL_PLATFORMS)),fbdev)
  EGL_NATIVE_PLATFORM=_EGL_PLATFORM_FBDEV
  endif

 +ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
 +LOCAL_CFLAGS += -DHAVE_X11_PLATFORM
 +endif
 +ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
 +LOCAL_CFLAGS += -DHAVE_WAYLAND_PLATFORM
 +endif
 +ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
 +LOCAL_CFLAGS += -DHAVE_DRM_PLATFORM
 +endif
 +ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
 +LOCAL_CFLAGS += -DHAVE_FBDEV_PLATFORM
 +endif
 +
  LOCAL_CFLAGS += \
        -D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM) \
        -D_EGL_DRIVER_SEARCH_DIR=\$(EGL_DRIVER_INSTALL_DIR)\
 diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
 index 0ba7794..5d186c6 100644
 --- a/src/egl/main/eglapi.c
 +++ b/src/egl/main/eglapi.c
 @@ -301,7 +301,7 @@ _eglUnlockDisplay(_EGLDisplay *dpy)
  EGLDisplay EGLAPIENTRY
  eglGetDisplay(EGLNativeDisplayType nativeDisplay)
  {
 -   _EGLPlatformType plat = _eglGetNativePlatform();
 +   _EGLPlatformType plat = _eglGetNativePlatform(nativeDisplay);
    _EGLDisplay *dpy = _eglFindDisplay(plat, (void *) nativeDisplay);
    return _eglGetDisplayHandle(dpy);
  }
 @@ -538,7 +538,7 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
    EGLSurface ret;

    _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
 -   if (disp-Platform != _eglGetNativePlatform())
 +   if (disp-Platform != _eglGetNativePlatform(disp-PlatformDisplay))
       RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);

    surf = drv-API.CreateWindowSurface(drv, disp, conf, window, attrib_list);
 @@ -559,7 +559,7 @@ eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
    EGLSurface ret;

    _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
 -   if (disp-Platform != _eglGetNativePlatform())
 +   if (disp-Platform != _eglGetNativePlatform(disp-PlatformDisplay))
       RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_NO_SURFACE);

    surf = drv-API.CreatePixmapSurface(drv, disp, conf, pixmap, attrib_list);
 @@ -720,7 +720,7 @@ eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, 
 EGLNativePixmapType target)
    EGLBoolean ret;

    _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
 -   if (disp-Platform != _eglGetNativePlatform())
 +   if (disp-Platform != _eglGetNativePlatform(disp-PlatformDisplay))
       RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_FALSE);
    ret = drv-API.CopyBuffers(drv, disp, surf, target);

 diff --git a/src/egl/main

Re: [Mesa-dev] [PATCH 1/3][RFC] egl: Native Display autodetection

2011-08-09 Thread Benjamin Franzke
2011/8/10 Chia-I Wu olva...@gmail.com:
 I'd prefer to leave out the second patch for now.  One comment below

 On Tue, Aug 9, 2011 at 10:53 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
 index 0ba7794..5d186c6 100644
 --- a/src/egl/main/eglapi.c
 +++ b/src/egl/main/eglapi.c
 @@ -301,7 +301,7 @@ _eglUnlockDisplay(_EGLDisplay *dpy)
  EGLDisplay EGLAPIENTRY
  eglGetDisplay(EGLNativeDisplayType nativeDisplay)
  {
 -   _EGLPlatformType plat = _eglGetNativePlatform();
 +   _EGLPlatformType plat = _eglGetNativePlatform(nativeDisplay);
    _EGLDisplay *dpy = _eglFindDisplay(plat, (void *) nativeDisplay);
    return _eglGetDisplayHandle(dpy);
  }
 @@ -538,7 +538,7 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
    EGLSurface ret;

    _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
 -   if (disp-Platform != _eglGetNativePlatform())
 +   if (disp-Platform != _eglGetNativePlatform(disp-PlatformDisplay))
 This check and the next two won't be necessary after the change to
 _eglGetNativePlatform.

Hm.. Actually I wanted to ask you do we need them at all?
I mean how does checking Platform type match to a
BAD_NATIVE_{WINDOW,PIXMAP} error?
Also: shouldnt that always be false since native_platform is static in
_eglGetNativePlatform?

       RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);

    surf = drv-API.CreateWindowSurface(drv, disp, conf, window, attrib_list);
 @@ -559,7 +559,7 @@ eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
    EGLSurface ret;

    _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
 -   if (disp-Platform != _eglGetNativePlatform())
 +   if (disp-Platform != _eglGetNativePlatform(disp-PlatformDisplay))
       RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_NO_SURFACE);

    surf = drv-API.CreatePixmapSurface(drv, disp, conf, pixmap, attrib_list);
 @@ -720,7 +720,7 @@ eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, 
 EGLNativePixmapType target)
    EGLBoolean ret;

    _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
 -   if (disp-Platform != _eglGetNativePlatform())
 +   if (disp-Platform != _eglGetNativePlatform(disp-PlatformDisplay))
       RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_PIXMAP, EGL_FALSE);
    ret = drv-API.CopyBuffers(drv, disp, surf, target);




 --
 o...@lunarg.com

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


Re: [Mesa-dev] Mesa (master): egl/gbm: Fix EGL_DEFAULT_DISPLAY

2011-08-05 Thread Benjamin Franzke
2011/8/5 Chad Versace c...@chad-versace.us:
 This commit *really* needs a more descriptive commit message.

Ok, I thought its clear what is to be done for EGL_DEFAULT_DISPLAY.
But your right, it should have more descriptive. In future I'll try to do so.

Since I cant change the commit message now, let me answer your questions.

  - What were the symptoms of the broken EGL_DEFAULT_DISPLAY?

Segfault, because the native egl display is NULL.

  - What error in the code caused the problem?

Not handling the above.

  - What the hell did you do to fix it? This is not evident due to the length
    of the commit.

Well, its really just creating a new gbm device if there is none given,
and properly destroying it, if created by ourself.

And what does this fix?
eglinfo.c in mesa/demos/src/egl/opengl/ with EGL_PLATFORM=drm

P.S. This has nothing to do with hell.
I understand that bad commit messages can upset, but lets keep patient.

 For commits of this complexity, write descriptive messages for the sake of 
 others.

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

 On 08/04/2011 05:18 AM, Benjamin Franzke wrote:
 Module: Mesa
 Branch: master
 Commit: 32f4cf38085e4056b8e4a9fc78fea28897a1d05f
 URL:    
 http://cgit.freedesktop.org/mesa/mesa/commit/?id=32f4cf38085e4056b8e4a9fc78fea28897a1d05f

 Author: Benjamin Franzke benjaminfran...@googlemail.com
 Date:   Wed Jun 29 08:49:39 2011 +0200

 egl/gbm: Fix EGL_DEFAULT_DISPLAY

 ---

  src/egl/drivers/dri2/egl_dri2.c                 |    7 ++
  src/egl/drivers/dri2/egl_dri2.h                 |    1 +
  src/egl/drivers/dri2/platform_drm.c             |   25 
 +-
  src/gallium/state_trackers/egl/drm/native_drm.c |   23 
  src/gallium/state_trackers/egl/drm/native_drm.h |    4 +++
  5 files changed, 53 insertions(+), 7 deletions(-)

 diff --git a/src/egl/drivers/dri2/egl_dri2.c 
 b/src/egl/drivers/dri2/egl_dri2.c
 index 0aca929..9a37ea4 100644
 --- a/src/egl/drivers/dri2/egl_dri2.c
 +++ b/src/egl/drivers/dri2/egl_dri2.c
 @@ -592,6 +592,13 @@ dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
           wl_display_destroy(dri2_dpy-wl_dpy);
           break;
  #endif
 +#ifdef HAVE_DRM_PLATFORM
 +      case _EGL_PLATFORM_DRM:
 +         if (dri2_dpy-own_gbm_device) {
 +            gbm_device_destroy(dri2_dpy-gbm_dri-base.base);
 +         }
 +         break;
 +#endif
        default:
           break;
        }
 diff --git a/src/egl/drivers/dri2/egl_dri2.h 
 b/src/egl/drivers/dri2/egl_dri2.h
 index 3854200..a729718 100644
 --- a/src/egl/drivers/dri2/egl_dri2.h
 +++ b/src/egl/drivers/dri2/egl_dri2.h
 @@ -86,6 +86,7 @@ struct dri2_egl_display

  #ifdef HAVE_DRM_PLATFORM
     struct gbm_dri_device    *gbm_dri;
 +   int                       own_gbm_device;
  #endif

     char                     *device_name;
 diff --git a/src/egl/drivers/dri2/platform_drm.c 
 b/src/egl/drivers/dri2/platform_drm.c
 index 579baf9..04b10e2 100644
 --- a/src/egl/drivers/dri2/platform_drm.c
 +++ b/src/egl/drivers/dri2/platform_drm.c
 @@ -30,6 +30,10 @@
  #include string.h
  #include xf86drm.h
  #include dlfcn.h
 +#include sys/types.h
 +#include sys/stat.h
 +#include fcntl.h
 +#include unistd.h

  #include egl_dri2.h

 @@ -90,6 +94,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
  {
     struct dri2_egl_display *dri2_dpy;
     struct gbm_device *gbm;
 +   int fd = -1;
     int i;

     dri2_dpy = malloc(sizeof *dri2_dpy);
 @@ -100,7 +105,15 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)

     disp-DriverData = (void *) dri2_dpy;

 -   gbm = (struct gbm_device *) disp-PlatformDisplay;
 +   gbm = disp-PlatformDisplay;
 +   if (gbm == NULL) {
 +      fd = open(/dev/dri/card0, O_RDWR);
 +      dri2_dpy-own_gbm_device = 1;
 +      gbm = gbm_create_device(fd);
 +      if (gbm == NULL)
 +         return EGL_FALSE;
 +   }
 +
     if (strcmp(gbm_device_get_backend_name(gbm), drm) != 0) {
        free(dri2_dpy);
        return EGL_FALSE;
 @@ -112,7 +125,15 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
        return EGL_FALSE;
     }

 -   dri2_dpy-fd = gbm_device_get_fd(gbm);
 +   if (fd  0) {
 +      fd = dup(gbm_device_get_fd(gbm));
 +      if (fd  0) {
 +         free(dri2_dpy);
 +         return EGL_FALSE;
 +      }
 +   }
 +
 +   dri2_dpy-fd = fd;
     dri2_dpy-device_name = dri2_get_device_name_for_fd(dri2_dpy-fd);
     dri2_dpy-driver_name = dri2_dpy-gbm_dri-base.driver_name;

 diff --git a/src/gallium/state_trackers/egl/drm/native_drm.c 
 b/src/gallium/state_trackers/egl/drm/native_drm.c
 index 47910de..c013769 100644
 --- a/src/gallium/state_trackers/egl/drm/native_drm.c
 +++ b/src/gallium/state_trackers/egl/drm/native_drm.c
 @@ -134,8 +134,11 @@ drm_display_destroy(struct native_display *ndpy)
     if (drmdpy-device_name)
        FREE(drmdpy-device_name);

 -   if (drmdpy-fd = 0)
 -      close(drmdpy-fd);
 +   if (drmdpy-own_gbm) {
 +      gbm_device_destroy(drmdpy-gbmdrm-base.base);
 +      if (drmdpy-fd = 0

Re: [Mesa-dev] Removing GLw from the main Mesa repository

2011-08-05 Thread Benjamin Franzke
There is nothing compiled since GLW_SOURCES is not substituted by configure:
Makefile.am:29
  libGLw_la_SOURCES = $(GLW_SOURCES)

This would need AC_SUBST([GLW_SOURCES]) in configure.ac,
but thats not allowed for _SOURCES variables, see automake output:

configure.ac:96: `GLW_SOURCES' includes configure substitution `@GLW_SOURCES@'
configure.ac:96: and is referred to from `libGLw_la_SOURCES';
configure.ac:96: configure substitutions are not allowed in _SOURCES variables

2011/8/5 Kenneth Graunke kenn...@whitecape.org:
 Hey,

 I'd like to remove libGLw from the main Mesa repository.  It never
 changes, and almost noone uses it...because GL and Motif is awesome, right?

 Since Debian still packages it, I pulled it into its own git repository,
 preserving history, and then autotooled it.

 You can get it here:
 git://people.freedesktop.org/~kwg/glw

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

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


[Mesa-dev] [PATCH] intel: Set ctx's drawbuffer according to drawables visual

2011-08-04 Thread Benjamin Franzke
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=39588

egl_dri2 creates contexts with a doubleBufferConfig when PIXMAP and
WINDOW bit is request, so _mesa_init_color sets DrawBuffer[0] to
GL_BACK.
If a pixmap surface is created egl_dri2 will use a single buffer config,
so MakeCurrent has to adjust DrawBuffer[0] to the current drawable.
---
 src/mesa/drivers/dri/intel/intel_context.c |6 ++
 1 files changed, 6 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..0eeffc0 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -970,6 +970,12 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
 readFb = driReadPriv-driverPrivate;
 driContextPriv-dri2.draw_stamp = driDrawPriv-dri2.stamp - 1;
 driContextPriv-dri2.read_stamp = driReadPriv-dri2.stamp - 1;
+
+ if (fb-Visual.doubleBufferMode) {
+intel-ctx.Color.DrawBuffer[0] = GL_BACK;
+ } else {
+intel-ctx.Color.DrawBuffer[0] = GL_FRONT;
+ }
   }
 
   intel_prepare_render(intel);
-- 
1.7.3.4

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


Re: [Mesa-dev] [PATCH] intel: Set ctx's drawbuffer according to drawables visual

2011-08-04 Thread Benjamin Franzke
2011/8/4 Brian Paul bri...@vmware.com:
 On 08/04/2011 06:31 AM, Benjamin Franzke wrote:

 Fixes https://bugs.freedesktop.org/show_bug.cgi?id=39588

 egl_dri2 creates contexts with a doubleBufferConfig when PIXMAP and
 WINDOW bit is request, so _mesa_init_color sets DrawBuffer[0] to
 GL_BACK.
 If a pixmap surface is created egl_dri2 will use a single buffer config,
 so MakeCurrent has to adjust DrawBuffer[0] to the current drawable.
 ---
  src/mesa/drivers/dri/intel/intel_context.c |    6 ++
  1 files changed, 6 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..0eeffc0 100644
 --- a/src/mesa/drivers/dri/intel/intel_context.c
 +++ b/src/mesa/drivers/dri/intel/intel_context.c
 @@ -970,6 +970,12 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
         readFb = driReadPriv-driverPrivate;
         driContextPriv-dri2.draw_stamp = driDrawPriv-dri2.stamp - 1;
         driContextPriv-dri2.read_stamp = driReadPriv-dri2.stamp - 1;
 +
 +         if (fb-Visual.doubleBufferMode) {
 +            intel-ctx.Color.DrawBuffer[0] = GL_BACK;
 +         } else {
 +            intel-ctx.Color.DrawBuffer[0] = GL_FRONT;
 +         }
        }

        intel_prepare_render(intel);

 This doesn't seem right to me.  We shouldn't be changing context state like
 that during a make-current() call.

 During context initialization we call _mesa_init_color() where we set
 ctx-Color.DrawBuffer[0] to either GL_BACK or GL_FRONT depending on the
 visual's double-buffer flag.  You might investigate why that's not doing the
 job.

Yea, I saw that, but the problem is it sets GL_BACK/GL_FRONT depending
on the contexts config,
which may be different from the config used for the drawable (as
described in the commit message).

So mixing configs could be defined as invalid, but its also allowed in
src/mesa/main/context.c:1324

Furthermore st/mesa also modifes the state in make_current, see
st_manager.c:781.

Any ideas where to put it instead?


 -Brian

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


Re: [Mesa-dev] [PATCH] intel: Set ctx's drawbuffer according to drawables visual

2011-08-04 Thread Benjamin Franzke
2011/8/4 Brian Paul bri...@vmware.com:
 On 08/04/2011 07:39 AM, Benjamin Franzke wrote:

 2011/8/4 Brian Paulbri...@vmware.com:

 On 08/04/2011 06:31 AM, Benjamin Franzke wrote:

 Fixes https://bugs.freedesktop.org/show_bug.cgi?id=39588

 egl_dri2 creates contexts with a doubleBufferConfig when PIXMAP and
 WINDOW bit is request, so _mesa_init_color sets DrawBuffer[0] to
 GL_BACK.
 If a pixmap surface is created egl_dri2 will use a single buffer config,
 so MakeCurrent has to adjust DrawBuffer[0] to the current drawable.
 ---
  src/mesa/drivers/dri/intel/intel_context.c |    6 ++
  1 files changed, 6 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..0eeffc0 100644
 --- a/src/mesa/drivers/dri/intel/intel_context.c
 +++ b/src/mesa/drivers/dri/intel/intel_context.c
 @@ -970,6 +970,12 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
         readFb = driReadPriv-driverPrivate;
         driContextPriv-dri2.draw_stamp = driDrawPriv-dri2.stamp - 1;
         driContextPriv-dri2.read_stamp = driReadPriv-dri2.stamp - 1;
 +
 +         if (fb-Visual.doubleBufferMode) {
 +            intel-ctx.Color.DrawBuffer[0] = GL_BACK;
 +         } else {
 +            intel-ctx.Color.DrawBuffer[0] = GL_FRONT;
 +         }
        }

        intel_prepare_render(intel);

 This doesn't seem right to me.  We shouldn't be changing context state
 like
 that during a make-current() call.

 During context initialization we call _mesa_init_color() where we set
 ctx-Color.DrawBuffer[0] to either GL_BACK or GL_FRONT depending on the
 visual's double-buffer flag.  You might investigate why that's not doing
 the
 job.

 Yea, I saw that, but the problem is it sets GL_BACK/GL_FRONT depending
 on the contexts config,
 which may be different from the config used for the drawable (as
 described in the commit message).

 So mixing configs could be defined as invalid, but its also allowed in
 src/mesa/main/context.c:1324

 Furthermore st/mesa also modifes the state in make_current, see
 st_manager.c:781.

 Any ideas where to put it instead?

 OK, I see.  How about doing something like this instead:

 ctx-Color.DrawBuffer[0] = ctx-DrawBuffer-ColorDrawBuffer[0];

 The gl_framebuffer also carries the current drawbuffer state (since
 GL_EXT_framebuffer_object came along).  The framebuffer's state gets set
 upon creation and when glDrawBuffer() is called.

 I think this is the behaviour that I'd expect if I were alternately
 rendering to single and double-buffered windows with one context.

 What do you think?

That looks like the better solution.

I now think its not really the drivers task, to update the contexts
Draw/ReadBuffer,
so I'd put it directly into _mesa_make_current. New patch attached.

Of course this implies that the framebuffer's
ColorDrawBuffer/ColorReadBuffer is setup
properly by all drivers.
So do you think its safe to always copy those over in _mesa_make_current?

Thanks so far.

 BTW, we'd probably want to copy/update all elements of the ColorDrawBuffer[]
 array plus the ColorReadBuffer state.

 -Brian



0001-mesa-Apply-drawables-draw-readbuffers-to-context-in-.patch
Description: Binary data
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl/gallium: fix build without softpipe and llvmpipe

2011-07-27 Thread Benjamin Franzke
Looks good to me too, and since there were no complaints, pushed.
Thanks.

2011/7/25 Tobias Droste tdro...@gmx.de:
 Signed-off-by: Tobias Droste tdro...@gmx.de
 Acked-by: Jakob Bornecrantz wallbra...@gmail.com
 Reviewed-by: Marek Olšák mar...@gmail.com
 ---
  src/gallium/targets/egl-static/Makefile |   12 +---
  1 files changed, 9 insertions(+), 3 deletions(-)

 diff --git a/src/gallium/targets/egl-static/Makefile 
 b/src/gallium/targets/egl-static/Makefile
 index 69e7eec..5b7b330 100644
 --- a/src/gallium/targets/egl-static/Makefile
 +++ b/src/gallium/targets/egl-static/Makefile
 @@ -141,10 +141,18 @@ egl_LIBS += \
        $(TOP)/src/gallium/drivers/svga/libsvga.a
  endif

 -# swrast
 +# softpipe
 +ifneq ($(findstring softpipe,$(GALLIUM_DRIVERS_DIRS)),)
  egl_CPPFLAGS += -DGALLIUM_SOFTPIPE -DGALLIUM_RBUG -DGALLIUM_TRACE
  egl_LIBS += $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
  egl_SYS += -lm
 +endif
 +
 +# llvmpipe
 +ifneq ($(findstring llvmpipe,$(GALLIUM_DRIVERS_DIRS)),)
 +egl_CPPFLAGS += -DGALLIUM_LLVMPIPE
 +egl_LIBS += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
 +endif

  # sort to remove duplicates
  egl_CPPFLAGS := $(sort $(egl_CPPFLAGS))
 @@ -158,8 +166,6 @@ st_GL_SYS := -lm -lpthread $(DLOPEN_LIBS)

  # LLVM
  ifeq ($(MESA_LLVM),1)
 -egl_CPPFLAGS += -DGALLIUM_LLVMPIPE
 -egl_LIBS += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
  egl_SYS += $(LLVM_LIBS)
  LDFLAGS += $(LLVM_LDFLAGS)

 --
 1.7.3.4

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

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


Re: [Mesa-dev] [PATCH 0/8] GBM Graphics Buffer Manager

2011-06-24 Thread Benjamin Franzke
2011/6/24 Chia-I Wu olva...@gmail.com:
 On Fri, Jun 24, 2011 at 8:38 AM, Chia-I Wu olva...@gmail.com wrote:
 On Thu, Jun 23, 2011 at 8:07 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 2011/6/23 Chia-I Wu olva...@gmail.com:
 On Thu, Jun 23, 2011 at 7:46 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 2011/6/23 Chia-I Wu olva...@gmail.com:
 On Wed, Jun 22, 2011 at 10:30 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 Hi List,

 This series adds a graphics buffer management library which is
 targeted to be used as native (drm) platform for egl on kms or openwfd,
 and thus replaces the current mechanism of using a fd as 
 EGLNativeDisplay
 and EGL_MESA_drm_image to create buffers.
 GBM uses the mesas internal dri interface or acts as a gallium state 
 tracker.

 The mapping to EGL types is:

 gbm_device - EGLNativeDisplayType
 gbm_bo     - EGLNativePixmapType / EGL_NATIVE_PIXMAP_KHR

 This integrates better with the idea of EGL, which assumes there is
 some kind of native library thats responsible for allocating buffers.

 We wanted to use libkms, but since that's explicitly designed to no
 support hw renderable buffers we have to go a different route.
 The idea looks good to me in general.  But would it make sense to
 replace st/gbm and targets/gdm by another backend that uses st/xa,
 which is supposed to have a stable ABI, instead (currently only on
 xa_branch)?

 For the reason of a stable ABI we dont need it, since all of gbm is 
 inside mesa.
 Maybe it could be used at some point to ease driver loading/sharing or
 so, dont know,
 but right now I think its easier to just have this small state tracker.
 Since its inside mesa we could change it later if it feels better then.
 Ok.  From a quick look I thought there was gbm_gallium_drm.so which
 loads egl_gallium's pipe drivers.  As the pipe drivers should not
 exist, I'd like to see no external use of them.  Maybe I was wrong.
 Well, thats done, but i think thats not a problem.
 I like to see a general drm-pipe in future, which is used only by
 gallium state-trackers that need to load drivers, like egl, gbm(, xa),
 so no external use.
 I meant external to egl_gallium.  I plan to switch over to
 targets/egl-static for egl_gallium soon, and there will be no
 pipe_*.so anymore.
 Does this patch work for you?  I don't know an easy way to test gbm.


The pipe targets need start/end-group for the libs.
Updated patch attached.

 I'd like to commit it and then remove targets/egl (in favor of
 targets/egl-static) before 7.11 branched.

Oh, since the driver name lookup changed in targets/egl we have to port
that to egl-static target then.
See commit a433755ec5c48088a0d8a340851a1a8be9e58897.


 Another thing I just noticed is that gbm(_dri) is enabled by default
 and depends on --enable-shared-glapi, which is disabled by default.
 They should have the same default.  Since shared glapi solves many
 linking issues, I'd like to see it enabled by default.  But the thing
 is that it changes libGL and the change hasn't really been discussed
 or reviewed.  It should deserve its own thread on the list.

Right, I would prefer shared glapi by default as well.
If we dont get that, we could just remove drm from the default egl platforms,
and so gbm would be disabled by default.




 Benjamin Franzke (8):
  dri: Add dupImage to DRIimageExtension
  intel: Implement DRIimageExtension::dupImage
  st/dri: Implement DRIimageExtension::dupImage
  Add gbm (generic/graphics buffer manager)
  gbm: Add dri backend
  gbm: Add gallium (drm) backend
  egl_dri2: Hookup gbm as drm platform
  st/egl: Hookup gbm for drm backend

  Makefile                                           |   11 +
  configs/autoconf.in                                |   10 +-
  configs/default                                    |   14 +-
  configure.ac                                       |   70 
  include/EGL/eglplatform.h                          |    6 +
  include/GL/internal/dri_interface.h                |    2 +
  src/egl/drivers/dri2/Makefile                      |    2 +
  src/egl/drivers/dri2/egl_dri2.c                    |   76 +++--
  src/egl/drivers/dri2/egl_dri2.h                    |   11 +
  src/egl/drivers/dri2/platform_drm.c                |   99 --
  src/egl/main/Makefile                              |    4 +
  src/gallium/state_trackers/dri/drm/dri2.c          |   19 +
  src/gallium/state_trackers/egl/Makefile            |    3 +-
  src/gallium/state_trackers/egl/common/egl_g3d.c    |   18 +-
  src/gallium/state_trackers/egl/common/native.h     |    3 +
  src/gallium/state_trackers/egl/drm/modeset.c       |   36 ++
  src/gallium/state_trackers/egl/drm/native_drm.c    |   77 ++---
  src/gallium/state_trackers/egl/drm/native_drm.h    |    4 +
  src/gallium/state_trackers/gbm/Makefile            |   46 +++
  src/gallium/state_trackers/gbm/gbm_drm.c           |  225 
  .../state_trackers/gbm/gbm_gallium_drmint.h        |   74 
  src/gallium

Re: [Mesa-dev] [PATCH 0/8] GBM Graphics Buffer Manager

2011-06-23 Thread Benjamin Franzke
2011/6/23 Chia-I Wu olva...@gmail.com:
 On Wed, Jun 22, 2011 at 10:30 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 Hi List,

 This series adds a graphics buffer management library which is
 targeted to be used as native (drm) platform for egl on kms or openwfd,
 and thus replaces the current mechanism of using a fd as EGLNativeDisplay
 and EGL_MESA_drm_image to create buffers.
 GBM uses the mesas internal dri interface or acts as a gallium state tracker.

 The mapping to EGL types is:

 gbm_device - EGLNativeDisplayType
 gbm_bo     - EGLNativePixmapType / EGL_NATIVE_PIXMAP_KHR

 This integrates better with the idea of EGL, which assumes there is
 some kind of native library thats responsible for allocating buffers.

 We wanted to use libkms, but since that's explicitly designed to no
 support hw renderable buffers we have to go a different route.
 The idea looks good to me in general.  But would it make sense to
 replace st/gbm and targets/gdm by another backend that uses st/xa,
 which is supposed to have a stable ABI, instead (currently only on
 xa_branch)?

For the reason of a stable ABI we dont need it, since all of gbm is inside mesa.
Maybe it could be used at some point to ease driver loading/sharing or
so, dont know,
but right now I think its easier to just have this small state tracker.
Since its inside mesa we could change it later if it feels better then.


 Benjamin Franzke (8):
  dri: Add dupImage to DRIimageExtension
  intel: Implement DRIimageExtension::dupImage
  st/dri: Implement DRIimageExtension::dupImage
  Add gbm (generic/graphics buffer manager)
  gbm: Add dri backend
  gbm: Add gallium (drm) backend
  egl_dri2: Hookup gbm as drm platform
  st/egl: Hookup gbm for drm backend

  Makefile                                           |   11 +
  configs/autoconf.in                                |   10 +-
  configs/default                                    |   14 +-
  configure.ac                                       |   70 
  include/EGL/eglplatform.h                          |    6 +
  include/GL/internal/dri_interface.h                |    2 +
  src/egl/drivers/dri2/Makefile                      |    2 +
  src/egl/drivers/dri2/egl_dri2.c                    |   76 +++--
  src/egl/drivers/dri2/egl_dri2.h                    |   11 +
  src/egl/drivers/dri2/platform_drm.c                |   99 --
  src/egl/main/Makefile                              |    4 +
  src/gallium/state_trackers/dri/drm/dri2.c          |   19 +
  src/gallium/state_trackers/egl/Makefile            |    3 +-
  src/gallium/state_trackers/egl/common/egl_g3d.c    |   18 +-
  src/gallium/state_trackers/egl/common/native.h     |    3 +
  src/gallium/state_trackers/egl/drm/modeset.c       |   36 ++
  src/gallium/state_trackers/egl/drm/native_drm.c    |   77 ++---
  src/gallium/state_trackers/egl/drm/native_drm.h    |    4 +
  src/gallium/state_trackers/gbm/Makefile            |   46 +++
  src/gallium/state_trackers/gbm/gbm_drm.c           |  225 
  .../state_trackers/gbm/gbm_gallium_drmint.h        |   74 
  src/gallium/targets/egl/Makefile                   |    2 +-
  src/gallium/targets/gbm/Makefile                   |   32 ++
  src/gallium/targets/gbm/gbm.c                      |   61 
  src/gallium/targets/gbm/pipe_loader.c              |  192 ++
  src/gallium/targets/gbm/pipe_loader.h              |   48 +++
  src/gbm/Makefile                                   |   14 +
  src/gbm/backends/Makefile                          |   14 +
  src/gbm/backends/Makefile.template                 |   65 
  src/gbm/backends/dri/Makefile                      |   22 ++
  src/gbm/backends/dri/driver_name.c                 |   89 +
  src/gbm/backends/dri/gbm_dri.c                     |  377 
 
  src/gbm/backends/dri/gbm_driint.h                  |   78 
  src/gbm/main/Makefile                              |   90 +
  src/gbm/main/backend.c                             |  128 +++
  src/gbm/main/backend.h                             |   36 ++
  src/gbm/main/common.c                              |   88 +
  src/gbm/main/common.h                              |   42 +++
  src/gbm/main/common_drm.h                          |   48 +++
  src/gbm/main/gbm.c                                 |  189 ++
  src/gbm/main/gbm.h                                 |   99 +
  src/gbm/main/gbm.pc.in                             |   12 +
  src/gbm/main/gbmint.h                              |   81 +
  src/mesa/drivers/dri/intel/intel_screen.c          |   27 ++-
  44 files changed, 2536 insertions(+), 108 deletions(-)
  create mode 100644 src/gallium/state_trackers/gbm/Makefile
  create mode 100644 src/gallium/state_trackers/gbm/gbm_drm.c
  create mode 100644 src/gallium/state_trackers/gbm/gbm_gallium_drmint.h
  create mode 100644 src/gallium/targets/gbm/Makefile
  create mode 100644 src/gallium/targets/gbm/gbm.c
  create mode 100644 src/gallium/targets/gbm

Re: [Mesa-dev] [PATCH 0/8] GBM Graphics Buffer Manager

2011-06-23 Thread Benjamin Franzke
2011/6/23 Chia-I Wu olva...@gmail.com:
 On Thu, Jun 23, 2011 at 7:46 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 2011/6/23 Chia-I Wu olva...@gmail.com:
 On Wed, Jun 22, 2011 at 10:30 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 Hi List,

 This series adds a graphics buffer management library which is
 targeted to be used as native (drm) platform for egl on kms or openwfd,
 and thus replaces the current mechanism of using a fd as EGLNativeDisplay
 and EGL_MESA_drm_image to create buffers.
 GBM uses the mesas internal dri interface or acts as a gallium state 
 tracker.

 The mapping to EGL types is:

 gbm_device - EGLNativeDisplayType
 gbm_bo     - EGLNativePixmapType / EGL_NATIVE_PIXMAP_KHR

 This integrates better with the idea of EGL, which assumes there is
 some kind of native library thats responsible for allocating buffers.

 We wanted to use libkms, but since that's explicitly designed to no
 support hw renderable buffers we have to go a different route.
 The idea looks good to me in general.  But would it make sense to
 replace st/gbm and targets/gdm by another backend that uses st/xa,
 which is supposed to have a stable ABI, instead (currently only on
 xa_branch)?

 For the reason of a stable ABI we dont need it, since all of gbm is inside 
 mesa.
 Maybe it could be used at some point to ease driver loading/sharing or
 so, dont know,
 but right now I think its easier to just have this small state tracker.
 Since its inside mesa we could change it later if it feels better then.
 Ok.  From a quick look I thought there was gbm_gallium_drm.so which
 loads egl_gallium's pipe drivers.  As the pipe drivers should not
 exist, I'd like to see no external use of them.  Maybe I was wrong.

Well, thats done, but i think thats not a problem.
I like to see a general drm-pipe in future, which is used only by
gallium state-trackers that need to load drivers, like egl, gbm(, xa),
so no external use.


 Benjamin Franzke (8):
  dri: Add dupImage to DRIimageExtension
  intel: Implement DRIimageExtension::dupImage
  st/dri: Implement DRIimageExtension::dupImage
  Add gbm (generic/graphics buffer manager)
  gbm: Add dri backend
  gbm: Add gallium (drm) backend
  egl_dri2: Hookup gbm as drm platform
  st/egl: Hookup gbm for drm backend

  Makefile                                           |   11 +
  configs/autoconf.in                                |   10 +-
  configs/default                                    |   14 +-
  configure.ac                                       |   70 
  include/EGL/eglplatform.h                          |    6 +
  include/GL/internal/dri_interface.h                |    2 +
  src/egl/drivers/dri2/Makefile                      |    2 +
  src/egl/drivers/dri2/egl_dri2.c                    |   76 +++--
  src/egl/drivers/dri2/egl_dri2.h                    |   11 +
  src/egl/drivers/dri2/platform_drm.c                |   99 --
  src/egl/main/Makefile                              |    4 +
  src/gallium/state_trackers/dri/drm/dri2.c          |   19 +
  src/gallium/state_trackers/egl/Makefile            |    3 +-
  src/gallium/state_trackers/egl/common/egl_g3d.c    |   18 +-
  src/gallium/state_trackers/egl/common/native.h     |    3 +
  src/gallium/state_trackers/egl/drm/modeset.c       |   36 ++
  src/gallium/state_trackers/egl/drm/native_drm.c    |   77 ++---
  src/gallium/state_trackers/egl/drm/native_drm.h    |    4 +
  src/gallium/state_trackers/gbm/Makefile            |   46 +++
  src/gallium/state_trackers/gbm/gbm_drm.c           |  225 
  .../state_trackers/gbm/gbm_gallium_drmint.h        |   74 
  src/gallium/targets/egl/Makefile                   |    2 +-
  src/gallium/targets/gbm/Makefile                   |   32 ++
  src/gallium/targets/gbm/gbm.c                      |   61 
  src/gallium/targets/gbm/pipe_loader.c              |  192 ++
  src/gallium/targets/gbm/pipe_loader.h              |   48 +++
  src/gbm/Makefile                                   |   14 +
  src/gbm/backends/Makefile                          |   14 +
  src/gbm/backends/Makefile.template                 |   65 
  src/gbm/backends/dri/Makefile                      |   22 ++
  src/gbm/backends/dri/driver_name.c                 |   89 +
  src/gbm/backends/dri/gbm_dri.c                     |  377 
 
  src/gbm/backends/dri/gbm_driint.h                  |   78 
  src/gbm/main/Makefile                              |   90 +
  src/gbm/main/backend.c                             |  128 +++
  src/gbm/main/backend.h                             |   36 ++
  src/gbm/main/common.c                              |   88 +
  src/gbm/main/common.h                              |   42 +++
  src/gbm/main/common_drm.h                          |   48 +++
  src/gbm/main/gbm.c                                 |  189 ++
  src/gbm/main/gbm.h                                 |   99 +
  src/gbm/main/gbm.pc.in

[Mesa-dev] [PATCH] r600g: Add R8G8B8A8_UNORM to evergreen colorswap table

2011-06-23 Thread Benjamin Franzke
Fixes broken glTexImage2D with format=GL_RGBA since
1a339b6c71ebab6e1a64f05b2e133022d3bbcd15

The origin for this behaviour is that r600_is_format_supported
checks only against r600_state_inline.h tables not evergreens.
---
 src/gallium/drivers/r600/eg_state_inlines.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/r600/eg_state_inlines.h 
b/src/gallium/drivers/r600/eg_state_inlines.h
index f889178..af2ec56 100644
--- a/src/gallium/drivers/r600/eg_state_inlines.h
+++ b/src/gallium/drivers/r600/eg_state_inlines.h
@@ -343,6 +343,7 @@ static inline uint32_t r600_translate_colorswap(enum 
pipe_format format)
case PIPE_FORMAT_X8R8G8B8_UNORM:
return V_028C70_SWAP_ALT_REV;
case PIPE_FORMAT_R8G8B8A8_SNORM:
+   case PIPE_FORMAT_R8G8B8A8_UNORM:
case PIPE_FORMAT_R8G8B8X8_UNORM:
return V_028C70_SWAP_STD;
 
-- 
1.7.3.4

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


Re: [Mesa-dev] [PATCH] st/dri: Invalidate drawables on context switch

2011-06-21 Thread Benjamin Franzke
Actually I wasnt sure, but theres nothing like that in glx/dri2_glx.c
or egl_dri2.
Furthermore the intel driver does sth similar.

2011/6/21 Jakob Bornecrantz wallbra...@gmail.com:
 On Tue, Jun 21, 2011 at 1:32 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 ---
  .../state_trackers/dri/common/dri_context.c        |    5 +
  1 files changed, 5 insertions(+), 0 deletions(-)

 diff --git a/src/gallium/state_trackers/dri/common/dri_context.c 
 b/src/gallium/state_trackers/dri/common/dri_context.c
 index e23c1bc..0f9e4e5 100644
 --- a/src/gallium/state_trackers/dri/common/dri_context.c
 +++ b/src/gallium/state_trackers/dri/common/dri_context.c
 @@ -192,6 +192,11 @@ dri_make_current(__DRIcontext * cPriv,
    }

    ctx-stapi-make_current(ctx-stapi, ctx-st, draw-base, read-base);
 +   if (old_st  old_st != ctx-st) {
 +      ctx-st-notify_invalid_framebuffer(ctx-st, draw-base);
 +      if (draw != read)
 +         ctx-st-notify_invalid_framebuffer(ctx-st, read-base);
 +   }

 Shouldn't the client api state tracker be smart enough to do this in
 the make_current call?

 Cheers Jakob.

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


Re: [Mesa-dev] [PATCH] st/dri: Invalidate drawables on context switch

2011-06-21 Thread Benjamin Franzke
This fixes gears from the wayland-demos, where the cairo-gl context
and the gears context render to the same surface, but the gears
context renders to old buffers, because of the missing invalidate.
So yea, fixes a bug.

2011/6/21 Jakob Bornecrantz wallbra...@gmail.com:
 On Tue, Jun 21, 2011 at 1:40 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 Actually I wasnt sure, but theres nothing like that in glx/dri2_glx.c
 or egl_dri2.
 Furthermore the intel driver does sth similar.

 I was talking about st/mesa (GL), I'm not to familiar with the
 st_manager.c and/or the drawable code but doesn't this happen already
 or does this fix a bug?

 Cheers Jakob.

 2011/6/21 Jakob Bornecrantz wallbra...@gmail.com:
 On Tue, Jun 21, 2011 at 1:32 PM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 ---
  .../state_trackers/dri/common/dri_context.c        |    5 +
  1 files changed, 5 insertions(+), 0 deletions(-)

 diff --git a/src/gallium/state_trackers/dri/common/dri_context.c 
 b/src/gallium/state_trackers/dri/common/dri_context.c
 index e23c1bc..0f9e4e5 100644
 --- a/src/gallium/state_trackers/dri/common/dri_context.c
 +++ b/src/gallium/state_trackers/dri/common/dri_context.c
 @@ -192,6 +192,11 @@ dri_make_current(__DRIcontext * cPriv,
    }

    ctx-stapi-make_current(ctx-stapi, ctx-st, draw-base, read-base);
 +   if (old_st  old_st != ctx-st) {
 +      ctx-st-notify_invalid_framebuffer(ctx-st, draw-base);
 +      if (draw != read)
 +         ctx-st-notify_invalid_framebuffer(ctx-st, read-base);
 +   }

 Shouldn't the client api state tracker be smart enough to do this in
 the make_current call?

 Cheers Jakob.



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


Re: [Mesa-dev] [PATCH] mapi: Fix tls with shared/es-glapi on x86-64

2011-06-08 Thread Benjamin Franzke
2011/6/7 Chia-I Wu olva...@gmail.com:
 How is that the case?  It seems the symbol is not used elsewhere.


Right, seems i tried solve the wrong side of the problem.

x86_64_entry_start is declared similar to a global static variable in
the asm code,
so it will be bound local.
But in entry_get_public its declared as extern, the compiler will generate code
to lookup a global object, not a local.
By declaring x86_64_entry_start as static the correct local address is
loaded here.

Patch attached.
From 7ca323bf472004066f35dbec51791c90a671a42e Mon Sep 17 00:00:00 2001
From: Benjamin Franzke benjaminfran...@googlemail.com
Date: Wed, 8 Jun 2011 15:50:25 +0200
Subject: [PATCH] mapi: Fix tls with shared/es-glapi on x86-64

x86_64_entry_start needs to be declared static in the C code,
in order to have the correct address in entry_get_public
(seems not to be needed on x86).

The compiler needs to lookup a local not a global object.

Otherwise addresses needed for _glapi_proc_address will be computed
from some random offset (0x6400229a61058b48 in my case).

Do the same for x86_64_current_tls.
---
 src/mapi/mapi/entry_x86-64_tls.h |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mapi/mapi/entry_x86-64_tls.h b/src/mapi/mapi/entry_x86-64_tls.h
index d3b606c..95dffcc 100644
--- a/src/mapi/mapi/entry_x86-64_tls.h
+++ b/src/mapi/mapi/entry_x86-64_tls.h
@@ -65,7 +65,7 @@ __asm__(x86_64_current_tls:\n\t
 	movq  ENTRY_CURRENT_TABLE @GOTTPOFF(%rip), %rax\n\t
 	ret);
 
-extern unsigned long
+static unsigned long
 x86_64_current_tls();
 
 #include string.h
@@ -76,10 +76,12 @@ entry_patch_public(void)
 {
 }
 
+static char
+x86_64_entry_start[];
+
 mapi_func
 entry_get_public(int slot)
 {
-   extern char x86_64_entry_start[];
return (mapi_func) (x86_64_entry_start + slot * 32);
 }
 
-- 
1.7.3.4

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


[Mesa-dev] [PATCH] mapi: Fix tls with shared/es-glapi on x86-64

2011-06-07 Thread Benjamin Franzke
x86_64_entry_start needs to be bound global, in order to have the
correct address in entry_get_public (seems not to be needed on x86).

Otherwise addresses needed for _glapi_proc_address will be computed
from some random offset (0x6400229a61058b48 in my case).
---
 src/mapi/mapi/entry_x86-64_tls.h |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mapi/mapi/entry_x86-64_tls.h b/src/mapi/mapi/entry_x86-64_tls.h
index d3b606c..dad596a 100644
--- a/src/mapi/mapi/entry_x86-64_tls.h
+++ b/src/mapi/mapi/entry_x86-64_tls.h
@@ -28,6 +28,12 @@
 
 #include u_macros.h
 
+#ifdef __GNUC__
+#  define HIDDEN(x) .hidden  U_STRINGIFY(x) \n
+#else
+#  define HIDDEN(x)
+#endif
+
 #ifdef __linux__
 __asm__(.section .note.ABI-tag, \a\\n\t
 .p2align 2\n\t
@@ -43,6 +49,8 @@ __asm__(.section .note.ABI-tag, \a\\n\t
 
 __asm__(.text\n
 .balign 32\n
+.globl x86_64_entry_start\n
+HIDDEN(x86_64_entry_start)
 x86_64_entry_start:);
 
 #define STUB_ASM_ENTRY(func) \
-- 
1.7.3.4

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


Re: [Mesa-dev] [PATCH 0/6] Per driver pci id lists

2011-06-06 Thread Benjamin Franzke
Well radeon_drm_public.h declares radeon_drm_winsys_create(),
but yea is_r3xx should be replaced.
Patch attached.

2011/6/6 Alex Deucher alexdeuc...@gmail.com:
 On Mon, Jun 6, 2011 at 11:49 AM, Benjamin Franzke
 benjaminfran...@googlemail.com wrote:
 We need pci id to driver-name mapping for drm and
 wayland platforms in egl_dri2 and egl_gallium.

 egl_dri2 holds a own list, which is redundant with the information
 thats already stored in the drivers.
 egl_gallium uses the kernel name, which is not always the
 actual 3d driver name (e.g. radeon - r300 || r600)

 To follow the egl_dri2 approach this patchset adds some generic
 macro-based per driver lists to the drivers.
 Every driver can have its own set of additional arguments in the macros.
 A driver list just needs to be included in
 src/egl/drivers/dri2/pci_ids.h with the appropriate CHIPSET definition.

 Hope this suits the need for driver loaders, but also driver implementations.

 Benjamin Franzke (6):
  Add i915  i965 pci id lists
  Add radeon pci id lists
  egl_dri2: Use external driver pci list
  targets/egl: Support driver name lookup using pci lists
  radeon: Use pciid list to generate PCI_CHIP_FAMILY_ID defines
  r600g: Use radeon pciid list for the family lookup table

 For completeness sake, it would be nice to convert r300g to use
 r300_pci_ids.h and remove is_r3xx() and hence radeon_drm_public.h.

 Alex


  src/egl/drivers/dri2/Makefile                      |    2 +-
  src/egl/drivers/dri2/common.c                      |  110 
  src/egl/drivers/dri2/egl_dri2.h                    |    2 +
  src/egl/drivers/dri2/pci_ids.h                     |   62 ++
  src/egl/drivers/dri2/platform_drm.c                |  663 
 +---
  src/gallium/state_trackers/egl/drm/native_drm.c    |   33 +-
  .../state_trackers/egl/wayland/native_drm.c        |   40 +--
  src/gallium/targets/egl/egl.c                      |   80 +++-
  src/gallium/targets/egl/pci_ids.h                  |    1 +
  src/gallium/winsys/r600/drm/Makefile               |    1 +
  src/gallium/winsys/r600/drm/radeon_pciid.c         |  486 +--
  src/mesa/drivers/dri/intel/i915_pci_ids.h          |   19 +
  src/mesa/drivers/dri/intel/i965_pci_ids.h          |   27 +
  src/mesa/drivers/dri/radeon/r200_pci_ids.h         |   22 +
  src/mesa/drivers/dri/radeon/r300_pci_ids.h         |  218 +++
  src/mesa/drivers/dri/radeon/r600_pci_ids.h         |  261 
  src/mesa/drivers/dri/radeon/radeon_chipset.h       |  499 +---
  src/mesa/drivers/dri/radeon/radeon_pci_ids.h       |   23 +
  18 files changed, 843 insertions(+), 1706 deletions(-)
  create mode 100644 src/egl/drivers/dri2/common.c
  create mode 100644 src/egl/drivers/dri2/pci_ids.h
  create mode 12 src/gallium/targets/egl/pci_ids.h
  create mode 100644 src/mesa/drivers/dri/intel/i915_pci_ids.h
  create mode 100644 src/mesa/drivers/dri/intel/i965_pci_ids.h
  create mode 100644 src/mesa/drivers/dri/radeon/r200_pci_ids.h
  create mode 100644 src/mesa/drivers/dri/radeon/r300_pci_ids.h
  create mode 100644 src/mesa/drivers/dri/radeon/r600_pci_ids.h
  create mode 100644 src/mesa/drivers/dri/radeon/radeon_pci_ids.h

 --
 1.7.3.4

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


From b838f6c4eeb47cd8e9ff9c7776250dba303cba40 Mon Sep 17 00:00:00 2001
From: Benjamin Franzke benjaminfran...@googlemail.com
Date: Mon, 6 Jun 2011 18:31:12 +0200
Subject: [PATCH] r300g: Remove is_r3xx

Use r300_pci_ids.h instead.
---
 src/gallium/winsys/radeon/drm/Makefile|3 +-
 src/gallium/winsys/radeon/drm/radeon_drm_public.h |  212 -
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.c |9 +-
 3 files changed, 9 insertions(+), 215 deletions(-)

diff --git a/src/gallium/winsys/radeon/drm/Makefile b/src/gallium/winsys/radeon/drm/Makefile
index d44b7c1..66b39de 100644
--- a/src/gallium/winsys/radeon/drm/Makefile
+++ b/src/gallium/winsys/radeon/drm/Makefile
@@ -9,7 +9,8 @@ C_SOURCES = \
 	radeon_drm_cs.c \
 	radeon_drm_winsys.c
 
-LIBRARY_INCLUDES = $(shell pkg-config libdrm --cflags-only-I)
+LIBRARY_INCLUDES = -I$(TOP)/src/mesa/drivers/dri/ \
+		   $(shell pkg-config libdrm --cflags-only-I)
 
 include ../../../Makefile.template
 
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_public.h b/src/gallium/winsys/radeon/drm/radeon_drm_public.h
index 76d9dda..4fc62f1 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_public.h
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_public.h
@@ -7,216 +7,4 @@ struct radeon_winsys;
 
 struct radeon_winsys *radeon_drm_winsys_create(int fd);
 
-static INLINE boolean is_r3xx(int pciid)
-{
-  switch (pciid) {
-  case 0x4144: /* PCI_CHIP_R300_AD */
-  case 0x4145: /* PCI_CHIP_R300_AE */
-  case 0x4146: /* PCI_CHIP_R300_AF */
-  case 0x4147: /* PCI_CHIP_R300_AG */
-  case 0x4E44: /* PCI_CHIP_R300_ND */
-  case

Re: [Mesa-dev] [PATCH 0/6] Per driver pci id lists

2011-06-06 Thread Benjamin Franzke
2011/6/6 Alex Deucher alexdeuc...@gmail.com:
 Looks good.  Thanks.  Overall the patch set looks fine to me.  I agree
 with Marek that it might be better to put the pci ids together
 somewhere.  For the series:

 Reviewed-by: Alex Deucher alexdeuc...@gmail.com

Ok, moved the lists into include/pci_ids/, hope thats ok.

Updated patch series is available at:
http://cgit.freedesktop.org/~bnf/mesa/log/?h=pciids-2
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/6] Per driver pci id lists

2011-06-06 Thread Benjamin Franzke
2011/6/6 Alex Deucher alexdeuc...@gmail.com:
 Sorry, I just thought of one tricky situation.  Only r600g supports
 CAYMAN asics, so r600c shouldn't have the CAYMAN pci ids.  Maybe just
 split the CAYMAN ids out into a new header, cayman_pci_ids.h, and
 include both r600_pci_ids.h and cayman_pci_ids.h in r600g and only
 r600_pci_ids.h in r600c.

Ok, updated. Cayman ids are only set when RADEON_CLASSIC is not defined.


 Alex

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


Re: [Mesa-dev] [PATCH 1/6] Add i915 i965 pci id lists

2011-06-06 Thread Benjamin Franzke
2011/6/6 Eric Anholt e...@anholt.net:
 These 4 chipsets aren't part of the i915 driver.

 Other than that, thanks for taking this on!  Looks like much more
 sanity, and we've talked about using something like the third argument
 to avoid some of the if trees we've got around.


Ok, thanks updated.
If there are no more objections, i'lll ask Kristian to push the series tomorrow.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] st/dri: Support dri2 useflags in dri2_create_image

2011-05-13 Thread Benjamin Franzke
---
 src/gallium/state_trackers/dri/drm/dri2.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/dri/drm/dri2.c 
b/src/gallium/state_trackers/dri/drm/dri2.c
index 30326a2..e471e8e 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -481,6 +481,15 @@ dri2_create_image(__DRIscreen *_screen,
enum pipe_format pf;
 
tex_usage = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
+   if (use  __DRI_IMAGE_USE_SCANOUT)
+  tex_usage |= PIPE_BIND_SCANOUT;
+   if (use  __DRI_IMAGE_USE_SHARE)
+  tex_usage |= PIPE_BIND_SHARED;
+   if (use  __DRI_IMAGE_USE_CURSOR) {
+  if (width != 64 || height != 64)
+ return NULL;
+  tex_usage |= PIPE_BIND_CURSOR;
+   }
 
switch (format) {
case __DRI_IMAGE_FORMAT_RGB565:
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 2/3] st/egl: Add support for EGL_DRM_BUFFER_USE_CURSOR_MESA

2011-05-13 Thread Benjamin Franzke
---
 .../state_trackers/egl/common/egl_g3d_image.c  |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.c 
b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
index e1c8316..34bb92c 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
@@ -122,6 +122,11 @@ egl_g3d_create_drm_buffer(_EGLDisplay *dpy, _EGLImage *img,
   templ.bind |= PIPE_BIND_SCANOUT;
if (attrs.DRMBufferUseMESA  EGL_DRM_BUFFER_USE_SHARE_MESA)
   templ.bind |= PIPE_BIND_SHARED;
+   if (attrs.DRMBufferUseMESA  EGL_DRM_BUFFER_USE_CURSOR_MESA) {
+  if (attrs.Width != 64 || attrs.Height != 64)
+ return NULL;
+  templ.bind |= PIPE_BIND_CURSOR;
+   }
 
return screen-resource_create(screen, templ);
 }
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 3/3] r600g: Add support for PIPE_BIND_CURSOR

2011-05-13 Thread Benjamin Franzke
---
If these checks are not sufficent see this as feature request. :)

---
 src/gallium/drivers/r600/r600_texture.c |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_texture.c 
b/src/gallium/drivers/r600/r600_texture.c
index 7ffea69..2cf75be 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -86,7 +86,8 @@ unsigned r600_texture_get_offset(struct r600_resource_texture 
*rtex,
 
 static unsigned r600_get_block_alignment(struct pipe_screen *screen,
 enum pipe_format format,
-unsigned array_mode)
+unsigned array_mode,
+unsigned bind)
 {
struct r600_screen* rscreen = (struct r600_screen *)screen;
unsigned pixsize = util_format_get_blocksize(format);
@@ -107,7 +108,10 @@ static unsigned r600_get_block_alignment(struct 
pipe_screen *screen,
break;
case V_038000_ARRAY_LINEAR_GENERAL:
default:
-   p_align = rscreen-tiling_info-group_bytes / pixsize;
+   if (bind  PIPE_BIND_CURSOR)
+   p_align = 64;
+   else
+   p_align = rscreen-tiling_info-group_bytes / pixsize;
break;
}
return p_align;
@@ -141,7 +145,7 @@ static unsigned r600_get_base_alignment(struct pipe_screen 
*screen,
 {
struct r600_screen* rscreen = (struct r600_screen *)screen;
unsigned pixsize = util_format_get_blocksize(format);
-   int p_align = r600_get_block_alignment(screen, format, array_mode);
+   int p_align = r600_get_block_alignment(screen, format, array_mode, 0);
int h_align = r600_get_height_alignment(screen, array_mode);
int b_align;
 
@@ -184,7 +188,8 @@ static unsigned r600_texture_get_nblocksx(struct 
pipe_screen *screen,
nblocksx = util_format_get_nblocksx(ptex-format, width);
 
block_align = r600_get_block_alignment(screen, ptex-format,
- rtex-array_mode[level]);
+  rtex-array_mode[level],
+  ptex-bind);
nblocksx = align(nblocksx, block_align);
return nblocksx;
 }
@@ -222,7 +227,7 @@ static void r600_texture_set_array_mode(struct pipe_screen 
*screen,
unsigned w, h, tile_height, tile_width;
 
tile_height = r600_get_height_alignment(screen, array_mode);
-   tile_width = r600_get_block_alignment(screen, ptex-format, 
array_mode);
+   tile_width = r600_get_block_alignment(screen, ptex-format, 
array_mode, ptex-bind);
 
w = mip_minify(ptex-width0, level);
h = mip_minify(ptex-height0, level);
@@ -416,7 +421,7 @@ struct pipe_resource *r600_texture_create(struct 
pipe_screen *screen,
 
if (force_tiling  permit_hardware_blit(screen, templ)) {
if (!(templ-flags  R600_RESOURCE_FLAG_TRANSFER) 
-   !(templ-bind  PIPE_BIND_SCANOUT)) {
+   !(templ-bind  (PIPE_BIND_SCANOUT | PIPE_BIND_CURSOR))) {
array_mode = V_038000_ARRAY_2D_TILED_THIN1;
}
}
-- 
1.7.3.4

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


[Mesa-dev] [PATCH] st/egl: Implement EGL_WL_bind_wayland_display for x11, drm, wayland

2011-05-06 Thread Benjamin Franzke
 = egl_g3d_create_drm_image;
drv-API.ExportDRMImageMESA = egl_g3d_export_drm_image;
 #endif
+#ifdef EGL_WL_bind_wayland_display
+   drv-API.BindWaylandDisplayWL = egl_g3d_bind_wayland_display_wl;
+   drv-API.UnbindWaylandDisplayWL = egl_g3d_unbind_wayland_display_wl;
+
+#endif
 
 #ifdef EGL_KHR_reusable_sync
drv-API.CreateSyncKHR = egl_g3d_create_sync;
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.c 
b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
index e1c8316..210b8c2 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
@@ -179,6 +179,27 @@ egl_g3d_reference_drm_buffer(_EGLDisplay *dpy, EGLint name,
 
 #endif /* EGL_MESA_drm_image */
 
+#ifdef EGL_WL_bind_wayland_display
+
+static struct pipe_resource *
+egl_g3d_reference_wl_buffer(_EGLDisplay *dpy, struct wl_buffer *buffer,
+_EGLImage *img, const EGLint *attribs)
+{
+   struct egl_g3d_display *gdpy = egl_g3d_display(dpy);
+   struct pipe_resource *resource = NULL, *tmp = NULL;
+
+   if (!gdpy-native-wayland_bufmgr)
+  return NULL;
+
+   tmp = gdpy-native-wayland_bufmgr-buffer_get_resource(gdpy-native, 
buffer);
+
+   pipe_resource_reference(resource, tmp);
+
+   return resource;
+}
+
+#endif /* EGL_WL_bind_wayland_display */
+
 _EGLImage *
 egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
  EGLenum target, EGLClientBuffer buffer,
@@ -210,6 +231,12 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLContext *ctx,
 (EGLint) buffer, gimg-base, attribs);
   break;
 #endif
+#ifdef EGL_WL_bind_wayland_display
+   case EGL_WAYLAND_BUFFER_WL:
+  ptex = egl_g3d_reference_wl_buffer(dpy,
+(struct wl_buffer *) buffer, gimg-base, attribs);
+  break;
+#endif
default:
   ptex = NULL;
   break;
diff --git a/src/gallium/state_trackers/egl/common/native.h 
b/src/gallium/state_trackers/egl/common/native.h
index 9246f8c..8646e52 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -40,6 +40,7 @@ extern C {
 
 #include native_buffer.h
 #include native_modeset.h
+#include native_wayland_bufmgr.h
 
 /**
  * Only color buffers are listed.  The others are allocated privately through,
@@ -198,6 +199,7 @@ struct native_display {
 
const struct native_display_buffer *buffer;
const struct native_display_modeset *modeset;
+   const struct native_display_wayland_bufmgr *wayland_bufmgr;
 };
 
 /**
diff --git a/src/gallium/state_trackers/egl/common/native_wayland_bufmgr.h 
b/src/gallium/state_trackers/egl/common/native_wayland_bufmgr.h
new file mode 100644
index 000..b29fd15
--- /dev/null
+++ b/src/gallium/state_trackers/egl/common/native_wayland_bufmgr.h
@@ -0,0 +1,46 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.11
+ *
+ * Copyright (C) 2011 Benjamin Franzke benjaminfran...@googlemail.com
+ *
+ * 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.
+ */
+
+#ifndef _NATIVE_WAYLAND_BUFMGR_H_
+#define _NATIVE_WAYLAND_BUFMGR_H_
+
+struct native_display;
+struct wl_display;
+struct wl_buffer;
+struct pipe_resource;
+
+struct native_display_wayland_bufmgr {
+   boolean (*bind_display)(struct native_display *ndpy,
+   struct wl_display *wl_dpy);
+
+   boolean (*unbind_display)(struct native_display *ndpy,
+ struct wl_display *wl_dpy);
+
+   struct pipe_resource *(*buffer_get_resource)(struct native_display *ndpy,
+struct wl_buffer *buffer);
+ 
+};
+
+#endif /* _NATIVE_WAYLAND_BUFMGR_H_ */
diff --git 
a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c 
b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c
new file mode 100644
index 000..bc2cee4
--- /dev/null
+++ b/src/gallium/state_trackers/egl/common

Re: [Mesa-dev] [PATCH] gallium/xorg st/nv50/i915: add PIPE_BIND_CURSOR

2011-05-02 Thread Benjamin Franzke
I think in i915g the CURSOR flag should be used in i9x5_scanout_layout
for the special case for cursors as well, instead of only checking
only pt-width0 == 64  pt-height0 == 64.

2011/5/2 Daniel Vetter dan...@ffwll.ch:
 On Sun, May 1, 2011 at 11:59 PM, Marcin Slusarz
 marcin.slus...@gmail.com wrote:
 We need to distinguish surfaces for mouse cursors from scanouts, because nv50
 hardware display engine ignores tiling flags.
 i915 seems to have similar needs, so fix it too.

 For the i915g part:
 Acked-by: Daniel Vetter daniel.vet...@ffwll.ch
 --
 Daniel Vetter
 daniel.vet...@ffwll.ch - +41 (0) 79 364 57 48 - http://blog.ffwll.ch
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev

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


[Mesa-dev] [PATCH] st/mesa: Fix surfaceless opengl with non-dummy contexts

2011-02-08 Thread Benjamin Franzke
main/context.c:check_complatible() detecs an incomplete
framebuffer using its pointer, so do not copy it.

This should fix https://bugs.freedesktop.org/show_bug.cgi?id=34042
---
 src/mesa/state_tracker/st_manager.c |   15 +--
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index 179e5dc..17e11ec 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -426,19 +426,13 @@ st_framebuffer_create(struct st_framebuffer_iface *stfbi)
struct gl_config mode;
gl_buffer_index idx;
 
+   if (!stfbi)
+  return NULL;
+
stfb = CALLOC_STRUCT(st_framebuffer);
if (!stfb)
   return NULL;
 
-   /* for FBO-only context */
-   if (!stfbi) {
-  struct gl_framebuffer *base = _mesa_get_incomplete_framebuffer();
-
-  stfb-Base = *base;
-
-  return stfb;
-   }
-
st_visual_to_context_mode(stfbi-visual, mode);
_mesa_initialize_window_framebuffer(stfb-Base, mode);
 
@@ -764,7 +758,8 @@ st_api_make_current(struct st_api *stapi, struct 
st_context_iface *stctxi,
  ret = _mesa_make_current(st-ctx, stdraw-Base, stread-Base);
   }
   else {
- ret = FALSE;
+ struct gl_framebuffer *incomplete = 
_mesa_get_incomplete_framebuffer();
+ ret = _mesa_make_current(st-ctx, incomplete, incomplete);
   }
 
   st_framebuffer_reference(stdraw, NULL);
-- 
1.7.3.4

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


[Mesa-dev] Add wayland EGL platform

2011-02-04 Thread Benjamin Franzke
Hi Mesa List,

This patch series add a egl wayland platform.
A helper library was needed in order to provide native types
for the egl routines.
The types are used to cache wayland events but also to
create an interface for the application, e.g. for resizing.

The library header will be provided by wayland, as it defines
what vendors have to implement.
It is available here (and will be pushed to wayland)
 
http://cgit.freedesktop.org/~bnf/wayland/diff/wayland/wayland-egl.h?h=wayland-egl

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


[Mesa-dev] [PATCH 01/11] Add dri2::{Allocate, Release}Buffer extension

2011-02-04 Thread Benjamin Franzke
---
 include/GL/internal/dri_interface.h|8 
 src/mesa/drivers/dri/common/dri_util.c |   20 +++-
 src/mesa/drivers/dri/common/dri_util.h |6 ++
 3 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 0351526..2fb729a 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -786,6 +786,14 @@ struct __DRIdri2ExtensionRec {
   const __DRIconfig *config,
   __DRIcontext *shared,
   void *data);
+
+   __DRIbuffer *(*allocateBuffer)(__DRIscreen *screen,
+ unsigned int attachment,
+ unsigned int format,
+ int width,
+ int height);
+   void (*releaseBuffer)(__DRIscreen *screen,
+__DRIbuffer *buffer);
 };
 
 
diff --git a/src/mesa/drivers/dri/common/dri_util.c 
b/src/mesa/drivers/dri/common/dri_util.c
index bf8cf6e..82638fa 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -481,6 +481,22 @@ dri2CreateNewDrawable(__DRIscreen *screen,
 return pdraw;
 }
 
+static __DRIbuffer *
+dri2AllocateBuffer(__DRIscreen *screen,
+  unsigned int attachment, unsigned int format,
+  int width, int height)
+{
+return (*screen-DriverAPI.AllocateBuffer)(screen, attachment, format,
+  width, height);
+}
+
+static void
+dri2ReleaseBuffer(__DRIscreen *screen, __DRIbuffer *buffer)
+{
+   (*screen-DriverAPI.ReleaseBuffer)(screen, buffer);
+}
+
+
 static int
 dri2ConfigQueryb(__DRIscreen *screen, const char *var, GLboolean *val)
 {
@@ -930,7 +946,9 @@ const __DRIdri2Extension driDRI2Extension = {
 dri2CreateNewDrawable,
 dri2CreateNewContext,
 dri2GetAPIMask,
-dri2CreateNewContextForAPI
+dri2CreateNewContextForAPI,
+dri2AllocateBuffer,
+dri2ReleaseBuffer
 };
 
 const __DRI2configQueryExtension dri2ConfigQueryExtension = {
diff --git a/src/mesa/drivers/dri/common/dri_util.h 
b/src/mesa/drivers/dri/common/dri_util.h
index b99..3d3d5c9 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -223,6 +223,12 @@ struct __DriverAPIRec {
 
 /* DRI2 Entry point */
 const __DRIconfig **(*InitScreen2) (__DRIscreen * priv);
+
+__DRIbuffer *(*AllocateBuffer) (__DRIscreen *screenPrivate,
+   unsigned int attachment,
+   unsigned int format,
+   int width, int height);
+void (*ReleaseBuffer) (__DRIscreen *screenPrivate, __DRIbuffer *buffer);
 };
 
 extern const struct __DriverAPIRec driDriverAPI;
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 02/11] st/dri: Implement dri2::{Allocate, Release}Buffer

2011-02-04 Thread Benjamin Franzke
---
 src/gallium/state_trackers/dri/drm/dri2.c|   89 ++
 src/gallium/state_trackers/dri/drm/dri2_buffer.h |   22 ++
 2 files changed, 111 insertions(+), 0 deletions(-)
 create mode 100644 src/gallium/state_trackers/dri/drm/dri2_buffer.h

diff --git a/src/gallium/state_trackers/dri/drm/dri2.c 
b/src/gallium/state_trackers/dri/drm/dri2.c
index a9d05a8..be740ad 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -38,6 +38,7 @@
 #include dri_screen.h
 #include dri_context.h
 #include dri_drawable.h
+#include dri2_buffer.h
 
 /**
  * DRI2 flush extension.
@@ -259,6 +260,91 @@ dri2_drawable_process_buffers(struct dri_drawable 
*drawable,
memcpy(drawable-old, buffers, sizeof(__DRIbuffer) * count);
 }
 
+static __DRIbuffer *
+dri2_allocate_buffer(__DRIscreen *sPriv,
+ unsigned attachment, unsigned format,
+ int width, int height)
+{
+   struct dri_screen *screen = dri_screen(sPriv);
+   struct dri2_buffer *buffer;
+   struct pipe_resource templ;
+   enum st_attachment_type statt;
+   enum pipe_format pf;
+   unsigned bind;
+   struct winsys_handle whandle;
+
+   switch (attachment) {
+  case __DRI_BUFFER_FRONT_LEFT:
+  case __DRI_BUFFER_FAKE_FRONT_LEFT:
+ statt = ST_ATTACHMENT_FRONT_LEFT;
+ bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
+ break;
+  case __DRI_BUFFER_BACK_LEFT:
+ statt = ST_ATTACHMENT_BACK_LEFT;
+ bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
+ break;
+  case __DRI_BUFFER_DEPTH:
+  case __DRI_BUFFER_DEPTH_STENCIL:
+  case __DRI_BUFFER_STENCIL:
+statt = ST_ATTACHMENT_DEPTH_STENCIL;
+bind = PIPE_BIND_DEPTH_STENCIL; /* XXX sampler? */
+ break;
+  default:
+ statt = ST_ATTACHMENT_INVALID;
+ break;
+   }
+
+   switch (format) {
+  case 32:
+ pf = PIPE_FORMAT_B8G8R8X8_UNORM;
+ break;
+  case 16:
+ pf = PIPE_FORMAT_Z16_UNORM;
+ break;
+  default:
+ return NULL;
+   }
+
+   buffer = CALLOC_STRUCT(dri2_buffer);
+   if (!buffer)
+  return NULL;
+
+   memset(templ, 0, sizeof(templ));
+   templ.bind = bind;
+   templ.format = pf;
+   templ.target = PIPE_TEXTURE_2D;
+   templ.last_level = 0;
+   templ.width0 = width;
+   templ.height0 = height;
+   templ.depth0 = 1;
+
+   buffer-resource =
+  screen-base.screen-resource_create(screen-base.screen, templ);
+   if (!buffer-resource)
+  return NULL;
+
+   memset(whandle, 0, sizeof(whandle));
+   whandle.type = DRM_API_HANDLE_TYPE_SHARED;
+   screen-base.screen-resource_get_handle(screen-base.screen,
+ buffer-resource, whandle);
+
+   buffer-base.attachment = attachment;
+   buffer-base.name = whandle.handle;
+   buffer-base.cpp = util_format_get_blocksize(pf);
+   buffer-base.pitch = whandle.stride;
+
+   return buffer-base;
+}
+
+static void
+dri2_release_buffer(__DRIscreen *sPriv, __DRIbuffer *bPriv)
+{
+   struct dri2_buffer *buffer = dri2_buffer(bPriv);
+
+   pipe_resource_reference(buffer-resource, NULL);
+   FREE(buffer);
+}
+
 /*
  * Backend functions for st_framebuffer interface.
  */
@@ -601,6 +687,9 @@ const struct __DriverAPIRec driDriverAPI = {
 
.SwapBuffers = NULL,
.CopySubBuffer = NULL,
+
+   .AllocateBuffer = dri2_allocate_buffer,
+   .ReleaseBuffer  = dri2_release_buffer,
 };
 
 /* This is the table of extensions that the loader will dlsym() for. */
diff --git a/src/gallium/state_trackers/dri/drm/dri2_buffer.h 
b/src/gallium/state_trackers/dri/drm/dri2_buffer.h
new file mode 100644
index 000..1cd8dbb
--- /dev/null
+++ b/src/gallium/state_trackers/dri/drm/dri2_buffer.h
@@ -0,0 +1,22 @@
+#ifndef DRI2_BUFFER_H
+#define DRI2_BUFFER_H
+
+#include dri_wrapper.h
+
+struct pipe_surface;
+
+struct dri2_buffer
+{
+   __DRIbuffer base;
+   struct pipe_resource *resource;
+};
+
+static INLINE struct dri2_buffer *
+dri2_buffer(__DRIbuffer * driBufferPriv)
+{
+   return (struct dri2_buffer *) driBufferPriv;
+}
+
+#endif
+
+/* vim: set sw=3 ts=8 sts=3 expandtab: */
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 03/11] intel: Implement dri2::{Allocate, Release}Buffer

2011-02-04 Thread Benjamin Franzke
---
 src/mesa/drivers/dri/intel/intel_screen.c |   47 +
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index 5d14bcd..2f35fe7 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -634,6 +634,51 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
return (const __DRIconfig **)configs;
 }
 
+struct intel_buffer {
+   __DRIbuffer base;
+   struct intel_region *region;
+};
+
+static __DRIbuffer *
+intelAllocateBuffer(__DRIscreen *screen,
+   unsigned attachment, unsigned format,
+   int width, int height)
+{
+   struct intel_buffer *intelBuffer;
+   struct intel_screen *intelScreen = screen-private;
+
+   intelBuffer = CALLOC(sizeof *intelBuffer);
+   if (intelBuffer == NULL)
+  return NULL;
+
+   intelBuffer-region = intel_region_alloc(intelScreen, I915_TILING_NONE,
+   format / 8, width, height, GL_TRUE);
+   
+   if (intelBuffer-region == NULL) {
+  FREE(intelBuffer);
+  return NULL;
+   }
+   
+   intel_region_flink(intelBuffer-region, intelBuffer-base.name);
+
+   intelBuffer-base.attachment = attachment;
+   intelBuffer-base.cpp = intelBuffer-region-cpp;
+   intelBuffer-base.pitch =
+ intelBuffer-region-pitch * intelBuffer-region-cpp;
+
+   return intelBuffer-base;
+}
+
+static void
+intelReleaseBuffer(__DRIscreen *screen, __DRIbuffer *buffer)
+{
+   struct intel_buffer *intelBuffer = (struct intel_buffer *) buffer;
+
+   intel_region_release(intelBuffer-region);
+   free(intelBuffer);
+}
+
+
 const struct __DriverAPIRec driDriverAPI = {
.DestroyScreen   = intelDestroyScreen,
.CreateContext   = intelCreateContext,
@@ -643,6 +688,8 @@ const struct __DriverAPIRec driDriverAPI = {
.MakeCurrent = intelMakeCurrent,
.UnbindContext   = intelUnbindContext,
.InitScreen2 = intelInitScreen2,
+   .AllocateBuffer   = intelAllocateBuffer,
+   .ReleaseBuffer= intelReleaseBuffer
 };
 
 /* This is the table of extensions that the loader will dlsym() for. */
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 06/11] st/egl: native_helper: Add resource_surface_import_resource

2011-02-04 Thread Benjamin Franzke
---
 .../state_trackers/egl/common/native_helper.c  |8 
 .../state_trackers/egl/common/native_helper.h  |5 +
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/native_helper.c 
b/src/gallium/state_trackers/egl/common/native_helper.c
index 0f2d020..a9d8f32 100644
--- a/src/gallium/state_trackers/egl/common/native_helper.c
+++ b/src/gallium/state_trackers/egl/common/native_helper.c
@@ -143,6 +143,14 @@ resource_surface_add_resources(struct resource_surface 
*rsurf,
return ((rsurf-resource_mask  resource_mask) == resource_mask);
 }
 
+void
+resource_surface_import_resource(struct resource_surface *rsurf,
+ enum native_attachment which,
+ struct pipe_resource *pres)
+{
+   pipe_resource_reference(rsurf-resources[which], pres);
+   rsurf-resource_mask |= 1  which;
+}
 
 void
 resource_surface_get_resources(struct resource_surface *rsurf,
diff --git a/src/gallium/state_trackers/egl/common/native_helper.h 
b/src/gallium/state_trackers/egl/common/native_helper.h
index d1569ac..03995de 100644
--- a/src/gallium/state_trackers/egl/common/native_helper.h
+++ b/src/gallium/state_trackers/egl/common/native_helper.h
@@ -51,6 +51,11 @@ resource_surface_add_resources(struct resource_surface 
*rsurf,
uint resource_mask);
 
 void
+resource_surface_import_resource(struct resource_surface *rsurf,
+ enum native_attachment which,
+ struct pipe_resource *pres);
+
+void
 resource_surface_get_resources(struct resource_surface *rsurf,
struct pipe_resource **resources,
uint resource_mask);
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 04/11] egl: Add wayland platform

2011-02-04 Thread Benjamin Franzke
---
 configure.ac  |4 
 src/egl/Makefile  |4 
 src/egl/main/Makefile |5 -
 src/egl/main/egldisplay.c |1 +
 src/egl/main/egldisplay.h |1 +
 5 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 46938f4..a5ca85d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1536,6 +1536,10 @@ yes)
 if test $plat = fbdev; then
 GALLIUM_WINSYS_DIRS=$GALLIUM_WINSYS_DIRS sw/fbdev
 fi
+   if test $plat = wayland; then
+   PKG_CHECK_MODULES([WAYLAND], [wayland-client],, \
+ [AC_MSG_ERROR([cannot find 
libwayland-client])])
+   fi
 done
 EGL_PLATFORMS=$egl_platforms
 ;;
diff --git a/src/egl/Makefile b/src/egl/Makefile
index 50f227f..52daf2e 100644
--- a/src/egl/Makefile
+++ b/src/egl/Makefile
@@ -5,6 +5,10 @@ include $(TOP)/configs/current
 
 SUBDIRS = drivers main
 
+ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
+SUBDIRS += wayland
+endif
+
 
 default: subdirs
 
diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
index c710631..a5b9299 100644
--- a/src/egl/main/Makefile
+++ b/src/egl/main/Makefile
@@ -58,7 +58,7 @@ LOCAL_LIBS =
 ifeq ($(filter dri2, $(EGL_DRIVERS_DIRS)),dri2)
 LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_DRI2
 LOCAL_LIBS += $(TOP)/src/egl/drivers/dri2/libegl_dri2.a
-EGL_LIB_DEPS += $(XCB_DRI2_LIBS) $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB)
+EGL_LIB_DEPS += $(XCB_DRI2_LIBS) $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB) 
$(WAYLAND_LIBS)
 endif
 ifeq ($(filter glx, $(EGL_DRIVERS_DIRS)),glx)
 LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_GLX
@@ -71,6 +71,9 @@ EGL_NATIVE_PLATFORM=_EGL_INVALID_PLATFORM
 ifeq ($(firstword $(EGL_PLATFORMS)),x11)
 EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11
 endif
+ifeq ($(firstword $(EGL_PLATFORMS)),wayland)
+EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WAYLAND
+endif
 ifeq ($(firstword $(EGL_PLATFORMS)),drm)
 EGL_NATIVE_PLATFORM=_EGL_PLATFORM_DRM
 endif
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 565e44d..3059294 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -27,6 +27,7 @@ _eglGetNativePlatformFromEnv(void)
} egl_platforms[_EGL_NUM_PLATFORMS] = {
   { _EGL_PLATFORM_WINDOWS, gdi },
   { _EGL_PLATFORM_X11, x11 },
+  { _EGL_PLATFORM_WAYLAND, wayland },
   { _EGL_PLATFORM_DRM, drm },
   { _EGL_PLATFORM_FBDEV, fbdev }
};
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index dbc5d32..ce035eb 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -11,6 +11,7 @@
 enum _egl_platform_type {
_EGL_PLATFORM_WINDOWS,
_EGL_PLATFORM_X11,
+   _EGL_PLATFORM_WAYLAND,
_EGL_PLATFORM_DRM,
_EGL_PLATFORM_FBDEV,
 
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 07/11] st/egl: drm_image: Check for MESA_drm_image

2011-02-04 Thread Benjamin Franzke
MESA_drm_image isnt limited to drm platform,
others can enable the extension too.
---
 .../state_trackers/egl/common/egl_g3d_image.c  |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.c 
b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
index 78c035a..81ce7ab 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
@@ -135,7 +135,7 @@ egl_g3d_reference_drm_buffer(_EGLDisplay *dpy, EGLint name,
_EGLImageAttribs attrs;
EGLint format;
 
-   if (dpy-Platform != _EGL_PLATFORM_DRM)
+   if (!dpy-Extensions.MESA_drm_image)
   return NULL;
 
if (_eglParseImageAttribList(attrs, dpy, attribs) != EGL_SUCCESS)
@@ -295,7 +295,7 @@ egl_g3d_export_drm_image(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLImage *img,
struct egl_g3d_image *gimg = egl_g3d_image(img);
struct winsys_handle wsh;
 
-   if (dpy-Platform != _EGL_PLATFORM_DRM)
+   if (!dpy-Extensions.MESA_drm_image)
   return EGL_FALSE;
 
/* get shared handle */
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 08/11] st/egl: Add wayland platform

2011-02-04 Thread Benjamin Franzke
---
 src/gallium/state_trackers/egl/Makefile|   14 +
 src/gallium/state_trackers/egl/common/egl_g3d.c|8 +
 src/gallium/state_trackers/egl/common/native.h |3 +
 .../state_trackers/egl/wayland/native_wayland.c|  569 
 .../state_trackers/egl/wayland/native_wayland.h|   96 
 src/gallium/targets/egl/Makefile   |3 +
 6 files changed, 693 insertions(+), 0 deletions(-)
 create mode 100644 src/gallium/state_trackers/egl/wayland/native_wayland.c
 create mode 100644 src/gallium/state_trackers/egl/wayland/native_wayland.h

diff --git a/src/gallium/state_trackers/egl/Makefile 
b/src/gallium/state_trackers/egl/Makefile
index 8cfcef9..98167cc 100644
--- a/src/gallium/state_trackers/egl/Makefile
+++ b/src/gallium/state_trackers/egl/Makefile
@@ -23,6 +23,13 @@ x11_SOURCES = $(wildcard x11/*.c) \
  $(TOP)/src/glx/dri2.c
 x11_OBJECTS = $(x11_SOURCES:.c=.o)
 
+wayland_INCLUDES = \
+   -I$(TOP)/src/gallium/winsys \
+   -I$(TOP)/src/egl/wayland \
+   $(shell pkg-config --cflags-only-I libdrm wayland-client)
+
+wayland_SOURCES = $(wildcard wayland/*.c)
+wayland_OBJECTS = $(wayland_SOURCES:.c=.o)
 
 drm_INCLUDES = -I$(TOP)/src/gallium/winsys $(shell pkg-config --cflags-only-I 
libdrm)
 drm_SOURCES = $(wildcard drm/*.c)
@@ -45,6 +52,10 @@ ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
 EGL_OBJECTS += $(x11_OBJECTS)
 EGL_CPPFLAGS += -DHAVE_X11_BACKEND
 endif
+ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
+EGL_OBJECTS += $(wayland_OBJECTS)
+EGL_CPPFLAGS += -DHAVE_WAYLAND_BACKEND
+endif
 ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
 EGL_OBJECTS += $(drm_OBJECTS)
 EGL_CPPFLAGS += -DHAVE_DRM_BACKEND
@@ -87,6 +98,9 @@ $(common_OBJECTS): %.o: %.c
 $(x11_OBJECTS): %.o: %.c
$(call egl-cc,x11)
 
+$(wayland_OBJECTS): %.o: %.c
+   $(call egl-cc,wayland)
+
 $(drm_OBJECTS): %.o: %.c
$(call egl-cc,drm)
 
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c 
b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 9024f94..ddca140 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -102,6 +102,11 @@ egl_g3d_get_platform(_EGLDriver *drv, _EGLPlatformType 
plat)
 #ifdef HAVE_X11_BACKEND
  nplat = native_get_x11_platform();
 #endif
+  case _EGL_PLATFORM_WAYLAND:
+ plat_name = wayland;
+#ifdef HAVE_WAYLAND_BACKEND
+ nplat = native_get_wayland_platform();
+#endif
  break;
   case _EGL_PLATFORM_DRM:
  plat_name = DRM;
@@ -546,6 +551,9 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy)
  dpy-Extensions.MESA_drm_image = EGL_TRUE;
}
 
+   if (dpy-Platform == _EGL_PLATFORM_WAYLAND  gdpy-native-buffer)
+  dpy-Extensions.MESA_drm_image = EGL_TRUE;
+
if (egl_g3d_add_configs(drv, dpy, 1) == 1) {
   _eglError(EGL_NOT_INITIALIZED, eglInitialize(unable to add configs));
   goto fail;
diff --git a/src/gallium/state_trackers/egl/common/native.h 
b/src/gallium/state_trackers/egl/common/native.h
index 6461b5e..4288907 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -239,6 +239,9 @@ const struct native_platform *
 native_get_x11_platform(void);
 
 const struct native_platform *
+native_get_wayland_platform(void);
+
+const struct native_platform *
 native_get_drm_platform(void);
 
 const struct native_platform *
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.c 
b/src/gallium/state_trackers/egl/wayland/native_wayland.c
new file mode 100644
index 000..1d6efda
--- /dev/null
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.c
@@ -0,0 +1,569 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.11
+ *
+ * Copyright (C) 2011 Benjamin Franzke benjaminfran...@googlemail.com
+ *
+ * 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.
+ */
+
+#include util/u_memory.h
+#include util/u_inlines.h

[Mesa-dev] [PATCH 09/11] egl_dri2: Enable pixmap bind_to_texture according to the extension

2011-02-04 Thread Benjamin Franzke
---
 src/egl/drivers/dri2/egl_dri2.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index f16bec2..fc479cf 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -173,7 +173,8 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig 
*dri_config, int id,
base.NativeRenderable = EGL_TRUE;
 
base.SurfaceType = surface_type;
-   if (surface_type  (EGL_PIXMAP_BIT | EGL_PBUFFER_BIT)) {
+   if (surface_type  (EGL_PBUFFER_BIT |
+   (disp-Extensions.NOK_texture_from_pixmap ? EGL_PIXMAP_BIT : 0))) {
   base.BindToTextureRGB = bind_to_texture_rgb;
   if (base.AlphaSize  0)
  base.BindToTextureRGBA = bind_to_texture_rgba;
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 11/11] egl_dri2: Add wayland platform

2011-02-04 Thread Benjamin Franzke
---
 src/egl/drivers/dri2/Makefile   |7 +
 src/egl/drivers/dri2/egl_dri2.c |6 +
 src/egl/drivers/dri2/egl_dri2.h |   43 +++
 src/egl/drivers/dri2/platform_wayland.c |  588 +++
 4 files changed, 644 insertions(+), 0 deletions(-)
 create mode 100644 src/egl/drivers/dri2/platform_wayland.c

diff --git a/src/egl/drivers/dri2/Makefile b/src/egl/drivers/dri2/Makefile
index 8e33bdd..89e9dd7 100644
--- a/src/egl/drivers/dri2/Makefile
+++ b/src/egl/drivers/dri2/Makefile
@@ -24,4 +24,11 @@ ifeq ($(SHARED_GLAPI),1)
 EGL_CFLAGS += -DHAVE_SHARED_GLAPI
 endif
 
+ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
+EGL_SOURCES += platform_wayland.c
+EGL_INCLUDES += -DHAVE_WAYLAND_PLATFORM $(WAYLAND_CFLAGS) \
+   -I$(TOP)/src/egl/wayland
+EGL_LIBS += $(WAYLAND_LIBS)
+endif
+
 include ../Makefile.template
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index fc479cf..3e51077 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -408,6 +408,12 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
   if (disp-Options.TestOnly)
  return EGL_TRUE;
   return dri2_initialize_drm(drv, disp);
+#ifdef HAVE_WAYLAND_PLATFORM
+   case _EGL_PLATFORM_WAYLAND:
+  if (disp-Options.TestOnly)
+ return EGL_TRUE;
+  return dri2_initialize_wayland(drv, disp);
+#endif
 #endif
 
default:
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index f65319d..72e887c 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -33,6 +33,11 @@
 #include xcb/xfixes.h
 #include X11/Xlib-xcb.h
 
+#ifdef HAVE_WAYLAND_PLATFORM
+#include wayland-client.h
+#include wayland-egl-priv.h
+#endif
+
 #include GL/gl.h
 #include GL/internal/dri_interface.h
 
@@ -76,6 +81,9 @@ struct dri2_egl_display
 
__DRIdri2LoaderExtension  loader_extension;
const __DRIextension *extensions[3];
+#ifdef HAVE_WAYLAND_PLATFORM
+   struct wl_egl_display*wl_dpy;
+#endif
 };
 
 struct dri2_egl_context
@@ -84,6 +92,22 @@ struct dri2_egl_context
__DRIcontext *dri_context;
 };
 
+#ifdef HAVE_WAYLAND_PLATFORM
+enum wayland_buffer_type {
+   WL_BUFFER_FRONT,
+   WL_BUFFER_BACK,
+   WL_BUFFER_COUNT
+};
+
+#define __DRI_BUFFER_COUNT 10
+#endif
+
+enum dri2_surface_type {
+   DRI2_WINDOW_SURFACE,
+   DRI2_PIXMAP_SURFACE,
+   DRI2_PBUFFER_SURFACE
+};
+
 struct dri2_egl_surface
 {
_EGLSurface  base;
@@ -94,8 +118,24 @@ struct dri2_egl_surface
xcb_xfixes_region_t  region;
int  have_fake_front;
int  swap_interval;
+   enum dri2_surface_type type;
+#ifdef HAVE_WAYLAND_PLATFORM
+   struct wl_egl_window  *wl_win;
+   struct wl_egl_pixmap  *wl_pix;
+   struct wl_buffer  *wl_drm_buffer[WL_BUFFER_COUNT];
+   intdx;
+   intdy;
+   __DRIbuffer   *dri_buffers[__DRI_BUFFER_COUNT];
+   EGLBoolean block_swap_buffers;
+#endif
 };
 
+struct dri2_egl_buffer {
+   __DRIbuffer *dri_buffer;
+   struct dri2_egl_display *dri2_dpy;
+};
+
+
 struct dri2_egl_config
 {
_EGLConfig base;
@@ -136,6 +176,9 @@ dri2_initialize_x11(_EGLDriver *drv, _EGLDisplay *disp);
 EGLBoolean
 dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp);
 
+EGLBoolean
+dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp);
+
 char *
 dri2_get_driver_for_fd(int fd);
 
diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
new file mode 100644
index 000..b223403
--- /dev/null
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -0,0 +1,588 @@
+/*
+ * 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.
+ *
+ * Authors:
+ *Kristian Høgsberg k...@bitplanet.net
+ *Benjamin Franzke benjaminfran...@googlemail.com
+ */
+
+#include stdlib.h

[Mesa-dev] [PATCH 05/11] egl: Implement libwayland-egl

2011-02-04 Thread Benjamin Franzke
This library is required and defined by wayland for
EGL implementations supporting wayland.
---
 configs/autoconf.in|9 ++
 configs/default|7 +
 configure.ac   |   17 +++
 src/egl/wayland/Makefile   |   67 +++
 src/egl/wayland/wayland-egl-priv.h |   60 ++
 src/egl/wayland/wayland-egl.c  |  225 
 src/egl/wayland/wayland-egl.pc.in  |   12 ++
 7 files changed, 397 insertions(+), 0 deletions(-)
 create mode 100644 src/egl/wayland/Makefile
 create mode 100644 src/egl/wayland/wayland-egl-priv.h
 create mode 100644 src/egl/wayland/wayland-egl.c
 create mode 100644 src/egl/wayland/wayland-egl.pc.in

diff --git a/configs/autoconf.in b/configs/autoconf.in
index b7137a0..2ab1850 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -64,6 +64,7 @@ GLESv1_CM_LIB = GLESv1_CM
 GLESv2_LIB = GLESv2
 VG_LIB = OpenVG
 GLAPI_LIB = glapi
+WAYLAND_EGL_LIB = wayland-egl
 
 # Library names (actual file names)
 GL_LIB_NAME = @GL_LIB_NAME@
@@ -76,6 +77,7 @@ GLESv1_CM_LIB_NAME = @GLESv1_CM_LIB_NAME@
 GLESv2_LIB_NAME = @GLESv2_LIB_NAME@
 VG_LIB_NAME = @VG_LIB_NAME@
 GLAPI_LIB_NAME = @GLAPI_LIB_NAME@
+WAYLAND_EGL_LIB_NAME = @WAYLAND_EGL_LIB_NAME@
 
 # Globs used to install the lib and all symlinks
 GL_LIB_GLOB = @GL_LIB_GLOB@
@@ -88,6 +90,7 @@ GLESv1_CM_LIB_GLOB = @GLESv1_CM_LIB_GLOB@
 GLESv2_LIB_GLOB = @GLESv2_LIB_GLOB@
 VG_LIB_GLOB = @VG_LIB_GLOB@
 GLAPI_LIB_GLOB = @GLAPI_LIB_GLOB@
+WAYLAND_EGL_LIB_GLOB = @WAYLAND_EGL_LIB_GLOB@
 
 # Directories to build
 LIB_DIR = @LIB_DIR@
@@ -131,6 +134,7 @@ GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv1_CM_LIB_DEPS@
 GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv2_LIB_DEPS@
 VG_LIB_DEPS = $(EXTRA_LIB_PATH) @VG_LIB_DEPS@
 GLAPI_LIB_DEPS = $(EXTRA_LIB_PATH) @GLAPI_LIB_DEPS@
+WAYLAND_EGL_LIB_DEPS = $(EXTRA_LIBPATH) @WAYLAND_EGL_LIB_DEPS@
 
 # DRI dependencies
 DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
@@ -184,11 +188,16 @@ GLESv2_PC_LIB_PRIV = @GLESv2_PC_LIB_PRIV@
 EGL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@
 EGL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@
 EGL_PC_CFLAGS = @GL_PC_CFLAGS@
+WAYLAND_EGL_PC_REQ_PRIV = @WAYLAND_EGL_PC_REQ_PRIV@
+WAYLAND_EGL_PC_LIB_PRIV = @WAYLAND_EGL_PC_LIB_PRIV@
+WAYLAND_EGL_PC_CFLAGS = @WAYLAND_EGL_PC_CFLAGS@
 
 XCB_DRI2_CFLAGS = @XCB_DRI2_CFLAGS@
 XCB_DRI2_LIBS = @XCB_DRI2_LIBS@
 LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@
 LIBUDEV_LIBS = @LIBUDEV_LIBS@
+WAYLAND_CFLAGS = @WAYLAND_CFLAGS@
+WAYLAND_LIBS = @WAYLAND_LIBS@
 
 MESA_LLVM = @MESA_LLVM@
 
diff --git a/configs/default b/configs/default
index b05e9ff..442eb84 100644
--- a/configs/default
+++ b/configs/default
@@ -60,6 +60,7 @@ GLESv1_CM_LIB = GLESv1_CM
 GLESv2_LIB = GLESv2
 VG_LIB = OpenVG
 GLAPI_LIB = glapi
+WAYLAND_EGL_LIB = wayland-egl
 
 
 # Library names (actual file names)
@@ -73,6 +74,7 @@ GLESv1_CM_LIB_NAME = lib$(GLESv1_CM_LIB).so
 GLESv2_LIB_NAME = lib$(GLESv2_LIB).so
 VG_LIB_NAME = lib$(VG_LIB).so
 GLAPI_LIB_NAME = lib$(GLAPI_LIB).so
+WAYLAND_EGL_LIB_NAME = lib$(WAYLAND_EGL_LIB).so
 
 # globs used to install the lib and all symlinks
 GL_LIB_GLOB = $(GL_LIB_NAME)*
@@ -85,6 +87,7 @@ GLESv1_CM_LIB_GLOB = $(GLESv1_CM_LIB_NAME)*
 GLESv2_LIB_GLOB = $(GLESv2_LIB_NAME)*
 VG_LIB_GLOB = $(VG_LIB_NAME)*
 GLAPI_LIB_GLOB = $(GLAPI_LIB_NAME)*
+WAYLAND_EGL_LIB_GLOB = $(WAYLAND_EGL_LIB_NAME)*
 
 # Optional assembly language optimization files for libGL
 MESA_ASM_SOURCES = 
@@ -131,6 +134,7 @@ GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
 GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
 VG_LIB_DEPS= $(EXTRA_LIB_PATH) -lpthread
 GLAPI_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
+WAYLAND_EGL_LIB_DEPS = $(EXTRA_LIB_PATH) -lwayland-client -ldrm
 
 # Program dependencies - specific GL/glut libraries added in Makefiles
 APP_LIB_DEPS = -lm
@@ -179,3 +183,6 @@ GLESv2_PC_CFLAGS =
 VG_PC_REQ_PRIV =
 VG_PC_LIB_PRIV =
 VG_PC_CFLAGS =
+WAYLAND_EGL_PC_REQ_PRIV =
+WAYLAND_EGL_PC_LIB_PRIV =
+WAYLAND_EGL_PC_CFLAGS =
diff --git a/configure.ac b/configure.ac
index a5ca85d..296cce7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -318,6 +318,7 @@ GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
 GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
 VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
 GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
+WAYLAND_EGL_LIB_NAME='lib$(WAYLAND_EGL_LIB).'${LIB_EXTENSION}
 
 
GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
 
GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
@@ -330,6 +331,7 @@ 
GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'
 
GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
 
VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
 
GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'

[Mesa-dev] [PATCH 1/2] mesa: support internalFormat=GL_BGRA in TexImage2D

2011-01-17 Thread Benjamin Franzke
internalFormat=GL_BGRA is only allowed with gles1/2
and GL_EXT_texture_format_BGRA enabled.
---
 src/mesa/main/texformat.c |4 
 src/mesa/main/teximage.c  |9 +
 src/mesa/main/texparam.c  |7 +--
 src/mesa/main/texstate.c  |1 +
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 146b2b3..3fb4530 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -94,6 +94,10 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint 
internalFormat,
 RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB);
 break;
 
+  case GL_BGRA:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB);
+ break;
+
   /* deep RGBA formats */
   case GL_RGB10_A2:
 RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010);
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 47d5093..7ee62b0 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -183,6 +183,15 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint 
internalFormat )
  ; /* fallthrough */
}
 
+   if (ctx-Extensions.EXT_texture_format_BGRA) {
+  switch (internalFormat) {
+ case GL_BGRA_EXT:
+return GL_BGRA;
+ default:
+; /* fallthrough */
+  }
+   }
+
if (ctx-Extensions.EXT_paletted_texture) {
   switch (internalFormat) {
  case GL_COLOR_INDEX:
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index d2b8b5c..190a14d 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -885,7 +885,9 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
 }
 /* FALLTHROUGH */
   case GL_TEXTURE_BLUE_SIZE:
- if (img-_BaseFormat == GL_RGB || img-_BaseFormat == GL_RGBA)
+ if (img-_BaseFormat == GL_RGB ||
+ img-_BaseFormat == GL_RGBA ||
+ img-_BaseFormat == GL_BGRA)
 *params = _mesa_get_format_bits(texFormat, pname);
  else
 *params = 0;
@@ -893,7 +895,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
   case GL_TEXTURE_ALPHA_SIZE:
  if (img-_BaseFormat == GL_ALPHA ||
  img-_BaseFormat == GL_LUMINANCE_ALPHA ||
- img-_BaseFormat == GL_RGBA)
+ img-_BaseFormat == GL_RGBA ||
+ img-_BaseFormat == GL_BGRA)
 *params = _mesa_get_format_bits(texFormat, pname);
  else
 *params = 0;
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index f4d7718..e8315a1 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -176,6 +176,7 @@ calculate_derived_texenv( struct gl_tex_env_combine_state 
*state,
case GL_LUMINANCE_ALPHA:
case GL_INTENSITY:
case GL_RGBA:
+   case GL_BGRA:
   break;
 
case GL_LUMINANCE:
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 2/2] st/mesa: support internalFormat=GL_BGRA in textures

2011-01-17 Thread Benjamin Franzke
---
 src/mesa/state_tracker/st_format.c |   11 ++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/mesa/state_tracker/st_format.c 
b/src/mesa/state_tracker/st_format.c
index 2e0a664..a532e08 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -511,6 +511,14 @@ st_choose_format(struct pipe_screen *screen, GLenum 
internalFormat,
   return default_rgba_format( screen, target, sample_count, bindings,
   geom_flags );
 
+   case GL_BGRA:
+  if (screen-is_format_supported( screen, PIPE_FORMAT_B8G8R8A8_UNORM,
+   target, sample_count, bindings,
+   geom_flags ))
+ return PIPE_FORMAT_B8G8R8A8_UNORM;
+  return default_rgba_format( screen, target, sample_count, bindings,
+  geom_flags );
+
case 3:
case GL_RGB:
case GL_RGB8:
@@ -1032,7 +1040,8 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLint 
internalFormat,
boolean want_renderable =
   internalFormat == 3 || internalFormat == 4 ||
   internalFormat == GL_RGB || internalFormat == GL_RGBA ||
-  internalFormat == GL_RGB8 || internalFormat == GL_RGBA8;
+  internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
+  internalFormat == GL_BGRA;
 
return st_ChooseTextureFormat_renderable(ctx, internalFormat,
format, type, want_renderable);
-- 
1.7.3.4

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


[Mesa-dev] [PATCH] st/mesa: Expose EXT_texture_fromat_BGRA8888 for gles1/2

2011-01-15 Thread Benjamin Franzke
---
 src/mesa/state_tracker/st_extensions.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index d240cab..9534cc9 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -260,6 +260,8 @@ void st_init_extensions(struct st_context *st)
ctx-Extensions.EXT_texture_env_dot3 = GL_TRUE;
ctx-Extensions.EXT_texture_lod_bias = GL_TRUE;
ctx-Extensions.EXT_vertex_array_bgra = GL_TRUE;
+   if (ctx-API == API_OPENGLES || ctx-API == API_OPENGLES2)
+  ctx-Extensions.EXT_texture_format_BGRA = GL_TRUE;
 
ctx-Extensions.APPLE_vertex_array_object = GL_TRUE;
 
-- 
1.7.3.4

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


[Mesa-dev] [PATCH] r600g: implement texture_get_handle (wayland working now)

2010-11-03 Thread Benjamin Franzke
This patch adds support to use eglExportDRMImageMESA with r600g.
so wayland runs with its x11-compositor and clients on it...


0001-r600g-implement-texture_get_handle-needed-for-eglExp.patch
Description: Binary data
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] st/egl image: multiply drm buf-stride with blocksize

2010-10-31 Thread Benjamin Franzke
This Patch fixes DRMBuffer stride, which is to short when using
wayland with r300g. (only one quarter of the screen has real data,
with some parts left out..)
Funnily, on nouveau wayland runs with and without this patch for me..
But hey, now wayland runs fine on r300g using x11-compositor and the
clients: flower,terminal,dnd.. :)


0001-st-egl-image-multiply-drm-buf-stride-with-blocksize.patch
Description: Binary data
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] targets/egl: rename pipe_radeon to pipe_r300

2010-08-22 Thread Benjamin Franzke
st/egl/x11/x11_screen.c requests a driver named r300 not radeon

KNOWN ISSUE: breaks st/egl/kms/
st/egl/kms requests a pipe named radeon
that will not be found now

so why not leaving pipe_radeon there?
that was possible as long we have only r300g.
now there is also r600g for which st/egl/kms also
requests a pipe named radeon
(possible solution in later commit)
---
 src/gallium/targets/egl/Makefile  |   14 +++---
 src/gallium/targets/egl/pipe_r300.c   |   27 +++
 src/gallium/targets/egl/pipe_radeon.c |   27 ---
 3 files changed, 34 insertions(+), 34 deletions(-)
 create mode 100644 src/gallium/targets/egl/pipe_r300.c
 delete mode 100644 src/gallium/targets/egl/pipe_radeon.c

diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile
index 1585e2d..636fceb 100644
--- a/src/gallium/targets/egl/Makefile
+++ b/src/gallium/targets/egl/Makefile
@@ -90,10 +90,10 @@ nouveau_LIBS := \
$(TOP)/src/gallium/drivers/nv50/libnv50.a \
$(TOP)/src/gallium/drivers/nouveau/libnouveau.a
 
-# radeon pipe driver
-radeon_CPPFLAGS :=
-radeon_SYS := -ldrm -ldrm_radeon
-radeon_LIBS := \
+# r300 pipe driver
+r300_CPPFLAGS :=
+r300_SYS := -ldrm -ldrm_radeon
+r300_LIBS := \
$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
$(TOP)/src/gallium/drivers/r300/libr300.a
 
@@ -151,7 +151,7 @@ ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
 OUTPUTS += nouveau
 endif
 ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
-OUTPUTS += radeon
+OUTPUTS += r300
 endif
 ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
 OUTPUTS += vmwgfx
@@ -188,8 +188,8 @@ $(OUTPUT_PATH)/$(PIPE_PREFIX)i965.so: pipe_i965.o 
$(i965_LIBS)
 $(OUTPUT_PATH)/$(PIPE_PREFIX)nouveau.so: pipe_nouveau.o $(nouveau_LIBS)
$(call mklib,nouveau)
 
-$(OUTPUT_PATH)/$(PIPE_PREFIX)radeon.so: pipe_radeon.o $(radeon_LIBS)
-   $(call mklib,radeon)
+$(OUTPUT_PATH)/$(PIPE_PREFIX)r300.so: pipe_r300.o $(r300_LIBS)
+   $(call mklib,r300)
 
 $(OUTPUT_PATH)/$(PIPE_PREFIX)vmwgfx.so: pipe_vmwgfx.o $(vmwgfx_LIBS)
$(call mklib,vmwgfx)
diff --git a/src/gallium/targets/egl/pipe_r300.c 
b/src/gallium/targets/egl/pipe_r300.c
new file mode 100644
index 000..2fa495e
--- /dev/null
+++ b/src/gallium/targets/egl/pipe_r300.c
@@ -0,0 +1,27 @@
+
+#include target-helpers/inline_debug_helper.h
+#include state_tracker/drm_driver.h
+#include radeon/drm/radeon_drm_public.h
+#include r300/r300_public.h
+
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct r300_winsys_screen *sws;
+   struct pipe_screen *screen;
+
+   sws = r300_drm_winsys_screen_create(fd);
+   if (!sws)
+  return NULL;
+
+   screen = r300_screen_create(sws);
+   if (!screen)
+  return NULL;
+
+   screen = debug_screen_wrap(screen);
+
+   return screen;
+}
+
+PUBLIC
+DRM_DRIVER_DESCRIPTOR(r300, r300, create_screen)
diff --git a/src/gallium/targets/egl/pipe_radeon.c 
b/src/gallium/targets/egl/pipe_radeon.c
deleted file mode 100644
index 35550bc..000
--- a/src/gallium/targets/egl/pipe_radeon.c
+++ /dev/null
@@ -1,27 +0,0 @@
-
-#include target-helpers/inline_debug_helper.h
-#include state_tracker/drm_driver.h
-#include radeon/drm/radeon_drm_public.h
-#include r300/r300_public.h
-
-static struct pipe_screen *
-create_screen(int fd)
-{
-   struct r300_winsys_screen *sws;
-   struct pipe_screen *screen;
-
-   sws = r300_drm_winsys_screen_create(fd);
-   if (!sws)
-  return NULL;
-
-   screen = r300_screen_create(sws);
-   if (!screen)
-  return NULL;
-
-   screen = debug_screen_wrap(screen);
-
-   return screen;
-}
-
-PUBLIC
-DRM_DRIVER_DESCRIPTOR(radeon, radeon, create_screen)
-- 
1.7.1

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


[Mesa-dev] [PATCH 3/3] targets/egl: add pipe_r600

2010-08-22 Thread Benjamin Franzke
KNOWN ISSUE: eglShowScreenSurfaceMESA in st/egl/kms fails
but st/egl/x11 works
---
 src/gallium/targets/egl/Makefile|   13 +
 src/gallium/targets/egl/pipe_r600.c |   27 +++
 2 files changed, 40 insertions(+), 0 deletions(-)
 create mode 100644 src/gallium/targets/egl/pipe_r600.c

diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile
index 625c1be..1452c59 100644
--- a/src/gallium/targets/egl/Makefile
+++ b/src/gallium/targets/egl/Makefile
@@ -97,6 +97,13 @@ r300_LIBS := \
$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
$(TOP)/src/gallium/drivers/r300/libr300.a
 
+# r600 pipe driver
+r600_CPPFLAGS :=
+r600_SYS := -ldrm -ldrm_radeon
+r600_LIBS := \
+   $(TOP)/src/gallium/winsys/r600/drm/libr600winsys.a \
+   $(TOP)/src/gallium/drivers/r600/libr600.a
+
 # radeon pipe driver (r300 + r600)
 radeon_CPPFLAGS := \
-I$(TOP)/src/gallium/state_trackers/egl \
@@ -163,6 +170,9 @@ endif
 ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
 OUTPUTS += r300 radeon
 endif
+ifneq ($(findstring r600/drm,$(GALLIUM_WINSYS_DIRS)),)
+OUTPUTS += r600 radeon
+endif
 ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
 OUTPUTS += vmwgfx
 endif
@@ -201,6 +211,9 @@ $(OUTPUT_PATH)/$(PIPE_PREFIX)nouveau.so: pipe_nouveau.o 
$(nouveau_LIBS)
 $(OUTPUT_PATH)/$(PIPE_PREFIX)r300.so: pipe_r300.o $(r300_LIBS)
$(call mklib,r300)
 
+$(OUTPUT_PATH)/$(PIPE_PREFIX)r600.so: pipe_r600.o $(r600_LIBS)
+   $(call mklib,r600)
+
 $(OUTPUT_PATH)/$(PIPE_PREFIX)radeon.so: pipe_radeon.o $(radeon_LIBS)
$(call mklib,radeon)
 
diff --git a/src/gallium/targets/egl/pipe_r600.c 
b/src/gallium/targets/egl/pipe_r600.c
new file mode 100644
index 000..c35a0b0
--- /dev/null
+++ b/src/gallium/targets/egl/pipe_r600.c
@@ -0,0 +1,27 @@
+
+#include state_tracker/drm_driver.h
+#include target-helpers/inline_debug_helper.h
+#include r600/drm/r600_drm_public.h
+#include r600/r600_public.h
+
+static struct pipe_screen *
+create_screen(int fd)
+{
+   struct radeon *rw;
+   struct pipe_screen *screen;
+
+   rw = r600_drm_winsys_create(fd);
+   if (!rw)
+  return NULL;
+
+   screen = r600_screen_create(rw);
+   if (!screen)
+  return NULL;
+
+   screen = debug_screen_wrap(screen);
+
+   return screen;
+}
+
+PUBLIC
+DRM_DRIVER_DESCRIPTOR(r600, r600, create_screen)
-- 
1.7.1

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