aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-12 07:54:33 +0200
committermarha <marha@users.sourceforge.net>2012-07-12 07:54:33 +0200
commit0d90d39cece3eb381fe59941059eca1782b556b4 (patch)
tree752bee3a7f4ed2d1a212714fd55be38dbfaeb7a4
parent2bb6be5a068a918bf74a18a41ed1f2537cd68382 (diff)
parent165450290d6c26756ede118f52ba2164abce7c9a (diff)
downloadvcxsrv-0d90d39cece3eb381fe59941059eca1782b556b4.tar.gz
vcxsrv-0d90d39cece3eb381fe59941059eca1782b556b4.tar.bz2
vcxsrv-0d90d39cece3eb381fe59941059eca1782b556b4.zip
Merge remote-tracking branch 'origin/released'
-rw-r--r--mesalib/docs/WL_bind_wayland_display.spec90
-rw-r--r--mesalib/include/EGL/eglmesaext.h14
-rw-r--r--mesalib/include/GL/internal/dri_interface.h62
-rw-r--r--mesalib/src/mapi/glapi/gen/ARB_draw_buffers.xml63
-rw-r--r--mesalib/src/mapi/glapi/gen/Makefile.am54
-rw-r--r--mesalib/src/mapi/glapi/gen/es_EXT.xml63
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.c2
-rw-r--r--xorg-server/hw/xfree86/common/xf86.h2
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.c6
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Modes.c15
-rw-r--r--xorg-server/hw/xfree86/modes/xf86RandR12.c2
11 files changed, 287 insertions, 86 deletions
diff --git a/mesalib/docs/WL_bind_wayland_display.spec b/mesalib/docs/WL_bind_wayland_display.spec
index e2fde3c50..e1aca5380 100644
--- a/mesalib/docs/WL_bind_wayland_display.spec
+++ b/mesalib/docs/WL_bind_wayland_display.spec
@@ -56,12 +56,34 @@ New Procedures and Functions
EGLBoolean eglUnbindWaylandDisplayWL(EGLDisplay dpy,
struct wl_display *display);
+ EGLBoolean eglQueryWaylandBufferWL(EGLDisplay dpy,
+ struct wl_buffer *buffer,
+ EGLint attribute, EGLint *value);
+
New Tokens
Accepted as <target> in eglCreateImageKHR
EGL_WAYLAND_BUFFER_WL 0x31D5
+ Accepted in the <attrib_list> parameter of eglCreateImageKHR:
+
+ EGL_WAYLAND_PLANE_WL 0x31D6
+
+
+ Accepted as a eglQueryWaylandBufferWL attribute:
+
+ EGL_WAYLAND_BUFFER_COMPONENTS_WL 0x31D7
+
+ Possible values for EGL_WAYLAND_BUFFER_COMPONENTS_WL:
+
+ EGL_WAYLAND_BUFFER_RGB_WL 0x31D8
+ EGL_WAYLAND_BUFFER_RGBA_WL 0x31D9
+ EGL_WAYLAND_BUFFER_Y_U_V_WL 0x31Da
+ EGL_WAYLAND_BUFFER_Y_UV_WL 0x31Db
+ EGL_WAYLAND_BUFFER_Y_XUXV_WL 0x31Dc
+
+
Additions to the EGL 1.4 Specification:
To bind a server side wl_display to an EGLDisplay, call
@@ -80,9 +102,65 @@ Additions to the EGL 1.4 Specification:
eglUnbindWaylandDisplayWL returns EGL_FALSE when there is no
wl_display bound to the EGLDisplay currently otherwise EGL_TRUE.
- Import a wl_buffer by calling eglCreateImageKHR with
- wl_buffer as EGLClientBuffer, EGL_WAYLAND_BUFFER_WL as the target,
- NULL context and an empty attribute_list.
+ A wl_buffer can have several planes, typically in case of planar
+ YUV formats. Depending on the exact YUV format in use, the
+ compositor will have to create one or more EGLImages for the
+ various planes. The eglQueryWaylandBufferWL function should be
+ used to first query the wl_buffer components using
+ EGL_WAYLAND_BUFFER_COMPONENTS_WL as the attribute. If the
+ wl_buffer object is not an EGL wl_buffer (wl_shm and other wayland
+ extensions can create wl_buffer objects), this query will return
+ EGL_FALSE. In that case the wl_buffer can not be used with EGL
+ and the compositor should have another way to get the buffer
+ contents.
+
+ If eglQueryWaylandBufferWL succeeds, the returned value will be
+ one of EGL_WAYLAND_BUFFER_RGB_WL, EGL_WAYLAND_BUFFER_RGBA_WL,
+ EGL_WAYLAND_BUFFER_Y_U_V_WL, EGL_WAYLAND_BUFFER_Y_UV_WL,
+ EGL_WAYLAND_BUFFER_Y_XUXV_WL. The value returned describes how
+ many EGLImages must be used, which components will be sampled from
+ each EGLImage and how they map to rgba components in the shader.
+ The naming conventions separates planes by _ and within each
+ plane, the order or R, G, B, A, Y, U, and V indicates how those
+ components map to the rgba value returned by the sampler. X
+ indicates that the corresponding component in the rgba value isn't
+ used.
+
+ RGB and RGBA buffer types:
+
+ EGL_WAYLAND_BUFFER_RGB_WL
+ One plane, samples RGB from the texture to rgb in the
+ shader. Alpha channel is not valid.
+
+ EGL_WAYLAND_BUFFER_RGBA_WL 0x31D9
+ One plane, samples RGBA from the texture to rgba in the
+ shader.
+
+ YUV buffer types:
+
+ EGL_WAYLAND_BUFFER_Y_U_V_WL 0x31Da
+ Three planes, samples Y from the first plane to r in
+ the shader, U from the second plane to r, and V from
+ the third plane to r.
+
+ EGL_WAYLAND_BUFFER_Y_UV_WL 0x31Db
+ Two planes, samples Y from the first plane to r in
+ the shader, U and V from the second plane to rg.
+
+ EGL_WAYLAND_BUFFER_Y_XUXV_WL 0x31Dc
+ Two planes, samples Y from the first plane to r in
+ the shader, U and V from the second plane to g and a.
+
+ After querying the wl_buffer layout, create EGLImages for the
+ planes by calling eglCreateImageKHR with wl_buffer as
+ EGLClientBuffer, EGL_WAYLAND_BUFFER_WL as the target, NULL
+ context. If no attributes are given, an EGLImage will be created
+ for the first plane. For multi-planar buffers, specify the plane
+ to create the EGLImage for by using the EGL_WAYLAND_PLANE_WL
+ attribute. The value of the attribute is the index of the plane,
+ as defined by the buffer format. Writing to an EGLImage created
+ from a wl_buffer in any way (such as glTexImage2D, binding the
+ EGLImage as a renderbuffer etc) will result in undefined behavior.
Issues
@@ -90,3 +168,9 @@ Revision History
Version 1, March 1, 2011
Initial draft (Benjamin Franzke)
+ Version 2, July 5, 2012
+ Add EGL_WAYLAND_PLANE_WL attribute to allow creating an EGLImage
+ for different planes of planar buffer. (Kristian Høgsberg)
+ Version 3, July 10, 2012
+ Add eglQueryWaylandBufferWL and the various buffer
+ formats. (Kristian Høgsberg)
diff --git a/mesalib/include/EGL/eglmesaext.h b/mesalib/include/EGL/eglmesaext.h
index 52dd5b108..74d8ced37 100644
--- a/mesalib/include/EGL/eglmesaext.h
+++ b/mesalib/include/EGL/eglmesaext.h
@@ -113,13 +113,27 @@ typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETDRMDISPLAYMESA) (int fd);
#define EGL_WL_bind_wayland_display 1
#define EGL_WAYLAND_BUFFER_WL 0x31D5 /* eglCreateImageKHR target */
+#define EGL_WAYLAND_PLANE_WL 0x31D6 /* eglCreateImageKHR target */
+
+#define EGL_WAYLAND_BUFFER_COMPONENTS_WL 0x31D7 /* eglQueryWaylandBufferWL attribute */
+
+#define EGL_WAYLAND_BUFFER_RGB_WL 0x31D8
+#define EGL_WAYLAND_BUFFER_RGBA_WL 0x31D9
+#define EGL_WAYLAND_BUFFER_Y_U_V_WL 0x31Da
+#define EGL_WAYLAND_BUFFER_Y_UV_WL 0x31Db
+#define EGL_WAYLAND_BUFFER_Y_XUXV_WL 0x31Dc
+
struct wl_display;
+struct wl_buffer;
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglBindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display);
EGLAPI EGLBoolean EGLAPIENTRY eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryWaylandBufferWL(EGLDisplay dpy, struct wl_buffer *buffer, EGLint attribute, EGLint *value);
#endif
typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYWAYLANDBUFFERWL) (EGLDisplay dpy, struct wl_buffer *buffer, EGLint attribute, EGLint *value);
+
#endif
#ifndef EGL_NOK_swap_region
diff --git a/mesalib/include/GL/internal/dri_interface.h b/mesalib/include/GL/internal/dri_interface.h
index fd29e8256..bcdd7f605 100644
--- a/mesalib/include/GL/internal/dri_interface.h
+++ b/mesalib/include/GL/internal/dri_interface.h
@@ -812,10 +812,28 @@ struct __DRIdri2LoaderExtensionRec {
#define __DRI_CTX_ATTRIB_MINOR_VERSION 1
#define __DRI_CTX_ATTRIB_FLAGS 2
+/**
+ * \requires __DRI2_ROBUSTNESS.
+ */
+#define __DRI_CTX_ATTRIB_RESET_STRATEGY 3
+
#define __DRI_CTX_FLAG_DEBUG 0x00000001
#define __DRI_CTX_FLAG_FORWARD_COMPATIBLE 0x00000002
/**
+ * \requires __DRI2_ROBUSTNESS.
+ */
+#define __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS 0x00000004
+
+/**
+ * \name Context reset strategies.
+ */
+/*@{*/
+#define __DRI_CTX_RESET_NO_NOTIFICATION 0
+#define __DRI_CTX_RESET_LOSE_CONTEXT 1
+/*@}*/
+
+/**
* \name Reasons that __DRIdri2Extension::createContextAttribs might fail
*/
/*@{*/
@@ -905,12 +923,19 @@ struct __DRIdri2ExtensionRec {
* tokens, except in the native endian of the CPU. For example, on
* little endian __DRI_IMAGE_FORMAT_XRGB8888 corresponds to
* MESA_FORMAT_XRGB8888, but MESA_FORMAT_XRGB8888_REV on big endian.
+ *
+ * __DRI_IMAGE_FORMAT_NONE is for images that aren't directly usable
+ * by the driver (YUV planar formats) but serve as a base image for
+ * creating sub-images for the different planes within the image.
*/
#define __DRI_IMAGE_FORMAT_RGB565 0x1001
#define __DRI_IMAGE_FORMAT_XRGB8888 0x1002
#define __DRI_IMAGE_FORMAT_ARGB8888 0x1003
#define __DRI_IMAGE_FORMAT_ABGR8888 0x1004
#define __DRI_IMAGE_FORMAT_XBGR8888 0x1005
+#define __DRI_IMAGE_FORMAT_R8 0x1006 /* Since version 5 */
+#define __DRI_IMAGE_FORMAT_GR88 0x1007
+#define __DRI_IMAGE_FORMAT_NONE 0x1008
#define __DRI_IMAGE_USE_SHARE 0x0001
#define __DRI_IMAGE_USE_SCANOUT 0x0002
@@ -967,6 +992,26 @@ struct __DRIimageExtensionRec {
* \since 4
*/
int (*write)(__DRIimage *image, const void *buf, size_t count);
+
+ /**
+ * Create an image out of a sub-region of a parent image. This
+ * entry point lets us create individual __DRIimages for different
+ * planes in a planar buffer (typically yuv), for example. While a
+ * sub-image shares the underlying buffer object with the parent
+ * image and other sibling sub-images, the life times of parent and
+ * sub-images are not dependent. Destroying the parent or a
+ * sub-image doesn't affect other images. The underlying buffer
+ * object is free when no __DRIimage remains that references it.
+ *
+ * Sub-images may overlap, but rendering to overlapping sub-images
+ * is undefined.
+ *
+ * \since 5
+ */
+ __DRIimage *(*createSubImage)(__DRIimage *image,
+ int width, int height, int format,
+ int offset, int pitch,
+ void *loaderPrivate);
};
@@ -1004,4 +1049,21 @@ struct __DRI2configQueryExtensionRec {
int (*configQueryi)(__DRIscreen *screen, const char *var, GLint *val);
int (*configQueryf)(__DRIscreen *screen, const char *var, GLfloat *val);
};
+
+/**
+ * Robust context driver extension.
+ *
+ * Existence of this extension means the driver can accept the
+ * \c __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS flag and the
+ * \c __DRI_CTX_ATTRIB_RESET_STRATEGY attribute in
+ * \c __DRIdri2ExtensionRec::createContextAttribs.
+ */
+#define __DRI2_ROBUSTNESS "DRI_Robustness"
+#define __DRI2_ROBUSTNESS_VERSION 1
+
+typedef struct __DRIrobustnessExtensionRec __DRIrobustnessExtension;
+struct __DRIrobustnessExtensionRec {
+ __DRIextension base;
+};
+
#endif
diff --git a/mesalib/src/mapi/glapi/gen/ARB_draw_buffers.xml b/mesalib/src/mapi/glapi/gen/ARB_draw_buffers.xml
index f8ecc11ee..3d4717267 100644
--- a/mesalib/src/mapi/glapi/gen/ARB_draw_buffers.xml
+++ b/mesalib/src/mapi/glapi/gen/ARB_draw_buffers.xml
@@ -121,67 +121,4 @@
</function>
</category>
-<!--
- This extension serves a similar purpose to ARB_draw_buffers except
- that this is for OpenGL ES 2.0.
--->
-<category name="GL_NV_draw_buffers" number="91">
- <enum name="MAX_DRAW_BUFFERS_NV" count="1" value="0x8824">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER0_NV" count="1" value="0x8825">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER1_NV" count="1" value="0x8826">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER2_NV" count="1" value="0x8827">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER3_NV" count="1" value="0x8828">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER4_NV" count="1" value="0x8829">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER5_NV" count="1" value="0x882A">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER6_NV" count="1" value="0x882B">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER7_NV" count="1" value="0x882C">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER8_NV" count="1" value="0x882D">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER9_NV" count="1" value="0x882E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER10_NV" count="1" value="0x882F">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER11_NV" count="1" value="0x8830">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER12_NV" count="1" value="0x8831">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER13_NV" count="1" value="0x8832">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER14_NV" count="1" value="0x8833">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="DRAW_BUFFER15_NV" count="1" value="0x8834">
- <size name="Get" mode="get"/>
- </enum>
-
- <function name="DrawBuffersNV" alias="DrawBuffersARB">
- <param name="n" type="GLsizei" counter="true"/>
- <param name="bufs" type="const GLenum *" count="n"/>
- </function>
-</category>
-
</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am
index df3e82d89..52aeb3a6d 100644
--- a/mesalib/src/mapi/glapi/gen/Makefile.am
+++ b/mesalib/src/mapi/glapi/gen/Makefile.am
@@ -6,6 +6,26 @@
TOP = ../../../..
+# These are the "official" xserver indent flags from utils/modular/x-indent.sh
+XORG_INDENT_FLAGS = -linux -bad -bap -blf -bli0 -cbi0 -cdw -nce -cs -i4 -lc80 -psl -nbbo \
+ -nbc -psl -nbfda -nut -nss -T pointer -T ScreenPtr -T ScrnInfoPtr -T pointer \
+ -T DeviceIntPtr -T DevicePtr -T ClientPtr -T CallbackListPtr \
+ -T CallbackProcPtr -T OsTimerPtr -T CARD32 -T CARD16 -T CARD8 \
+ -T INT32 -T INT16 -T INT8 -T Atom -T Time -T WindowPtr -T DrawablePtr \
+ -T PixmapPtr -T ColormapPtr -T CursorPtr -T Font -T XID -T Mask \
+ -T BlockHandlerProcPtr -T WakeupHandlerProcPtr -T RegionPtr \
+ -T InternalEvent -T GrabPtr -T Timestamp -T Bool -T TimeStamp \
+ -T xEvent -T DeviceEvent -T RawDeviceEvent -T GrabMask -T Window \
+ -T Drawable -T FontPtr -T CallbackPtr -T XIPropertyValuePtr \
+ -T GrabParameters -T deviceKeyButtonPointer -T TouchOwnershipEvent \
+ -T xGenericEvent -T DeviceChangedEvent -T GCPtr -T BITS32 \
+ -T xRectangle -T BoxPtr -T RegionRec -T ValuatorMask -T KeyCode \
+ -T KeySymsPtr -T XkbDescPtr -T InputOption -T XI2Mask -T DevUnion \
+ -T DevPrivateKey -T DevScreenPrivateKey -T PropertyPtr -T RESTYPE \
+ -T XkbAction -T XkbChangesPtr -T XkbControlsPtr -T PrivatePtr -T pmWait \
+ -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT
+
+
MESA_DIR = $(TOP)/src/mesa
MESA_GLAPI_DIR = $(TOP)/src/mapi/glapi
MESA_MAPI_DIR = $(TOP)/src/mapi/mapi
@@ -144,13 +164,13 @@ clean-local:
######################################################################
$(XORG_GLAPI_DIR)/%.c: $(MESA_GLAPI_DIR)/%.c
- cp $< $@
+ $(INDENT) $(XORG_INDENT_FLAGS) < $< > $@
$(XORG_GLAPI_DIR)/dispatch.h: $(MESA_DIR)/main/dispatch.h
- cp $< $@
+ $(INDENT) $(XORG_INDENT_FLAGS) < $< > $@
$(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h
- cp $< $@
+ $(INDENT) $(XORG_INDENT_FLAGS) < $< > $@
######################################################################
@@ -216,31 +236,35 @@ $(MESA_GLX_DIR)/indirect_size.c: glX_proto_size.py $(COMMON_GLX)
######################################################################
$(XORG_GLX_DIR)/indirect_dispatch.c: glX_proto_recv.py $(COMMON_GLX)
- $(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m dispatch_c > $@
+ $(PYTHON_GEN) $(PYTHON_FLAGS) $< -f $(srcdir)/gl_API.xml -m dispatch_c \
+ | $(INDENT) $(XORG_INDENT_FLAGS) > $@
$(XORG_GLX_DIR)/indirect_dispatch_swap.c: glX_proto_recv.py $(COMMON_GLX)
- $(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m dispatch_c -s > $@
+ $(PYTHON_GEN) $(PYTHON_FLAGS) $< -f $(srcdir)/gl_API.xml -m dispatch_c -s \
+ | $(INDENT) $(XORG_INDENT_FLAGS) > $@
$(XORG_GLX_DIR)/indirect_dispatch.h: glX_proto_recv.py gl_and_glX_API.xml $(COMMON_GLX)
- $(PYTHON_GEN) $< -m dispatch_h -f $(srcdir)/gl_and_glX_API.xml -s > $@
+ $(PYTHON_GEN) $(PYTHON_FLAGS) $< -m dispatch_h -f $(srcdir)/gl_and_glX_API.xml -s \
+ | $(INDENT) $(XORG_INDENT_FLAGS) > $@
$(XORG_GLX_DIR)/indirect_size_get.h: glX_proto_size.py $(COMMON_GLX)
- $(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m size_h \
- --only-get -h '_INDIRECT_SIZE_GET_H_' \
- | $(INDENT) $(INDENT_FLAGS) > $@
+ $(PYTHON_GEN) $(PYTHON_FLAGS) $< -f $(srcdir)/gl_API.xml -m size_h \
+ --only-get -h '_INDIRECT_SIZE_GET_H_' \
+ | $(INDENT) $(XORG_INDENT_FLAGS) > $@
$(XORG_GLX_DIR)/indirect_size_get.c: glX_proto_size.py $(COMMON_GLX)
$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m size_c \
| $(INDENT) $(INDENT_FLAGS) > $@
$(XORG_GLX_DIR)/indirect_reqsize.h: glX_proto_size.py $(COMMON_GLX)
- $(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m reqsize_h \
- --only-get -h '_INDIRECT_SIZE_GET_H_' \
- | $(INDENT) $(INDENT_FLAGS) -l200 > $@
+ $(PYTHON_GEN) $(PYTHON_FLAGS) $< -f $(srcdir)/gl_API.xml -m reqsize_h \
+ --only-get -h '_INDIRECT_SIZE_GET_H_' \
+ | $(INDENT) $(XORG_INDENT_FLAGS) > $@
$(XORG_GLX_DIR)/indirect_reqsize.c: glX_proto_size.py $(COMMON_GLX)
- $(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml -m reqsize_c \
- | $(INDENT) $(INDENT_FLAGS) > $@
+ $(PYTHON_GEN) $(PYTHON_FLAGS) $< -f $(srcdir)/gl_API.xml -m reqsize_c \
+ | $(INDENT) $(XORG_INDENT_FLAGS) > $@
$(XORG_GLX_DIR)/indirect_table.c: glX_server_table.py gl_and_glX_API.xml $(COMMON_GLX)
- $(PYTHON_GEN) $< -f $(srcdir)/gl_and_glX_API.xml > $@
+ $(PYTHON_GEN) $(PYTHON_FLAGS) $< -f $(srcdir)/gl_and_glX_API.xml \
+ | $(INDENT) $(XORG_INDENT_FLAGS) > $@
diff --git a/mesalib/src/mapi/glapi/gen/es_EXT.xml b/mesalib/src/mapi/glapi/gen/es_EXT.xml
index ad83d9142..d012ccd5b 100644
--- a/mesalib/src/mapi/glapi/gen/es_EXT.xml
+++ b/mesalib/src/mapi/glapi/gen/es_EXT.xml
@@ -627,6 +627,69 @@
<enum name="REQUIRED_TEXTURE_IMAGE_UNITS_OES" value="0x8D68"/>
</category>
+<!--
+ This extension serves a similar purpose to ARB_draw_buffers except
+ that this is for OpenGL ES 2.0.
+-->
+<category name="GL_NV_draw_buffers" number="91">
+ <enum name="MAX_DRAW_BUFFERS_NV" count="1" value="0x8824">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER0_NV" count="1" value="0x8825">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER1_NV" count="1" value="0x8826">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER2_NV" count="1" value="0x8827">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER3_NV" count="1" value="0x8828">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER4_NV" count="1" value="0x8829">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER5_NV" count="1" value="0x882A">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER6_NV" count="1" value="0x882B">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER7_NV" count="1" value="0x882C">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER8_NV" count="1" value="0x882D">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER9_NV" count="1" value="0x882E">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER10_NV" count="1" value="0x882F">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER11_NV" count="1" value="0x8830">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER12_NV" count="1" value="0x8831">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER13_NV" count="1" value="0x8832">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER14_NV" count="1" value="0x8833">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="DRAW_BUFFER15_NV" count="1" value="0x8834">
+ <size name="Get" mode="get"/>
+ </enum>
+
+ <function name="DrawBuffersNV" alias="DrawBuffersARB">
+ <param name="n" type="GLsizei" counter="true"/>
+ <param name="bufs" type="const GLenum *" count="n"/>
+ </function>
+</category>
+
<!-- 93. GL_NV_read_buffer -->
<category name="NV_read_buffer">
<function name="ReadBufferNV" offset="assign">
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index 53707a80d..f9b2a73b2 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
@@ -554,7 +554,7 @@ const __DRIcoreExtension driCoreExtension = {
/** DRI2 interface */
const __DRIdri2Extension driDRI2Extension = {
- { __DRI_DRI2, __DRI_DRI2_VERSION },
+ { __DRI_DRI2, 3 },
dri2CreateNewScreen,
dri2CreateNewDrawable,
dri2CreateNewContext,
diff --git a/xorg-server/hw/xfree86/common/xf86.h b/xorg-server/hw/xfree86/common/xf86.h
index 8dc7dcccf..bb2903da0 100644
--- a/xorg-server/hw/xfree86/common/xf86.h
+++ b/xorg-server/hw/xfree86/common/xf86.h
@@ -422,6 +422,8 @@ extern _X_EXPORT void
xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
extern _X_EXPORT DisplayModePtr
xf86DuplicateMode(const DisplayModeRec * pMode);
+extern _X_EXPORT void
+xf86SaveModeContents(DisplayModePtr intern, const DisplayModeRec * pMode);
extern _X_EXPORT DisplayModePtr
xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList);
extern _X_EXPORT Bool
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c
index d20152ce6..2628409d2 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.c
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c
@@ -2453,7 +2453,7 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
xf86CrtcPtr crtc = crtcs[o];
if (mode && crtc) {
- crtc->desiredMode = *mode;
+ xf86SaveModeContents(&crtc->desiredMode, mode);
crtc->desiredRotation = output->initial_rotation;
crtc->desiredX = output->initial_x;
crtc->desiredY = output->initial_y;
@@ -2637,7 +2637,7 @@ xf86SetDesiredModes(ScrnInfoPtr scrn)
if (!mode)
return FALSE;
- crtc->desiredMode = *mode;
+ xf86SaveModeContents(&crtc->desiredMode, mode);
crtc->desiredRotation = RR_Rotate_0;
crtc->desiredTransformPresent = FALSE;
crtc->desiredX = 0;
@@ -2776,7 +2776,7 @@ xf86SetSingleMode(ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
if (!xf86CrtcSetModeTransform(crtc, crtc_mode, rotation, NULL, 0, 0))
ok = FALSE;
else {
- crtc->desiredMode = *crtc_mode;
+ xf86SaveModeContents(&crtc->desiredMode, crtc_mode);
crtc->desiredRotation = rotation;
crtc->desiredTransformPresent = FALSE;
crtc->desiredX = 0;
diff --git a/xorg-server/hw/xfree86/modes/xf86Modes.c b/xorg-server/hw/xfree86/modes/xf86Modes.c
index 2a6d26756..c4a3eb0a3 100644
--- a/xorg-server/hw/xfree86/modes/xf86Modes.c
+++ b/xorg-server/hw/xfree86/modes/xf86Modes.c
@@ -191,6 +191,21 @@ xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
}
/**
+ * Fills in a copy of mode, removing all stale pointer references.
+ * xf86ModesEqual will return true when comparing with original mode.
+ */
+void
+xf86SaveModeContents(DisplayModePtr intern, const DisplayModeRec *mode)
+{
+ *intern = *mode;
+ intern->prev = intern->next = NULL;
+ intern->name = NULL;
+ intern->PrivSize = 0;
+ intern->PrivFlags = 0;
+ intern->Private = NULL;
+}
+
+/**
* Allocates and returns a copy of pMode, including pointers within pMode.
*/
DisplayModePtr
diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c
index b4ed46aeb..4be0ea32f 100644
--- a/xorg-server/hw/xfree86/modes/xf86RandR12.c
+++ b/xorg-server/hw/xfree86/modes/xf86RandR12.c
@@ -1219,7 +1219,7 @@ xf86RandR12CrtcSet(ScreenPtr pScreen,
/*
* Save the last successful setting for EnterVT
*/
- crtc->desiredMode = mode;
+ xf86SaveModeContents(&crtc->desiredMode, &mode);
crtc->desiredRotation = rotation;
crtc->current_scanout = randr_crtc->scanout_pixmap;
if (transform) {