From 165450290d6c26756ede118f52ba2164abce7c9a Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 12 Jul 2012 07:52:51 +0200 Subject: mesa xserver git update 12 Jul 2012 --- mesalib/docs/WL_bind_wayland_display.spec | 90 ++++++++++++++++++++++++- mesalib/include/EGL/eglmesaext.h | 14 ++++ mesalib/include/GL/internal/dri_interface.h | 62 +++++++++++++++++ mesalib/src/mapi/glapi/gen/ARB_draw_buffers.xml | 63 ----------------- mesalib/src/mapi/glapi/gen/Makefile.am | 54 ++++++++++----- mesalib/src/mapi/glapi/gen/es_EXT.xml | 63 +++++++++++++++++ mesalib/src/mesa/drivers/dri/common/dri_util.c | 2 +- 7 files changed, 266 insertions(+), 82 deletions(-) (limited to 'mesalib') 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 in eglCreateImageKHR EGL_WAYLAND_BUFFER_WL 0x31D5 + Accepted in the 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 e37917eda..82e5fde7f 100644 --- a/mesalib/include/GL/internal/dri_interface.h +++ b/mesalib/include/GL/internal/dri_interface.h @@ -808,9 +808,27 @@ 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 */ @@ -901,12 +919,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 @@ -963,6 +988,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); }; @@ -1000,4 +1045,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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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, -- cgit v1.2.3