aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fontconfig/conf.d/30-metric-aliases.conf6
-rw-r--r--fontconfig/fc-lang/README28
-rw-r--r--include/xcb/xcb.h5
-rw-r--r--include/xcb/xcbext.h107
-rw-r--r--libX11/nls/en_US.UTF-8/Compose.pre6
-rw-r--r--libXext/src/XEVI.c6
-rw-r--r--libXext/src/Xge.c7
-rw-r--r--libxcb/src/xcb.h5
-rw-r--r--libxcb/src/xcb_auth.c72
-rw-r--r--libxcb/src/xcb_conn.c21
-rw-r--r--libxcb/src/xcb_in.c16
-rw-r--r--libxcb/src/xcb_util.c32
-rw-r--r--libxcb/src/xcbext.h107
-rw-r--r--libxcb/src/xcbint.h4
-rw-r--r--mesalib/docs/GL3.txt2
-rw-r--r--mesalib/docs/index.html6
-rw-r--r--mesalib/docs/relnotes.html1
-rw-r--r--mesalib/docs/relnotes/10.0.4.html191
-rw-r--r--mesalib/docs/specs/MESA_configless_context.spec125
-rw-r--r--mesalib/include/EGL/eglext.h960
-rw-r--r--mesalib/include/EGL/eglmesaext.h5
-rw-r--r--mesalib/include/c11/threads_posix.h2
-rw-r--r--mesalib/include/c11/threads_win32.h2
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.csv3
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.h4
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format_pack.py16
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c1210
-rwxr-xr-xmesalib/src/glsl/builtin_functions.cpp42
-rw-r--r--mesalib/src/glsl/ir_builder.cpp7
-rw-r--r--mesalib/src/glsl/ir_builder.h1
-rw-r--r--mesalib/src/glsl/linker.cpp15
-rw-r--r--mesalib/src/glsl/lower_packed_varyings.cpp4
-rw-r--r--mesalib/src/glsl/opt_algebraic.cpp8
-rw-r--r--mesalib/src/glsl/opt_dead_code_local.cpp26
-rw-r--r--mesalib/src/loader/Makefile.sources3
-rw-r--r--mesalib/src/loader/loader.c5
-rw-r--r--mesalib/src/loader/pci_id_driver_map.c55
-rw-r--r--mesalib/src/loader/pci_id_driver_map.h85
-rw-r--r--mesalib/src/mapi/mapi_glapi.c10
-rw-r--r--mesalib/src/mesa/main/blend.c4
-rw-r--r--mesalib/src/mesa/main/buffers.c7
-rw-r--r--mesalib/src/mesa/main/context.c82
-rw-r--r--mesalib/src/mesa/main/errors.c5
-rw-r--r--mesalib/src/mesa/main/fbobject.c4
-rw-r--r--mesalib/src/mesa/main/genmipmap.c4
-rw-r--r--mesalib/src/mesa/main/get.c6
-rw-r--r--mesalib/src/mesa/main/mipmap.c44
-rw-r--r--mesalib/src/mesa/main/mtypes.h6
-rw-r--r--mesalib/src/mesa/main/teximage.c16
-rw-r--r--mesalib/src/mesa/program/register_allocate.c76
-rw-r--r--mesalib/src/mesa/program/register_allocate.h8
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom.c22
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_rasterizer.c8
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_shader.c9
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h3
-rw-r--r--mesalib/src/mesa/state_tracker/st_draw.c10
-rw-r--r--mesalib/src/mesa/state_tracker/st_gen_mipmap.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.c4
-rw-r--r--mkfontscale/hash.c2
-rw-r--r--mkfontscale/mkfontscale.c2
-rw-r--r--pixman/pixman/pixman-arm-simd-asm.h23
-rw-r--r--pixman/test/lowlevel-blt-bench.c3
-rw-r--r--xorg-server/Xi/exevents.c2
-rw-r--r--xorg-server/glamor/glamor.c37
-rw-r--r--xorg-server/glamor/glamor.h19
-rw-r--r--xorg-server/glamor/glamor_addtraps.c2
-rw-r--r--xorg-server/glamor/glamor_copyarea.c19
-rw-r--r--xorg-server/glamor/glamor_copyplane.c15
-rw-r--r--xorg-server/glamor/glamor_core.c65
-rw-r--r--xorg-server/glamor/glamor_egl.c129
-rw-r--r--xorg-server/glamor/glamor_fbo.c2
-rw-r--r--xorg-server/glamor/glamor_fill.c74
-rw-r--r--xorg-server/glamor/glamor_fillspans.c11
-rw-r--r--xorg-server/glamor/glamor_getimage.c2
-rw-r--r--xorg-server/glamor/glamor_getspans.c2
-rw-r--r--xorg-server/glamor/glamor_glx.c8
-rw-r--r--xorg-server/glamor/glamor_glyphblt.c251
-rw-r--r--xorg-server/glamor/glamor_glyphs.c21
-rw-r--r--xorg-server/glamor/glamor_gradient.c14
-rw-r--r--xorg-server/glamor/glamor_picture.c4
-rw-r--r--xorg-server/glamor/glamor_pixmap.c20
-rw-r--r--xorg-server/glamor/glamor_polyfillrect.c11
-rw-r--r--xorg-server/glamor/glamor_polylines.c28
-rw-r--r--xorg-server/glamor/glamor_priv.h56
-rw-r--r--xorg-server/glamor/glamor_putimage.c197
-rw-r--r--xorg-server/glamor/glamor_render.c38
-rw-r--r--xorg-server/glamor/glamor_setspans.c12
-rw-r--r--xorg-server/glamor/glamor_tile.c4
-rw-r--r--xorg-server/glamor/glamor_trapezoid.c6
-rw-r--r--xorg-server/glamor/glamor_triangles.c15
-rw-r--r--xorg-server/glamor/glamor_utils.h33
-rw-r--r--xorg-server/glamor/glamor_xv.c3
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c16
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.h10
-rwxr-xr-xxorg-server/hw/kdrive/ephyr/hostx.c7
-rw-r--r--xorg-server/include/input.h6
-rw-r--r--xorg-server/include/xkbsrv.h11
-rw-r--r--xorg-server/miext/sync/misyncstr.h1
-rw-r--r--xorg-server/xkb/ddxLoad.c244
-rw-r--r--xorg-server/xkb/xkb.c16
-rw-r--r--xorg-server/xkb/xkbInit.c42
-rw-r--r--xorg-server/xkb/xkbUtils.c37
102 files changed, 2531 insertions, 2520 deletions
diff --git a/fontconfig/conf.d/30-metric-aliases.conf b/fontconfig/conf.d/30-metric-aliases.conf
index 49a960247..08c8ba328 100644
--- a/fontconfig/conf.d/30-metric-aliases.conf
+++ b/fontconfig/conf.d/30-metric-aliases.conf
@@ -77,12 +77,15 @@ but in an order preferring similar designs first. We do this in three steps:
</default>
</alias>
+<!--
+ Due to Bug#73291, commented out those lines until the broken font are fixed.
<alias binding="same">
<family>TeX Gyre Termes</family>
<default>
<family>Times</family>
</default>
</alias>
+-->
<alias binding="same">
<family>Nimbus Mono L</family>
@@ -415,7 +418,10 @@ but in an order preferring similar designs first. We do this in three steps:
<alias binding="same">
<family>Times</family>
<accept>
+<!--
+ Due to Bug#73291, commented out this line until the broken font are fixed.
<family>TeX Gyre Termes</family>
+-->
<family>Nimbus Roman No9 L</family>
</accept>
</alias>
diff --git a/fontconfig/fc-lang/README b/fontconfig/fc-lang/README
new file mode 100644
index 000000000..4aef7d116
--- /dev/null
+++ b/fontconfig/fc-lang/README
@@ -0,0 +1,28 @@
+Requirements for adding new orth file:
+
+* we are following up to the locale name, 2 or 3 letter code
+ in ISO 639 and ISO 3166-1 alpha-2 code to determine a
+ filename. if it's not yet available, in advance, you
+ should get it fixed in glibc or so.
+
+* Please add a reference URL (written in English as far as
+ possible) into the orth file that explains the code
+ coverage for the certain language. this would helps to
+ review if it has enough coverage.
+
+* no need to add all of the codepoints for the certain
+ language. good enough if it covers most frequently used
+ codepoints in it.
+
+To update existing orth files:
+
+* Please make sure how the changes affects to the existing
+ fonts and no regressions except it is expected behavior.
+
+* Please add any reference URL in bugzilla or any
+ explanation why it needs to be added/removed and also why
+ current orth file doesn't work.
+
+* Please provide a test case what fonts are supposed to be
+ accepted against the change and what fonts aren't.
+
diff --git a/include/xcb/xcb.h b/include/xcb/xcb.h
index 18704c3f2..ec5cd3301 100644
--- a/include/xcb/xcb.h
+++ b/include/xcb/xcb.h
@@ -324,7 +324,7 @@ typedef struct xcb_special_event xcb_special_event_t;
*/
xcb_generic_event_t *xcb_poll_for_special_event(xcb_connection_t *c,
xcb_special_event_t *se);
-
+
/**
* @brief Returns the next event from a special queue, blocking until one arrives
*/
@@ -335,7 +335,6 @@ xcb_generic_event_t *xcb_wait_for_special_event(xcb_connection_t *c,
*/
typedef struct xcb_extension_t xcb_extension_t; /**< Opaque structure used as key for xcb_get_extension_data_t. */
-
/**
* @brief Listen for a special event
*/
@@ -489,7 +488,7 @@ xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info);
* @param c: The connection.
*
* Closes the file descriptor and frees all memory associated with the
- * connection @c c.
+ * connection @c c. If @p c is @c NULL, nothing is done.
*/
void xcb_disconnect(xcb_connection_t *c);
diff --git a/include/xcb/xcbext.h b/include/xcb/xcbext.h
index 20ec1c37a..7587513d7 100644
--- a/include/xcb/xcbext.h
+++ b/include/xcb/xcbext.h
@@ -58,11 +58,56 @@ enum xcb_send_request_flags_t {
XCB_REQUEST_REPLY_FDS = 1 << 3
};
+/**
+ * @brief Send a request to the server.
+ * @param c: The connection to the X server.
+ * @param flags: A combination of flags from the xcb_send_request_flags_t enumeration.
+ * @param vector: Data to send; must have two iovecs before start for internal use.
+ * @param request: Information about the request to be sent.
+ * @return The request's sequence number on success, 0 otherwise.
+ *
+ * This function sends a new request to the X server. The data of the request is
+ * given as an array of @c iovecs in the @p vector argument. The length of that
+ * array and the neccessary management information are given in the @p request
+ * argument.
+ *
+ * When this function returns, the request might or might not be sent already.
+ * Use xcb_flush() to make sure that it really was sent.
+ *
+ * Please note that this function is not the prefered way for sending requests.
+ * It's better to use the generated wrapper functions.
+ *
+ * Please note that xcb might use index -1 and -2 of the @p vector array internally,
+ * so they must be valid!
+ */
unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *request);
+/**
+ * @brief Send a file descriptor to the server in the next call to xcb_send_request.
+ * @param c: The connection to the X server.
+ * @param fd: The file descriptor to send.
+ *
+ * After this function returns, the file descriptor given is owned by xcb and
+ * will be closed eventually.
+ *
+ * FIXME: How the heck is this supposed to work in a thread-safe way? There is a
+ * race between two threads doing xcb_send_fd(); xcb_send_request(); at the same
+ * time.
+ */
void xcb_send_fd(xcb_connection_t *c, int fd);
-/* xcb_take_socket allows external code to ask XCB for permission to
+/**
+ * @brief Take over the write side of the socket
+ * @param c: The connection to the X server.
+ * @param return_socket: Callback function that will be called when xcb wants
+ * to use the socket again.
+ * @param closure: Argument to the callback function.
+ * @param flags: A combination of flags from the xcb_send_request_flags_t enumeration.
+ * @param sent: Location to the sequence number of the last sequence request.
+ * Must not be NULL.
+ * @return 1 on success, else 0.
+ *
+ * xcb_take_socket allows external code to ask XCB for permission to
* take over the write side of the socket and send raw data with
* xcb_writev. xcb_take_socket provides the sequence number of the last
* request XCB sent. The caller of xcb_take_socket must supply a
@@ -71,10 +116,24 @@ void xcb_send_fd(xcb_connection_t *c, int fd);
* external socket owner and flushes any output queues if appropriate.
* If you are sending requests which won't cause a reply, please note the
* comment for xcb_writev which explains some sequence number wrap issues.
- * */
+ *
+ * All replies that are generated while the socket is owned externally have
+ * @p flags applied to them. For example, use XCB_REQUEST_CHECK if you don't
+ * want errors to go to xcb's normal error handling, but instead having to be
+ * picked up via xcb_wait_for_reply(), xcb_poll_for_reply() or
+ * xcb_request_check().
+ */
int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), void *closure, int flags, uint64_t *sent);
-/* You must own the write-side of the socket (you've called
+/**
+ * @brief Send raw data to the X server.
+ * @param c: The connection to the X server.
+ * @param vector: Array of data to be sent.
+ * @param count: Number of entries in @p vector.
+ * @param requests: Number of requests that are being sent.
+ * @return 1 on success, else 0.
+ *
+ * You must own the write-side of the socket (you've called
* xcb_take_socket, and haven't returned from return_socket yet) to call
* xcb_writev. Also, the iovec must have at least 1 byte of data in it.
* You have to make sure that xcb can detect sequence number wraps correctly.
@@ -83,20 +142,60 @@ int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), v
* requests without a reply, you have to insert a request which will cause a
* reply. You can again use GetInputFocus for this. You do not have to wait for
* any of the GetInputFocus replies, but can instead handle them via
- * xcb_discard_reply(). */
+ * xcb_discard_reply().
+ */
int xcb_writev(xcb_connection_t *c, struct iovec *vector, int count, uint64_t requests);
/* xcb_in.c */
+/**
+ * @brief Wait for the reply of a given request.
+ * @param c: The connection to the X server.
+ * @param request: Sequence number of the request as returned by xcb_send_request().
+ * @param e: Location to store errors in, or NULL. Ignored for unchecked requests.
+ *
+ * Returns the reply to the given request or returns null in the event of
+ * errors. Blocks until the reply or error for the request arrives, or an I/O
+ * error occurs.
+ */
void *xcb_wait_for_reply(xcb_connection_t *c, unsigned int request, xcb_generic_error_t **e);
+
+/**
+ * @brief Poll for the reply of a given request.
+ * @param c: The connection to the X server.
+ * @param request: Sequence number of the request as returned by xcb_send_request().
+ * @param reply: Location to store the reply in, must not be NULL.
+ * @param e: Location to store errors in, or NULL. Ignored for unchecked requests.
+ * @return 1 when the reply to the request was returned, else 0.
+ *
+ * Checks if the reply to the given request already received. Does not block.
+ */
int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply, xcb_generic_error_t **error);
+
+/**
+ * @brief Don't use this, only needed by the generated code.
+ * @param c: The connection to the X server.
+ * @param reply: A reply that was received from the server
+ * @param replylen: The size of the reply.
+ * @return Pointer to the location where received file descriptors are stored.
+ */
int *xcb_get_reply_fds(xcb_connection_t *c, void *reply, size_t replylen);
/* xcb_util.c */
+/**
+ * @param mask: The mask to check
+ * @return The number of set bits in the mask
+ */
int xcb_popcount(uint32_t mask);
+
+/**
+ * @param list: The base of an array
+ * @param len: The length of the array
+ * @return The sum of all entries in the array.
+ */
int xcb_sumof(uint8_t *list, int len);
#ifdef __cplusplus
diff --git a/libX11/nls/en_US.UTF-8/Compose.pre b/libX11/nls/en_US.UTF-8/Compose.pre
index 5434425b1..498093ffa 100644
--- a/libX11/nls/en_US.UTF-8/Compose.pre
+++ b/libX11/nls/en_US.UTF-8/Compose.pre
@@ -285,7 +285,7 @@ XCOMM There are some conflicts among sequences, but I left them alone.
XCOMM
XCOMM group 1: cluster jamos made of three basic jamos
-/* The follwing block gets overridden by later shorter compositions
+/* The following block gets overridden by later shorter compositions
* <Multi_key> <U1107> <U1109> <U1100> : "ᄢ" U1122 # HANGUL CHOSEONG PIEUP-SIOS-KIYEOK
* <Multi_key> <U1107> <U1109> <U1103> : "ᄣ" U1123 # HANGUL CHOSEONG PIEUP-SIOS-TIKEUT
* <Multi_key> <U1107> <U1109> <U1107> : "ᄤ" U1124 # HANGUL CHOSEONG PIEUP-SIOS-PIEUP
@@ -818,8 +818,8 @@ XCOMM Part 3
<Multi_key> <macron> <a> : "ā" U0101 # LATIN SMALL LETTER A WITH MACRON
<Multi_key> <underscore> <a> : "ā" U0101 # LATIN SMALL LETTER A WITH MACRON
<Multi_key> <a> <underscore> : "ā" U0101 # LATIN SMALL LETTER A WITH MACRON
-<Multi_key> <minus> <a> : "ā" U0100 # LATIN CAPITAL LETTER A WITH MACRON
-<Multi_key> <a> <minus> : "ā" U0100 # LATIN CAPITAL LETTER A WITH MACRON
+<Multi_key> <minus> <a> : "ā" U0101 # LATIN SMALL LETTER A WITH MACRON
+<Multi_key> <a> <minus> : "ā" U0101 # LATIN SMALL LETTER A WITH MACRON
<dead_breve> <A> : "Ă" U0102 # LATIN CAPITAL LETTER A WITH BREVE
<Multi_key> <U> <A> : "Ă" U0102 # LATIN CAPITAL LETTER A WITH BREVE
<Multi_key> <b> <A> : "Ă" U0102 # LATIN CAPITAL LETTER A WITH BREVE
diff --git a/libXext/src/XEVI.c b/libXext/src/XEVI.c
index 6d77fdf10..c9b172c41 100644
--- a/libXext/src/XEVI.c
+++ b/libXext/src/XEVI.c
@@ -183,8 +183,10 @@ Status XeviGetVisualInfo(
_XEatDataWords(dpy, rep.length);
UnlockDisplay(dpy);
SyncHandle();
- if (evi_return)
- Xfree(evi_return);
+ if (*evi_return) {
+ Xfree(*evi_return);
+ *evi_return = NULL;
+ }
if (temp_xInfo)
Xfree(temp_xInfo);
if (temp_conflict)
diff --git a/libXext/src/Xge.c b/libXext/src/Xge.c
index 5c4d72dd7..2811ae889 100644
--- a/libXext/src/Xge.c
+++ b/libXext/src/Xge.c
@@ -265,9 +265,6 @@ _xgeWireToEvent(Display* dpy, XEvent* re, xEvent *event)
it = it->next;
}
- fprintf(stderr,
- "_xgeWireToEvent: Unknown extension %d, this should never happen.\n",
- extension);
return False;
}
@@ -295,10 +292,6 @@ _xgeEventToWire(Display* dpy, XEvent* re, xEvent* event)
it = it->next;
}
- fprintf(stderr,
- "_xgeEventToWire: Unknown extension %d, this should never happen.\n",
- extension);
-
return Success;
}
diff --git a/libxcb/src/xcb.h b/libxcb/src/xcb.h
index 18704c3f2..ec5cd3301 100644
--- a/libxcb/src/xcb.h
+++ b/libxcb/src/xcb.h
@@ -324,7 +324,7 @@ typedef struct xcb_special_event xcb_special_event_t;
*/
xcb_generic_event_t *xcb_poll_for_special_event(xcb_connection_t *c,
xcb_special_event_t *se);
-
+
/**
* @brief Returns the next event from a special queue, blocking until one arrives
*/
@@ -335,7 +335,6 @@ xcb_generic_event_t *xcb_wait_for_special_event(xcb_connection_t *c,
*/
typedef struct xcb_extension_t xcb_extension_t; /**< Opaque structure used as key for xcb_get_extension_data_t. */
-
/**
* @brief Listen for a special event
*/
@@ -489,7 +488,7 @@ xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info);
* @param c: The connection.
*
* Closes the file descriptor and frees all memory associated with the
- * connection @c c.
+ * connection @c c. If @p c is @c NULL, nothing is done.
*/
void xcb_disconnect(xcb_connection_t *c);
diff --git a/libxcb/src/xcb_auth.c b/libxcb/src/xcb_auth.c
index 0514a77e7..de628a6e4 100644
--- a/libxcb/src/xcb_auth.c
+++ b/libxcb/src/xcb_auth.c
@@ -89,11 +89,11 @@ static int authnameslen[N_AUTH_PROTOS] = {
static size_t memdup(char **dst, void *src, size_t len)
{
if(len)
- *dst = malloc(len);
+ *dst = malloc(len);
else
- *dst = 0;
+ *dst = 0;
if(!*dst)
- return 0;
+ return 0;
memcpy(*dst, src, len);
return len;
}
@@ -101,9 +101,9 @@ static size_t memdup(char **dst, void *src, size_t len)
static int authname_match(enum auth_protos kind, char *name, size_t namelen)
{
if(authnameslen[kind] != namelen)
- return 0;
+ return 0;
if(memcmp(authnames[kind], name, namelen))
- return 0;
+ return 0;
return 1;
}
@@ -183,7 +183,7 @@ static void do_append(char *buf, int *idxp, void *val, size_t valsize) {
*idxp += valsize;
}
#endif
-
+
static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *sockname)
{
if (authname_match(AUTH_MC1, authptr->name, authptr->name_length)) {
@@ -195,22 +195,22 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
#ifdef HASXDMAUTH
#define APPEND(buf,idx,val) do_append((buf),&(idx),&(val),sizeof(val))
if (authname_match(AUTH_XA1, authptr->name, authptr->name_length)) {
- int j;
+ int j;
- info->data = malloc(192 / 8);
- if(!info->data)
- return 0;
+ info->data = malloc(192 / 8);
+ if(!info->data)
+ return 0;
- for (j = 0; j < 8; j++)
- info->data[j] = authptr->data[j];
- switch(sockname->sa_family) {
+ for (j = 0; j < 8; j++)
+ info->data[j] = authptr->data[j];
+ switch(sockname->sa_family) {
case AF_INET:
/*block*/ {
- struct sockaddr_in *si = (struct sockaddr_in *) sockname;
- APPEND(info->data, j, si->sin_addr.s_addr);
- APPEND(info->data, j, si->sin_port);
- }
- break;
+ struct sockaddr_in *si = (struct sockaddr_in *) sockname;
+ APPEND(info->data, j, si->sin_addr.s_addr);
+ APPEND(info->data, j, si->sin_port);
+ }
+ break;
#ifdef AF_INET6
case AF_INET6:
/*block*/ {
@@ -235,26 +235,26 @@ static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *
#endif
case AF_UNIX:
/*block*/ {
- uint32_t fakeaddr = htonl(0xffffffff - next_nonce());
- uint16_t fakeport = htons(getpid());
- APPEND(info->data, j, fakeaddr);
- APPEND(info->data, j, fakeport);
- }
- break;
+ uint32_t fakeaddr = htonl(0xffffffff - next_nonce());
+ uint16_t fakeport = htons(getpid());
+ APPEND(info->data, j, fakeaddr);
+ APPEND(info->data, j, fakeport);
+ }
+ break;
default:
free(info->data);
return 0; /* do not know how to build this */
- }
- {
- uint32_t now = htonl(time(0));
- APPEND(info->data, j, now);
- }
- assert(j <= 192 / 8);
- while (j < 192 / 8)
- info->data[j++] = 0;
- info->datalen = j;
- XdmcpWrap ((unsigned char *) info->data, (unsigned char *) authptr->data + 8, (unsigned char *) info->data, info->datalen);
- return 1;
+ }
+ {
+ uint32_t now = htonl(time(0));
+ APPEND(info->data, j, now);
+ }
+ assert(j <= 192 / 8);
+ while (j < 192 / 8)
+ info->data[j++] = 0;
+ info->datalen = j;
+ XdmcpWrap ((unsigned char *) info->data, (unsigned char *) authptr->data + 8, (unsigned char *) info->data, info->datalen);
+ return 1;
}
#undef APPEND
#endif
@@ -273,7 +273,7 @@ typedef int (*LPFN_GETPEERNAME)(int,struct sockaddr *,socklen_t *);
(according to POSIX, applications should not assume a particular
length for `sockaddr_un.sun_path') */
static struct sockaddr *get_peer_sock_name(LPFN_GETPEERNAME socket_func,
- int fd)
+ int fd)
{
socklen_t socknamelen = sizeof(struct sockaddr) + INITIAL_SOCKNAME_SLACK;
socklen_t actual_socknamelen = socknamelen;
diff --git a/libxcb/src/xcb_conn.c b/libxcb/src/xcb_conn.c
index 7a4ae5646..e9ab62a0d 100644
--- a/libxcb/src/xcb_conn.c
+++ b/libxcb/src/xcb_conn.c
@@ -70,21 +70,30 @@ typedef struct {
uint16_t length;
} xcb_setup_generic_t;
+/* Keep this list in sync with is_static_error_conn()! */
static const int xcb_con_error = XCB_CONN_ERROR;
static const int xcb_con_closed_mem_er = XCB_CONN_CLOSED_MEM_INSUFFICIENT;
static const int xcb_con_closed_parse_er = XCB_CONN_CLOSED_PARSE_ERR;
static const int xcb_con_closed_screen_er = XCB_CONN_CLOSED_INVALID_SCREEN;
+static int is_static_error_conn(xcb_connection_t *c)
+{
+ return c == (xcb_connection_t *) &xcb_con_error ||
+ c == (xcb_connection_t *) &xcb_con_closed_mem_er ||
+ c == (xcb_connection_t *) &xcb_con_closed_parse_er ||
+ c == (xcb_connection_t *) &xcb_con_closed_screen_er;
+}
+
static int set_fd_flags(const int fd)
{
/* Win32 doesn't have file descriptors and the fcntl function. This block sets the socket in non-blocking mode */
#ifdef _WIN32
- u_long iMode = 1; /* non-zero puts it in non-blocking mode, 0 in blocking mode */
+ u_long iMode = 1; /* non-zero puts it in non-blocking mode, 0 in blocking mode */
int ret;
ret = ioctlsocket(fd, FIONBIO, &iMode);
- if(ret != 0)
+ if(ret != 0)
return 0;
return 1;
#else
@@ -201,7 +210,7 @@ static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
an iovec would require more work and I'm not sure of the benefit....works for now */
vec = *vector;
while(i < cnt)
- {
+ {
char *p= vec->iov_base;
size_t l= vec->iov_len;
while (l > 0)
@@ -233,7 +242,7 @@ static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
assert(!c->out.queue_len);
n = *count;
if (n > IOV_MAX)
- n = IOV_MAX;
+ n = IOV_MAX;
#if HAVE_SENDMSG
if (c->out.out_fd.nfd) {
@@ -271,7 +280,7 @@ static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
return 1;
}
-#endif /* _WIN32 */
+#endif /* _WIN32 */
if(n <= 0)
{
@@ -362,7 +371,7 @@ xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
void xcb_disconnect(xcb_connection_t *c)
{
- if(c->has_error)
+ if(c == NULL || is_static_error_conn(c))
return;
free(c->setup);
diff --git a/libxcb/src/xcb_in.c b/libxcb/src/xcb_in.c
index 1eef6caf5..559a6e3ea 100644
--- a/libxcb/src/xcb_in.c
+++ b/libxcb/src/xcb_in.c
@@ -201,9 +201,9 @@ static int read_packet(xcb_connection_t *c)
c->in.request_completed = c->in.request_read - 1;
}
- while(c->in.pending_replies &&
+ while(c->in.pending_replies &&
c->in.pending_replies->workaround != WORKAROUND_EXTERNAL_SOCKET_OWNER &&
- XCB_SEQUENCE_COMPARE (c->in.pending_replies->last_request, <=, c->in.request_completed))
+ XCB_SEQUENCE_COMPARE (c->in.pending_replies->last_request, <=, c->in.request_completed))
{
pending_reply *oldpend = c->in.pending_replies;
c->in.pending_replies = oldpend->next;
@@ -387,11 +387,11 @@ static int read_block(const int fd, void *buf, const ssize_t len)
FD_ZERO(&fds);
FD_SET(fd, &fds);
- /* Initializing errno here makes sure that for Win32 this loop will execute only once */
- errno = 0;
- do {
- ret = select(fd + 1, &fds, 0, 0, 0);
- } while (ret == -1 && errno == EINTR);
+ /* Initializing errno here makes sure that for Win32 this loop will execute only once */
+ errno = 0;
+ do {
+ ret = select(fd + 1, &fds, 0, 0, 0);
+ } while (ret == -1 && errno == EINTR);
#endif /* USE_POLL */
}
if(ret <= 0)
@@ -747,7 +747,7 @@ xcb_register_for_special_xge(xcb_connection_t *c,
pthread_mutex_unlock(&c->iolock);
return NULL;
}
-
+
se->extension = ext_reply->major_opcode;
se->eid = eid;
diff --git a/libxcb/src/xcb_util.c b/libxcb/src/xcb_util.c
index bfb6fca83..3cf752644 100644
--- a/libxcb/src/xcb_util.c
+++ b/libxcb/src/xcb_util.c
@@ -250,8 +250,8 @@ static int _xcb_open(const char *host, char *protocol, const int display)
free(file);
if (fd < 0 && !protocol && *host == '\0') {
- unsigned short port = X_TCP_PORT + display;
- fd = _xcb_open_tcp(host, protocol, port);
+ unsigned short port = X_TCP_PORT + display;
+ fd = _xcb_open_tcp(host, protocol, port);
}
return fd;
@@ -268,10 +268,10 @@ static int _xcb_socket(int family, int type, int proto)
if (fd == -1 && errno == EINVAL)
#endif
{
- fd = socket(family, type, proto);
+ fd = socket(family, type, proto);
#ifndef _WIN32
- if (fd >= 0)
- fcntl(fd, F_SETFD, FD_CLOEXEC);
+ if (fd >= 0)
+ fcntl(fd, F_SETFD, FD_CLOEXEC);
#endif
}
return fd;
@@ -279,15 +279,15 @@ static int _xcb_socket(int family, int type, int proto)
static int _xcb_do_connect(int fd, const struct sockaddr* addr, int addrlen) {
- char on = 1;
+ char on = 1;
- if(fd < 0)
- return -1;
+ if(fd < 0)
+ return -1;
- setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
- setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
+ setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on));
+ setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
- return connect(fd, addr, addrlen);
+ return connect(fd, addr, addrlen);
}
#ifdef WIN32
@@ -319,13 +319,13 @@ static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short
if (protocol && strcmp("tcp",protocol) && strcmp("inet",protocol)
#ifdef AF_INET6
- && strcmp("inet6",protocol)
+ && strcmp("inet6",protocol)
#endif
- )
+ )
return -1;
-
+
if (*host == '\0')
- host = "localhost";
+ host = "localhost";
#if HAVE_GETADDRINFO
memset(&hints, 0, sizeof(hints));
@@ -463,7 +463,7 @@ xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname,
xcb_connection_t *c;
int parsed = _xcb_parse_display(displayname, &host, &protocol, &display, screenp);
-
+
if(!parsed) {
c = _xcb_conn_ret_error(XCB_CONN_CLOSED_PARSE_ERR);
goto out;
diff --git a/libxcb/src/xcbext.h b/libxcb/src/xcbext.h
index 20ec1c37a..7587513d7 100644
--- a/libxcb/src/xcbext.h
+++ b/libxcb/src/xcbext.h
@@ -58,11 +58,56 @@ enum xcb_send_request_flags_t {
XCB_REQUEST_REPLY_FDS = 1 << 3
};
+/**
+ * @brief Send a request to the server.
+ * @param c: The connection to the X server.
+ * @param flags: A combination of flags from the xcb_send_request_flags_t enumeration.
+ * @param vector: Data to send; must have two iovecs before start for internal use.
+ * @param request: Information about the request to be sent.
+ * @return The request's sequence number on success, 0 otherwise.
+ *
+ * This function sends a new request to the X server. The data of the request is
+ * given as an array of @c iovecs in the @p vector argument. The length of that
+ * array and the neccessary management information are given in the @p request
+ * argument.
+ *
+ * When this function returns, the request might or might not be sent already.
+ * Use xcb_flush() to make sure that it really was sent.
+ *
+ * Please note that this function is not the prefered way for sending requests.
+ * It's better to use the generated wrapper functions.
+ *
+ * Please note that xcb might use index -1 and -2 of the @p vector array internally,
+ * so they must be valid!
+ */
unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *request);
+/**
+ * @brief Send a file descriptor to the server in the next call to xcb_send_request.
+ * @param c: The connection to the X server.
+ * @param fd: The file descriptor to send.
+ *
+ * After this function returns, the file descriptor given is owned by xcb and
+ * will be closed eventually.
+ *
+ * FIXME: How the heck is this supposed to work in a thread-safe way? There is a
+ * race between two threads doing xcb_send_fd(); xcb_send_request(); at the same
+ * time.
+ */
void xcb_send_fd(xcb_connection_t *c, int fd);
-/* xcb_take_socket allows external code to ask XCB for permission to
+/**
+ * @brief Take over the write side of the socket
+ * @param c: The connection to the X server.
+ * @param return_socket: Callback function that will be called when xcb wants
+ * to use the socket again.
+ * @param closure: Argument to the callback function.
+ * @param flags: A combination of flags from the xcb_send_request_flags_t enumeration.
+ * @param sent: Location to the sequence number of the last sequence request.
+ * Must not be NULL.
+ * @return 1 on success, else 0.
+ *
+ * xcb_take_socket allows external code to ask XCB for permission to
* take over the write side of the socket and send raw data with
* xcb_writev. xcb_take_socket provides the sequence number of the last
* request XCB sent. The caller of xcb_take_socket must supply a
@@ -71,10 +116,24 @@ void xcb_send_fd(xcb_connection_t *c, int fd);
* external socket owner and flushes any output queues if appropriate.
* If you are sending requests which won't cause a reply, please note the
* comment for xcb_writev which explains some sequence number wrap issues.
- * */
+ *
+ * All replies that are generated while the socket is owned externally have
+ * @p flags applied to them. For example, use XCB_REQUEST_CHECK if you don't
+ * want errors to go to xcb's normal error handling, but instead having to be
+ * picked up via xcb_wait_for_reply(), xcb_poll_for_reply() or
+ * xcb_request_check().
+ */
int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), void *closure, int flags, uint64_t *sent);
-/* You must own the write-side of the socket (you've called
+/**
+ * @brief Send raw data to the X server.
+ * @param c: The connection to the X server.
+ * @param vector: Array of data to be sent.
+ * @param count: Number of entries in @p vector.
+ * @param requests: Number of requests that are being sent.
+ * @return 1 on success, else 0.
+ *
+ * You must own the write-side of the socket (you've called
* xcb_take_socket, and haven't returned from return_socket yet) to call
* xcb_writev. Also, the iovec must have at least 1 byte of data in it.
* You have to make sure that xcb can detect sequence number wraps correctly.
@@ -83,20 +142,60 @@ int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), v
* requests without a reply, you have to insert a request which will cause a
* reply. You can again use GetInputFocus for this. You do not have to wait for
* any of the GetInputFocus replies, but can instead handle them via
- * xcb_discard_reply(). */
+ * xcb_discard_reply().
+ */
int xcb_writev(xcb_connection_t *c, struct iovec *vector, int count, uint64_t requests);
/* xcb_in.c */
+/**
+ * @brief Wait for the reply of a given request.
+ * @param c: The connection to the X server.
+ * @param request: Sequence number of the request as returned by xcb_send_request().
+ * @param e: Location to store errors in, or NULL. Ignored for unchecked requests.
+ *
+ * Returns the reply to the given request or returns null in the event of
+ * errors. Blocks until the reply or error for the request arrives, or an I/O
+ * error occurs.
+ */
void *xcb_wait_for_reply(xcb_connection_t *c, unsigned int request, xcb_generic_error_t **e);
+
+/**
+ * @brief Poll for the reply of a given request.
+ * @param c: The connection to the X server.
+ * @param request: Sequence number of the request as returned by xcb_send_request().
+ * @param reply: Location to store the reply in, must not be NULL.
+ * @param e: Location to store errors in, or NULL. Ignored for unchecked requests.
+ * @return 1 when the reply to the request was returned, else 0.
+ *
+ * Checks if the reply to the given request already received. Does not block.
+ */
int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply, xcb_generic_error_t **error);
+
+/**
+ * @brief Don't use this, only needed by the generated code.
+ * @param c: The connection to the X server.
+ * @param reply: A reply that was received from the server
+ * @param replylen: The size of the reply.
+ * @return Pointer to the location where received file descriptors are stored.
+ */
int *xcb_get_reply_fds(xcb_connection_t *c, void *reply, size_t replylen);
/* xcb_util.c */
+/**
+ * @param mask: The mask to check
+ * @return The number of set bits in the mask
+ */
int xcb_popcount(uint32_t mask);
+
+/**
+ * @param list: The base of an array
+ * @param len: The length of the array
+ * @return The sum of all entries in the array.
+ */
int xcb_sumof(uint8_t *list, int len);
#ifdef __cplusplus
diff --git a/libxcb/src/xcbint.h b/libxcb/src/xcbint.h
index 67cf5711e..f89deba4a 100644
--- a/libxcb/src/xcbint.h
+++ b/libxcb/src/xcbint.h
@@ -53,7 +53,7 @@ enum lazy_reply_tag
#define XCB_PAD(i) (-(i) & 3)
-#define XCB_SEQUENCE_COMPARE(a,op,b) ((int64_t) ((a) - (b)) op 0)
+#define XCB_SEQUENCE_COMPARE(a,op,b) ((int64_t) ((a) - (b)) op 0)
#ifndef offsetof
#define offsetof(type,member) ((size_t) &((type *)0)->member)
@@ -80,7 +80,7 @@ void *_xcb_map_remove(_xcb_map *q, unsigned int key);
/* xcb_out.c */
#if HAVE_SENDMSG
-#define XCB_MAX_PASS_FD 16
+#define XCB_MAX_PASS_FD 16
typedef struct _xcb_fd {
int fd[XCB_MAX_PASS_FD];
diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt
index 9758dcca2..b7e4c8764 100644
--- a/mesalib/docs/GL3.txt
+++ b/mesalib/docs/GL3.txt
@@ -170,7 +170,7 @@ GL 4.4:
GLSL 4.4 not started
GL_MAX_VERTEX_ATTRIB_STRIDE not started
- GL_ARB_buffer_storage DONE (r300, r600, radeonsi)
+ GL_ARB_buffer_storage DONE (i965, r300, r600, radeonsi)
GL_ARB_clear_texture not started
GL_ARB_enhanced_layouts not started
GL_ARB_multi_bind started (Fredrik Höglund)
diff --git a/mesalib/docs/index.html b/mesalib/docs/index.html
index 925c22cd4..3342747e7 100644
--- a/mesalib/docs/index.html
+++ b/mesalib/docs/index.html
@@ -16,6 +16,12 @@
<h1>News</h1>
+<h2>March 12, 2014</h2>
+<p>
+<a href="relnotes/10.0.4.html">Mesa 10.0.4</a> is released.
+This is a bug-fix release.
+</p>
+
<h2>March 4, 2014</h2>
<p>
<a href="relnotes/10.1.html">Mesa 10.1</a> is released.
diff --git a/mesalib/docs/relnotes.html b/mesalib/docs/relnotes.html
index 430274c52..7ec7296fc 100644
--- a/mesalib/docs/relnotes.html
+++ b/mesalib/docs/relnotes.html
@@ -22,6 +22,7 @@ The release notes summarize what's new or changed in each Mesa release.
<ul>
<li><a href="relnotes/10.1.html">10.1 release notes</a>
+<li><a href="relnotes/10.0.4.html">10.0.4 release notes</a>
<li><a href="relnotes/10.0.3.html">10.0.3 release notes</a>
<li><a href="relnotes/10.0.2.html">10.0.2 release notes</a>
<li><a href="relnotes/10.0.1.html">10.0.1 release notes</a>
diff --git a/mesalib/docs/relnotes/10.0.4.html b/mesalib/docs/relnotes/10.0.4.html
new file mode 100644
index 000000000..9f94726ae
--- /dev/null
+++ b/mesalib/docs/relnotes/10.0.4.html
@@ -0,0 +1,191 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ <title>Mesa Release Notes</title>
+ <link rel="stylesheet" type="text/css" href="../mesa.css">
+</head>
+<body>
+
+<div class="header">
+ <h1>The Mesa 3D Graphics Library</h1>
+</div>
+
+<iframe src="../contents.html"></iframe>
+<div class="content">
+
+<h1>Mesa 10.0.4 Release Notes / (March 12, 2014)</h1>
+
+<p>
+Mesa 10.0.4 is a bug fix release which fixes bugs found since the 10.0.3 release.
+</p>
+<p>
+Mesa 10.0.4 implements the OpenGL 3.3 API, but the version reported by
+glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
+glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 3.3. OpenGL
+3.3 is <strong>only</strong> available if requested at context creation
+because compatibility contexts not supported.
+</p>
+
+
+<h2>MD5 checksums</h2>
+<pre>
+5a3c5b90776ec8a9fcd777c99e0607e2 MesaLib-10.0.4.tar.gz
+8b148869d2620b0720c8a8d2b7eb3e38 MesaLib-10.0.4.tar.bz2
+da2418d25bfbc273660af7e755fb367e MesaLib-10.0.4.zip
+</pre>
+
+
+<h2>New features</h2>
+<p>None</p>
+
+<h2>Bug fixes</h2>
+
+<p>This list is likely incomplete.</p>
+
+<ul>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=71870">Bug 71870</a> - Metro: Last Light rendering issues</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=72895">Bug 72895</a> - Missing trees in flightgear 2.12.1 with mesa 10.0.1</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=74251">Bug 74251</a> - Segfault in st_finalize_texture with Texture Buffer</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=74723">Bug 74723</a> - main/shaderapi.c:407: detach_shader: Assertion `shProg-&gt;Shaders[j]-&gt;Type == 0x8B31 || shProg-&gt;Shaders[j]-&gt;Type == 0x8B30' failed.</li>
+
+</ul>
+
+<h2>Changes</h2>
+
+<p>The full set of changes can be viewed by using the following git command:</p>
+
+<pre>
+ git log mesa-10.0.3..mesa-10.0.4
+</pre>
+
+<p>Anuj Phogat (4):</p>
+<ul>
+ <li>mesa: Generate correct error code in glDrawBuffers()</li>
+ <li>mesa: Add GL_TEXTURE_CUBE_MAP_ARRAY to legal_get_tex_level_parameter_target()</li>
+ <li>glsl: Fix condition to generate shader link error</li>
+ <li>i965: Fix the region's pitch condition to use blitter</li>
+</ul>
+
+<p>Brian Paul (8):</p>
+<ul>
+ <li>r200: move driContextSetFlags(ctx) call after ctx var is initialized</li>
+ <li>radeon: move driContextSetFlags(ctx) call after ctx var is initialized</li>
+ <li>gallium/auxiliary/indices: replace free() with FREE()</li>
+ <li>draw: fix incorrect color of flat-shaded clipped lines</li>
+ <li>st/mesa: avoid sw fallback for getting/decompressing textures</li>
+ <li>mesa: update assertion in detach_shader() for geom shaders</li>
+ <li>mesa: do depth/stencil format conversion in glGetTexImage</li>
+ <li>softpipe: use 64-bit arithmetic in softpipe_resource_layout()</li>
+</ul>
+
+<p>Carl Worth (4):</p>
+<ul>
+ <li>docs: Add md5sums for 10.0.3 release</li>
+ <li>main: Avoid double-free of shader Label</li>
+ <li>get-pick-list: Update to only find patches nominated for the 10.0 branch</li>
+ <li>Update version to 10.0.4</li>
+</ul>
+
+<p>Chris Forbes (1):</p>
+<ul>
+ <li>i965: Validate (and resolve) all the bound textures.</li>
+</ul>
+
+<p>Christian König (1):</p>
+<ul>
+ <li>radeon/uvd: fix feedback buffer handling v2</li>
+</ul>
+
+<p>Daniel Kurtz (1):</p>
+<ul>
+ <li>glsl: Add locking to builtin_builder singleton</li>
+</ul>
+
+<p>Emil Velikov (3):</p>
+<ul>
+ <li>dri/nouveau: Pass the API into _mesa_initialize_context</li>
+ <li>nv50: correctly calculate the number of vertical blocks during transfer map</li>
+ <li>dri/i9*5: correctly calculate the amount of system memory</li>
+</ul>
+
+<p>Fredrik Höglund (3):</p>
+<ul>
+ <li>mesa: Preserve the NewArrays state when copying a VAO</li>
+ <li>glx: Fix the default values for GLXFBConfig attributes</li>
+ <li>glx: Fix the GLXFBConfig attrib sort priorities</li>
+</ul>
+
+<p>Hans (2):</p>
+<ul>
+ <li>util: don't define isfinite(), isnan() for MSVC &gt;= 1800</li>
+ <li>mesa: don't define c99 math functions for MSVC &gt;= 1800</li>
+</ul>
+
+<p>Ian Romanick (6):</p>
+<ul>
+ <li>meta: Release resources used by decompress_texture_image</li>
+ <li>meta: Release resources used by _mesa_meta_DrawPixels</li>
+ <li>meta: Fallback to software for GetTexImage of compressed GL_TEXTURE_CUBE_MAP_ARRAY</li>
+ <li>meta: Consistenly use non-Apple VAO functions</li>
+ <li>glcpp: Only warn for macro names containing __</li>
+ <li>glsl: Only warn for macro names containing __</li>
+</ul>
+
+<p>Ilia Mirkin (3):</p>
+<ul>
+ <li>nv30: report 8 maximum inputs</li>
+ <li>nouveau/video: make sure that firmware is present when checking caps</li>
+ <li>nouveau: fix chipset checks for nv1a by using the oclass instead</li>
+</ul>
+
+<p>Julien Cristau (1):</p>
+<ul>
+ <li>glx/dri2: fix build failure on HURD</li>
+</ul>
+
+<p>Kenneth Graunke (2):</p>
+<ul>
+ <li>glsl: Don't lose precision qualifiers when encountering "centroid".</li>
+ <li>i965: Create a hardware context before initializing state module.</li>
+</ul>
+
+<p>Kusanagi Kouichi (1):</p>
+<ul>
+ <li>targets/vdpau: Always use c++ to link</li>
+</ul>
+
+<p>Marek Olšák (1):</p>
+<ul>
+ <li>st/mesa: fix crash when a shader uses a TBO and it's not bound</li>
+</ul>
+
+<p>Matt Turner (1):</p>
+<ul>
+ <li>glsl: Initialize ubo_binding_mask flags to zero.</li>
+</ul>
+
+<p>Paul Berry (2):</p>
+<ul>
+ <li>glsl: Make condition_to_hir() callable from outside ast_iteration_statement.</li>
+ <li>glsl: Fix continue statements in do-while loops.</li>
+</ul>
+
+<p>Tom Stellard (1):</p>
+<ul>
+ <li>r600g/compute: PIPE_CAP_COMPUTE should be false for pre-evergreen GPUs</li>
+</ul>
+
+<p>Topi Pohjolainen (1):</p>
+<ul>
+ <li>i965/blorp: do not use unnecessary hw-blending support</li>
+</ul>
+
+</div>
+</body>
+</html>
diff --git a/mesalib/docs/specs/MESA_configless_context.spec b/mesalib/docs/specs/MESA_configless_context.spec
new file mode 100644
index 000000000..f2fafb35a
--- /dev/null
+++ b/mesalib/docs/specs/MESA_configless_context.spec
@@ -0,0 +1,125 @@
+Name
+
+ MESA_configless_context
+
+Name Strings
+
+ EGL_MESA_configless_context
+
+Contact
+
+ Neil Roberts <neil.s.roberts@intel.com>
+
+Status
+
+ Proposal
+
+Version
+
+ Version 1, February 28, 2014
+
+Number
+
+ EGL Extension #not assigned
+
+Dependencies
+
+ Requires EGL 1.4 or later. This extension is written against the
+ wording of the EGL 1.4 specification.
+
+Overview
+
+ This extension provides a means to use a single context to render to
+ multiple surfaces which have different EGLConfigs. Without this extension
+ the EGLConfig for every surface used by the context must be compatible
+ with the one used by the context. The only way to render to surfaces with
+ different formats would be to create multiple contexts but this is
+ inefficient with modern GPUs where this restriction is unnecessary.
+
+IP Status
+
+ Open-source; freely implementable.
+
+New Procedures and Functions
+
+ None.
+
+New Tokens
+
+ Accepted as <config> in eglCreateContext
+
+ EGL_NO_CONFIG_MESA ((EGLConfig)0)
+
+Additions to the EGL Specification section "2.2 Rendering Contexts and Drawing
+Surfaces"
+
+ Add the following to the 3rd paragraph:
+
+ "EGLContexts can also optionally be created with respect to an EGLConfig
+ depending on the parameters used at creation time. If a config is provided
+ then additional restrictions apply on what surfaces can be used with the
+ context."
+
+ Replace the last sentence of the 6th paragraph with:
+
+ "In order for a context to be compatible with a surface they both must have
+ been created with respect to the same EGLDisplay. If the context was
+ created without respect to an EGLConfig then there are no further
+ constraints. Otherwise they are only compatible if:"
+
+ Remove the last bullet point in the list of constraints.
+
+Additions to the EGL Specification section "3.7.1 Creating Rendering Contexts"
+
+ Replace the paragraph starting "If config is not a valid EGLConfig..."
+ with
+
+ "The config argument can either be a valid EGLConfig or EGL_NO_CONFIG_MESA.
+ If it is neither of these then an EGL_BAD_CONFIG error is generated. If a
+ valid config is passed then the error will also be generated if the config
+ does not support the requested client API (this includes requesting
+ creation of an OpenGL ES 1.x context when the EGL_RENDERABLE_TYPE
+ attribute of config does not contain EGL_OPENGL_ES_BIT, or creation of an
+ OpenGL ES 2.x context when the attribute does not contain
+ EGL_OPENGL_ES2_BIT).
+
+ Passing EGL_NO_CONFIG_MESA will create a configless context. When a
+ configless context is used with the OpenGL API it can be assumed that the
+ initial values of the context's state will be decided when the context is
+ first made current. In particular this means that the decision of whether
+ to use GL_BACK or GL_FRONT for the initial value of the first output in
+ glDrawBuffers will be decided based on the config of the draw surface when
+ it is first bound."
+
+Additions to the EGL Specification section "3.7.3 Binding Contexts and
+Drawables"
+
+ Replace the first bullet point with the following:
+
+ "* If draw or read are not compatible with ctx as described in section 2.2,
+ then an EGL_BAD_MATCH error is generated."
+
+ Add a second bullet point after that:
+
+ "* If draw and read are not compatible with each other as described in
+ section 2.2, then an EGL_BAD_MATCH error is generated."
+
+Issues
+
+ 1. What happens when an OpenGL context with a double-buffered surface and
+ draw buffer set to GL_BACK is made current with a single-buffered
+ surface?
+
+ NOT RESOLVED: There are a few options here. An implementation can
+ raise an error, change the drawbuffer state to GL_FRONT or just do
+ nothing, expecting the application to set GL_FRONT drawbuffer before
+ drawing. However, this extension deliberately does not specify any
+ required behavior in this corner case and applications should avoid
+ mixing single- and double-buffered surfaces with configless contexts.
+
+ Future extensions may specify required behavior in this case.
+
+Revision History
+
+ Version 1, February 28, 2014
+ Initial draft (Neil Roberts)
diff --git a/mesalib/include/EGL/eglext.h b/mesalib/include/EGL/eglext.h
index 1d6817838..243da4a0a 100644
--- a/mesalib/include/EGL/eglext.h
+++ b/mesalib/include/EGL/eglext.h
@@ -1,12 +1,12 @@
#ifndef __eglext_h_
-#define __eglext_h_
+#define __eglext_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
/*
-** Copyright (c) 2007-2013 The Khronos Group Inc.
+** Copyright (c) 2013 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
@@ -27,549 +27,623 @@ extern "C" {
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** http://www.opengl.org/registry/
+**
+** Khronos $Revision: 24567 $ on $Date: 2013-12-18 09:50:17 -0800 (Wed, 18 Dec 2013) $
+*/
#include <EGL/eglplatform.h>
-/*************************************************************/
+#define EGL_EGLEXT_VERSION 20131218
-/* Header file version number */
-/* Current version at http://www.khronos.org/registry/egl/ */
-/* $Revision: 21254 $ on $Date: 2013-04-25 03:11:55 -0700 (Thu, 25 Apr 2013) $ */
-#define EGL_EGLEXT_VERSION 16
+/* Generated C header for:
+ * API: egl
+ * Versions considered: .*
+ * Versions emitted: _nomatch_^
+ * Default extensions included: egl
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef EGL_KHR_cl_event
+#define EGL_KHR_cl_event 1
+#define EGL_CL_EVENT_HANDLE_KHR 0x309C
+#define EGL_SYNC_CL_EVENT_KHR 0x30FE
+#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF
+#endif /* EGL_KHR_cl_event */
+
+#ifndef EGL_KHR_cl_event2
+#define EGL_KHR_cl_event2 1
+typedef void *EGLSyncKHR;
+typedef intptr_t EGLAttribKHR;
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
+#endif
+#endif /* EGL_KHR_cl_event2 */
+
+#ifndef EGL_KHR_client_get_all_proc_addresses
+#define EGL_KHR_client_get_all_proc_addresses 1
+#endif /* EGL_KHR_client_get_all_proc_addresses */
#ifndef EGL_KHR_config_attribs
#define EGL_KHR_config_attribs 1
-#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */
-#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */
-#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */
-#endif
+#define EGL_CONFORMANT_KHR 0x3042
+#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040
+#endif /* EGL_KHR_config_attribs */
-#ifndef EGL_KHR_lock_surface
-#define EGL_KHR_lock_surface 1
-#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
-#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
-#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */
-#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */
-#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */
-#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */
-#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */
-#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */
-#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */
-#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */
-#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */
-#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */
-#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */
-#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */
-#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */
-#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
-#endif
+#ifndef EGL_KHR_create_context
+#define EGL_KHR_create_context 1
+#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
+#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
+#define EGL_CONTEXT_FLAGS_KHR 0x30FC
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
+#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
+#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
+#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
+#endif /* EGL_KHR_create_context */
-#ifndef EGL_KHR_image
-#define EGL_KHR_image 1
-#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
-typedef void *EGLImageKHR;
-#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
-#endif
+#ifndef EGL_KHR_fence_sync
+#define EGL_KHR_fence_sync 1
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
+#define EGL_SYNC_CONDITION_KHR 0x30F8
+#define EGL_SYNC_FENCE_KHR 0x30F9
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_fence_sync */
+
+#ifndef EGL_KHR_get_all_proc_addresses
+#define EGL_KHR_get_all_proc_addresses 1
+#endif /* EGL_KHR_get_all_proc_addresses */
+
+#ifndef EGL_KHR_gl_colorspace
+#define EGL_KHR_gl_colorspace 1
+#define EGL_GL_COLORSPACE_KHR 0x309D
+#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089
+#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A
+#endif /* EGL_KHR_gl_colorspace */
-#ifndef EGL_KHR_vg_parent_image
-#define EGL_KHR_vg_parent_image 1
-#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */
-#endif
+#ifndef EGL_KHR_gl_renderbuffer_image
+#define EGL_KHR_gl_renderbuffer_image 1
+#define EGL_GL_RENDERBUFFER_KHR 0x30B9
+#endif /* EGL_KHR_gl_renderbuffer_image */
#ifndef EGL_KHR_gl_texture_2D_image
#define EGL_KHR_gl_texture_2D_image 1
-#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */
-#endif
-
-#ifndef EGL_KHR_gl_texture_cubemap_image
-#define EGL_KHR_gl_texture_cubemap_image 1
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */
-#endif
+#define EGL_GL_TEXTURE_2D_KHR 0x30B1
+#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC
+#endif /* EGL_KHR_gl_texture_2D_image */
#ifndef EGL_KHR_gl_texture_3D_image
#define EGL_KHR_gl_texture_3D_image 1
-#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */
-#endif
-
-#ifndef EGL_KHR_gl_renderbuffer_image
-#define EGL_KHR_gl_renderbuffer_image 1
-#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */
-#endif
+#define EGL_GL_TEXTURE_3D_KHR 0x30B2
+#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD
+#endif /* EGL_KHR_gl_texture_3D_image */
-#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */
-#ifndef EGL_KHR_reusable_sync
-#define EGL_KHR_reusable_sync 1
-
-typedef void* EGLSyncKHR;
-typedef khronos_utime_nanoseconds_t EGLTimeKHR;
+#ifndef EGL_KHR_gl_texture_cubemap_image
+#define EGL_KHR_gl_texture_cubemap_image 1
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
+#endif /* EGL_KHR_gl_texture_cubemap_image */
-#define EGL_SYNC_STATUS_KHR 0x30F1
-#define EGL_SIGNALED_KHR 0x30F2
-#define EGL_UNSIGNALED_KHR 0x30F3
-#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
-#define EGL_CONDITION_SATISFIED_KHR 0x30F6
-#define EGL_SYNC_TYPE_KHR 0x30F7
-#define EGL_SYNC_REUSABLE_KHR 0x30FA
-#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR <flags> bitfield */
-#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
-#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
+#ifndef EGL_KHR_image
+#define EGL_KHR_image 1
+typedef void *EGLImageKHR;
+#define EGL_NATIVE_PIXMAP_KHR 0x30B0
+#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-#endif
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
#endif
+#endif /* EGL_KHR_image */
#ifndef EGL_KHR_image_base
#define EGL_KHR_image_base 1
-/* Most interfaces defined by EGL_KHR_image_pixmap above */
-#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */
-#endif
+#define EGL_IMAGE_PRESERVED_KHR 0x30D2
+#endif /* EGL_KHR_image_base */
#ifndef EGL_KHR_image_pixmap
#define EGL_KHR_image_pixmap 1
-/* Interfaces defined by EGL_KHR_image above */
-#endif
+#endif /* EGL_KHR_image_pixmap */
-#ifndef EGL_IMG_context_priority
-#define EGL_IMG_context_priority 1
-#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
-#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
-#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
-#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
+#ifndef EGL_KHR_lock_surface
+#define EGL_KHR_lock_surface 1
+#define EGL_READ_SURFACE_BIT_KHR 0x0001
+#define EGL_WRITE_SURFACE_BIT_KHR 0x0002
+#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
+#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
+#define EGL_MATCH_FORMAT_KHR 0x3043
+#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0
+#define EGL_FORMAT_RGB_565_KHR 0x30C1
+#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2
+#define EGL_FORMAT_RGBA_8888_KHR 0x30C3
+#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4
+#define EGL_LOCK_USAGE_HINT_KHR 0x30C5
+#define EGL_BITMAP_POINTER_KHR 0x30C6
+#define EGL_BITMAP_PITCH_KHR 0x30C7
+#define EGL_BITMAP_ORIGIN_KHR 0x30C8
+#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9
+#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA
+#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB
+#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC
+#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
+#define EGL_LOWER_LEFT_KHR 0x30CE
+#define EGL_UPPER_LEFT_KHR 0x30CF
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface);
#endif
+#endif /* EGL_KHR_lock_surface */
#ifndef EGL_KHR_lock_surface2
#define EGL_KHR_lock_surface2 1
-#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
-#endif
-
-#ifndef EGL_NV_coverage_sample
-#define EGL_NV_coverage_sample 1
-#define EGL_COVERAGE_BUFFERS_NV 0x30E0
-#define EGL_COVERAGE_SAMPLES_NV 0x30E1
-#endif
+#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
+#endif /* EGL_KHR_lock_surface2 */
-#ifndef EGL_NV_depth_nonlinear
-#define EGL_NV_depth_nonlinear 1
-#define EGL_DEPTH_ENCODING_NV 0x30E2
-#define EGL_DEPTH_ENCODING_NONE_NV 0
-#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
-#endif
-
-#if KHRONOS_SUPPORT_INT64 /* EGLTimeNV requires 64-bit uint support */
-#ifndef EGL_NV_sync
-#define EGL_NV_sync 1
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
-#define EGL_SYNC_STATUS_NV 0x30E7
-#define EGL_SIGNALED_NV 0x30E8
-#define EGL_UNSIGNALED_NV 0x30E9
-#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
-#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
-#define EGL_ALREADY_SIGNALED_NV 0x30EA
-#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
-#define EGL_CONDITION_SATISFIED_NV 0x30EC
-#define EGL_SYNC_TYPE_NV 0x30ED
-#define EGL_SYNC_CONDITION_NV 0x30EE
-#define EGL_SYNC_FENCE_NV 0x30EF
-#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
-typedef void* EGLSyncNV;
-typedef khronos_utime_nanoseconds_t EGLTimeNV;
+#ifndef EGL_KHR_lock_surface3
+#define EGL_KHR_lock_surface3 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
-EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
-#endif
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
#endif
+#endif /* EGL_KHR_lock_surface3 */
-#if KHRONOS_SUPPORT_INT64 /* Dependent on EGL_KHR_reusable_sync which requires 64-bit uint support */
-#ifndef EGL_KHR_fence_sync
-#define EGL_KHR_fence_sync 1
-/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
-#define EGL_SYNC_CONDITION_KHR 0x30F8
-#define EGL_SYNC_FENCE_KHR 0x30F9
-#endif
-#endif
-
-#ifndef EGL_HI_clientpixmap
-#define EGL_HI_clientpixmap 1
-
-/* Surface Attribute */
-#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
-/*
- * Structure representing a client pixmap
- * (pixmap's data is in client-space memory).
- */
-struct EGLClientPixmapHI
-{
- void* pData;
- EGLint iWidth;
- EGLint iHeight;
- EGLint iStride;
-};
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
-#endif /* EGL_HI_clientpixmap */
-
-#ifndef EGL_HI_colorformats
-#define EGL_HI_colorformats 1
-/* Config Attribute */
-#define EGL_COLOR_FORMAT_HI 0x8F70
-/* Color Formats */
-#define EGL_COLOR_RGB_HI 0x8F71
-#define EGL_COLOR_RGBA_HI 0x8F72
-#define EGL_COLOR_ARGB_HI 0x8F73
-#endif /* EGL_HI_colorformats */
-
-#ifndef EGL_MESA_drm_image
-#define EGL_MESA_drm_image 1
-#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 /* CreateDRMImageMESA attribute */
-#define EGL_DRM_BUFFER_USE_MESA 0x31D1 /* CreateDRMImageMESA attribute */
-#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 /* EGL_IMAGE_FORMAT_MESA attribute value */
-#define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */
-#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
-#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 /* EGL_DRM_BUFFER_USE_MESA bits */
-#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 /* EGL_DRM_BUFFER_USE_MESA bits */
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
-#endif
-
-#ifndef EGL_NV_post_sub_buffer
-#define EGL_NV_post_sub_buffer 1
-#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
-#endif
-
-#ifndef EGL_ANGLE_query_surface_pointer
-#define EGL_ANGLE_query_surface_pointer 1
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
-#endif
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
-#endif
-
-#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
-#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
-#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
-#endif
-
-#ifndef EGL_NV_coverage_sample_resolve
-#define EGL_NV_coverage_sample_resolve 1
-#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
-#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
-#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
-#endif
-
-#if KHRONOS_SUPPORT_INT64 /* EGLuint64NV requires 64-bit uint support */
-#ifndef EGL_NV_system_time
-#define EGL_NV_system_time 1
-typedef khronos_utime_nanoseconds_t EGLuint64NV;
+#ifndef EGL_KHR_reusable_sync
+#define EGL_KHR_reusable_sync 1
+typedef khronos_utime_nanoseconds_t EGLTimeKHR;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_STATUS_KHR 0x30F1
+#define EGL_SIGNALED_KHR 0x30F2
+#define EGL_UNSIGNALED_KHR 0x30F3
+#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
+#define EGL_CONDITION_SATISFIED_KHR 0x30F6
+#define EGL_SYNC_TYPE_KHR 0x30F7
+#define EGL_SYNC_REUSABLE_KHR 0x30FA
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
+#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
+#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
-EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
-typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
-#endif
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_reusable_sync */
-#if KHRONOS_SUPPORT_INT64 /* EGLuint64KHR requires 64-bit uint support */
#ifndef EGL_KHR_stream
#define EGL_KHR_stream 1
-typedef void* EGLStreamKHR;
+typedef void *EGLStreamKHR;
typedef khronos_uint64_t EGLuint64KHR;
-#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
-#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
-#define EGL_PRODUCER_FRAME_KHR 0x3212
-#define EGL_CONSUMER_FRAME_KHR 0x3213
-#define EGL_STREAM_STATE_KHR 0x3214
-#define EGL_STREAM_STATE_CREATED_KHR 0x3215
-#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
-#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
-#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
-#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
-#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
-#define EGL_BAD_STREAM_KHR 0x321B
-#define EGL_BAD_STATE_KHR 0x321C
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
+#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
+#define EGL_PRODUCER_FRAME_KHR 0x3212
+#define EGL_CONSUMER_FRAME_KHR 0x3213
+#define EGL_STREAM_STATE_KHR 0x3214
+#define EGL_STREAM_STATE_CREATED_KHR 0x3215
+#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
+#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
+#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
+#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
+#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
+#define EGL_BAD_STREAM_KHR 0x321B
+#define EGL_BAD_STATE_KHR 0x321C
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC)(EGLDisplay dpy, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
-#endif
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_stream */
-#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_consumer_gltexture
#define EGL_KHR_stream_consumer_gltexture 1
-#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
+#ifdef EGL_KHR_stream
+#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
-#endif
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream);
#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_consumer_gltexture */
-#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
-#ifndef EGL_KHR_stream_producer_eglsurface
-#define EGL_KHR_stream_producer_eglsurface 1
-#define EGL_STREAM_BIT_KHR 0x0800
+#ifndef EGL_KHR_stream_cross_process_fd
+#define EGL_KHR_stream_cross_process_fd 1
+typedef int EGLNativeFileDescriptorKHR;
+#ifdef EGL_KHR_stream
+#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
+typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
-#endif
+EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_cross_process_fd */
-#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
-#ifndef EGL_KHR_stream_producer_aldatalocator
-#define EGL_KHR_stream_producer_aldatalocator 1
-#endif
-#endif
-
-#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_fifo
#define EGL_KHR_stream_fifo 1
-/* reuse EGLTimeKHR */
-#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
-#define EGL_STREAM_TIME_NOW_KHR 0x31FD
-#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
-#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
+#ifdef EGL_KHR_stream
+#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
+#define EGL_STREAM_TIME_NOW_KHR 0x31FD
+#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
+#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
-#endif
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_fifo */
-#ifndef EGL_EXT_create_context_robustness
-#define EGL_EXT_create_context_robustness 1
-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
-#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
-#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
-#endif
-
-#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
-#define EGL_ANGLE_d3d_share_handle_client_buffer 1
-/* reuse EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE */
-#endif
+#ifndef EGL_KHR_stream_producer_aldatalocator
+#define EGL_KHR_stream_producer_aldatalocator 1
+#ifdef EGL_KHR_stream
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_producer_aldatalocator */
-#ifndef EGL_KHR_create_context
-#define EGL_KHR_create_context 1
-#define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION
-#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
-#define EGL_CONTEXT_FLAGS_KHR 0x30FC
-#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
-#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
-#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
-#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
-#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
-#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
-#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
-#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
+#ifndef EGL_KHR_stream_producer_eglsurface
+#define EGL_KHR_stream_producer_eglsurface 1
+#ifdef EGL_KHR_stream
+#define EGL_STREAM_BIT_KHR 0x0800
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_producer_eglsurface */
#ifndef EGL_KHR_surfaceless_context
#define EGL_KHR_surfaceless_context 1
-/* No tokens/entry points, just relaxes an error condition */
-#endif
+#endif /* EGL_KHR_surfaceless_context */
-#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
-#ifndef EGL_KHR_stream_cross_process_fd
-#define EGL_KHR_stream_cross_process_fd 1
-typedef int EGLNativeFileDescriptorKHR;
-#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR(EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
-#endif
-#endif
-
-#ifndef EGL_EXT_multiview_window
-#define EGL_EXT_multiview_window 1
-#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
-#endif
+#ifndef EGL_KHR_vg_parent_image
+#define EGL_KHR_vg_parent_image 1
+#define EGL_VG_PARENT_IMAGE_KHR 0x30BA
+#endif /* EGL_KHR_vg_parent_image */
#ifndef EGL_KHR_wait_sync
#define EGL_KHR_wait_sync 1
+typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
-#endif
-
-#ifndef EGL_NV_post_convert_rounding
-#define EGL_NV_post_convert_rounding 1
-/* No tokens or entry points, just relaxes behavior of SwapBuffers */
-#endif
-
-#ifndef EGL_NV_native_query
-#define EGL_NV_native_query 1
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV( EGLDisplay dpy, EGLNativeDisplayType* display_id);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV( EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType* window);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV( EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType* pixmap);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC)(EGLDisplay dpy, EGLNativeDisplayType *display_id);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC)(EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC)(EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
-#endif
-
-#ifndef EGL_NV_3dvision_surface
-#define EGL_NV_3dvision_surface 1
-#define EGL_AUTO_STEREO_NV 0x3136
-#endif
-
-#ifndef EGL_ANDROID_framebuffer_target
-#define EGL_ANDROID_framebuffer_target 1
-#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
+EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
#endif
+#endif /* EGL_KHR_wait_sync */
#ifndef EGL_ANDROID_blob_cache
#define EGL_ANDROID_blob_cache 1
typedef khronos_ssize_t EGLsizeiANDROID;
typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
+typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC)(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
#endif
+#endif /* EGL_ANDROID_blob_cache */
+
+#ifndef EGL_ANDROID_framebuffer_target
+#define EGL_ANDROID_framebuffer_target 1
+#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
+#endif /* EGL_ANDROID_framebuffer_target */
#ifndef EGL_ANDROID_image_native_buffer
#define EGL_ANDROID_image_native_buffer 1
-#define EGL_NATIVE_BUFFER_ANDROID 0x3140
-#endif
+#define EGL_NATIVE_BUFFER_ANDROID 0x3140
+#endif /* EGL_ANDROID_image_native_buffer */
#ifndef EGL_ANDROID_native_fence_sync
#define EGL_ANDROID_native_fence_sync 1
-#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
-#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
-#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
-#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
+#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
+#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
+#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
+#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
+typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID( EGLDisplay dpy, EGLSyncKHR);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC)(EGLDisplay dpy, EGLSyncKHR);
+EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync);
#endif
+#endif /* EGL_ANDROID_native_fence_sync */
#ifndef EGL_ANDROID_recordable
#define EGL_ANDROID_recordable 1
-#define EGL_RECORDABLE_ANDROID 0x3142
+#define EGL_RECORDABLE_ANDROID 0x3142
+#endif /* EGL_ANDROID_recordable */
+
+#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
+#define EGL_ANGLE_d3d_share_handle_client_buffer 1
+#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
+#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */
+
+#ifndef EGL_ANGLE_query_surface_pointer
+#define EGL_ANGLE_query_surface_pointer 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
#endif
+#endif /* EGL_ANGLE_query_surface_pointer */
+
+#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
+#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
+#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */
+
+#ifndef EGL_ARM_pixmap_multisample_discard
+#define EGL_ARM_pixmap_multisample_discard 1
+#define EGL_DISCARD_SAMPLES_ARM 0x3286
+#endif /* EGL_ARM_pixmap_multisample_discard */
#ifndef EGL_EXT_buffer_age
#define EGL_EXT_buffer_age 1
-#define EGL_BUFFER_AGE_EXT 0x313D
-#endif
+#define EGL_BUFFER_AGE_EXT 0x313D
+#endif /* EGL_EXT_buffer_age */
+
+#ifndef EGL_EXT_client_extensions
+#define EGL_EXT_client_extensions 1
+#endif /* EGL_EXT_client_extensions */
+
+#ifndef EGL_EXT_create_context_robustness
+#define EGL_EXT_create_context_robustness 1
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
+#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
+#endif /* EGL_EXT_create_context_robustness */
#ifndef EGL_EXT_image_dma_buf_import
#define EGL_EXT_image_dma_buf_import 1
-#define EGL_LINUX_DMA_BUF_EXT 0x3270
-#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
-#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
-#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
-#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
-#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
-#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
-#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
-#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
-#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
-#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
-#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
-#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
+#define EGL_LINUX_DMA_BUF_EXT 0x3270
+#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
+#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
+#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
+#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
+#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
+#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
+#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
+#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
+#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
+#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
+#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
+#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
-#define EGL_ITU_REC601_EXT 0x327F
-#define EGL_ITU_REC709_EXT 0x3280
-#define EGL_ITU_REC2020_EXT 0x3281
-#define EGL_YUV_FULL_RANGE_EXT 0x3282
-#define EGL_YUV_NARROW_RANGE_EXT 0x3283
-#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
-#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
-#endif
+#define EGL_ITU_REC601_EXT 0x327F
+#define EGL_ITU_REC709_EXT 0x3280
+#define EGL_ITU_REC2020_EXT 0x3281
+#define EGL_YUV_FULL_RANGE_EXT 0x3282
+#define EGL_YUV_NARROW_RANGE_EXT 0x3283
+#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
+#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
+#endif /* EGL_EXT_image_dma_buf_import */
-#ifndef EGL_ARM_pixmap_multisample_discard
-#define EGL_ARM_pixmap_multisample_discard 1
-#define EGL_DISCARD_SAMPLES_ARM 0x3286
+#ifndef EGL_EXT_multiview_window
+#define EGL_EXT_multiview_window 1
+#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
+#endif /* EGL_EXT_multiview_window */
+
+#ifndef EGL_EXT_platform_base
+#define EGL_EXT_platform_base 1
+typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
#endif
+#endif /* EGL_EXT_platform_base */
+
+#ifndef EGL_EXT_platform_wayland
+#define EGL_EXT_platform_wayland 1
+#define EGL_PLATFORM_WAYLAND_EXT 0x31D8
+#endif /* EGL_EXT_platform_wayland */
+
+#ifndef EGL_EXT_platform_x11
+#define EGL_EXT_platform_x11 1
+#define EGL_PLATFORM_X11_EXT 0x31D5
+#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6
+#endif /* EGL_EXT_platform_x11 */
#ifndef EGL_EXT_swap_buffers_with_damage
#define EGL_EXT_swap_buffers_with_damage 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+#endif /* EGL_EXT_swap_buffers_with_damage */
+
+#ifndef EGL_HI_clientpixmap
+#define EGL_HI_clientpixmap 1
+struct EGLClientPixmapHI {
+ void *pData;
+ EGLint iWidth;
+ EGLint iHeight;
+ EGLint iStride;
+};
+#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
+#endif
+#endif /* EGL_HI_clientpixmap */
+
+#ifndef EGL_HI_colorformats
+#define EGL_HI_colorformats 1
+#define EGL_COLOR_FORMAT_HI 0x8F70
+#define EGL_COLOR_RGB_HI 0x8F71
+#define EGL_COLOR_RGBA_HI 0x8F72
+#define EGL_COLOR_ARGB_HI 0x8F73
+#endif /* EGL_HI_colorformats */
+
+#ifndef EGL_IMG_context_priority
+#define EGL_IMG_context_priority 1
+#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
+#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
+#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
+#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
+#endif /* EGL_IMG_context_priority */
+
+#ifndef EGL_MESA_drm_image
+#define EGL_MESA_drm_image 1
+#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0
+#define EGL_DRM_BUFFER_USE_MESA 0x31D1
+#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2
+#define EGL_DRM_BUFFER_MESA 0x31D3
+#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
+#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001
+#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+#endif
+#endif /* EGL_MESA_drm_image */
+
+#ifndef EGL_MESA_platform_gbm
+#define EGL_MESA_platform_gbm 1
+#define EGL_PLATFORM_GBM_MESA 0x31D7
+#endif /* EGL_MESA_platform_gbm */
+
+#ifndef EGL_NV_3dvision_surface
+#define EGL_NV_3dvision_surface 1
+#define EGL_AUTO_STEREO_NV 0x3136
+#endif /* EGL_NV_3dvision_surface */
+
+#ifndef EGL_NV_coverage_sample
+#define EGL_NV_coverage_sample 1
+#define EGL_COVERAGE_BUFFERS_NV 0x30E0
+#define EGL_COVERAGE_SAMPLES_NV 0x30E1
+#endif /* EGL_NV_coverage_sample */
+
+#ifndef EGL_NV_coverage_sample_resolve
+#define EGL_NV_coverage_sample_resolve 1
+#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
+#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
+#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
+#endif /* EGL_NV_coverage_sample_resolve */
+
+#ifndef EGL_NV_depth_nonlinear
+#define EGL_NV_depth_nonlinear 1
+#define EGL_DEPTH_ENCODING_NV 0x30E2
+#define EGL_DEPTH_ENCODING_NONE_NV 0
+#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
+#endif /* EGL_NV_depth_nonlinear */
+
+#ifndef EGL_NV_native_query
+#define EGL_NV_native_query 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT( EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
#endif
+#endif /* EGL_NV_native_query */
+
+#ifndef EGL_NV_post_convert_rounding
+#define EGL_NV_post_convert_rounding 1
+#endif /* EGL_NV_post_convert_rounding */
+
+#ifndef EGL_NV_post_sub_buffer
+#define EGL_NV_post_sub_buffer 1
+#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+#endif
+#endif /* EGL_NV_post_sub_buffer */
+
+#ifndef EGL_NV_stream_sync
+#define EGL_NV_stream_sync 1
+#define EGL_SYNC_NEW_FRAME_NV 0x321F
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
+#endif
+#endif /* EGL_NV_stream_sync */
+
+#ifndef EGL_NV_sync
+#define EGL_NV_sync 1
+typedef void *EGLSyncNV;
+typedef khronos_utime_nanoseconds_t EGLTimeNV;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
+#define EGL_SYNC_STATUS_NV 0x30E7
+#define EGL_SIGNALED_NV 0x30E8
+#define EGL_UNSIGNALED_NV 0x30E9
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
+#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
+#define EGL_ALREADY_SIGNALED_NV 0x30EA
+#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
+#define EGL_CONDITION_SATISFIED_NV 0x30EC
+#define EGL_SYNC_TYPE_NV 0x30ED
+#define EGL_SYNC_CONDITION_NV 0x30EE
+#define EGL_SYNC_FENCE_NV 0x30EF
+#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
+typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
+EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_NV_sync */
+
+#ifndef EGL_NV_system_time
+#define EGL_NV_system_time 1
+typedef khronos_utime_nanoseconds_t EGLuint64NV;
+#ifdef KHRONOS_SUPPORT_INT64
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void);
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_NV_system_time */
#include <EGL/eglmesaext.h>
@@ -577,4 +651,4 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC)(EGLDisplay
}
#endif
-#endif /* __eglext_h_ */
+#endif
diff --git a/mesalib/include/EGL/eglmesaext.h b/mesalib/include/EGL/eglmesaext.h
index b3229e397..5fcc527d6 100644
--- a/mesalib/include/EGL/eglmesaext.h
+++ b/mesalib/include/EGL/eglmesaext.h
@@ -165,6 +165,11 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOK) (EGLDisplay dpy, EG
#define EGL_NATIVE_BUFFER_ANDROID 0x3140 /* eglCreateImageKHR target */
#endif
+#ifndef EGL_MESA_configless_context
+#define EGL_MESA_configless_context 1
+#define EGL_NO_CONFIG_MESA ((EGLConfig)0)
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/mesalib/include/c11/threads_posix.h b/mesalib/include/c11/threads_posix.h
index 7e96715c2..f9c165df4 100644
--- a/mesalib/include/c11/threads_posix.h
+++ b/mesalib/include/c11/threads_posix.h
@@ -27,7 +27,9 @@
* DEALINGS IN THE SOFTWARE.
*/
#include <stdlib.h>
+#ifndef assert
#include <assert.h>
+#endif
#include <limits.h>
#include <errno.h>
#include <unistd.h>
diff --git a/mesalib/include/c11/threads_win32.h b/mesalib/include/c11/threads_win32.h
index d4c2a72d2..5298a8432 100644
--- a/mesalib/include/c11/threads_win32.h
+++ b/mesalib/include/c11/threads_win32.h
@@ -26,7 +26,9 @@
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
+#ifndef assert
#include <assert.h>
+#endif
#include <limits.h>
#include <errno.h>
#include <process.h> // MSVCRT
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.csv b/mesalib/src/gallium/auxiliary/util/u_format.csv
index 8fb068b81..8aa5c364d 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.csv
+++ b/mesalib/src/gallium/auxiliary/util/u_format.csv
@@ -373,3 +373,6 @@ PIPE_FORMAT_R16A16_SINT , plain, 1, 1, sp16 , sp16 , , , x00
PIPE_FORMAT_R32A32_UINT , plain, 1, 1, up32 , up32 , , , x00y, rgb
PIPE_FORMAT_R32A32_SINT , plain, 1, 1, sp32 , sp32 , , , x00y, rgb
PIPE_FORMAT_R10G10B10A2_UINT , plain, 1, 1, up10 , up10 , up10, up2 , xyzw, rgb
+
+PIPE_FORMAT_B5G6R5_SRGB , plain, 1, 1, un5 , un6 , un5 , , zyx1, srgb
+
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.h b/mesalib/src/gallium/auxiliary/util/u_format.h
index 747e1429d..1dd5d52f1 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.h
+++ b/mesalib/src/gallium/auxiliary/util/u_format.h
@@ -906,6 +906,8 @@ util_format_srgb(enum pipe_format format)
return PIPE_FORMAT_DXT3_SRGBA;
case PIPE_FORMAT_DXT5_RGBA:
return PIPE_FORMAT_DXT5_SRGBA;
+ case PIPE_FORMAT_B5G6R5_UNORM:
+ return PIPE_FORMAT_B5G6R5_SRGB;
default:
return PIPE_FORMAT_NONE;
}
@@ -949,6 +951,8 @@ util_format_linear(enum pipe_format format)
return PIPE_FORMAT_DXT3_RGBA;
case PIPE_FORMAT_DXT5_SRGBA:
return PIPE_FORMAT_DXT5_RGBA;
+ case PIPE_FORMAT_B5G6R5_SRGB:
+ return PIPE_FORMAT_B5G6R5_UNORM;
default:
return format;
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_format_pack.py b/mesalib/src/gallium/auxiliary/util/u_format_pack.py
index d1f68c804..8072fdb13 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format_pack.py
+++ b/mesalib/src/gallium/auxiliary/util/u_format_pack.py
@@ -272,8 +272,11 @@ def conversion_expr(src_channel,
if src_colorspace == SRGB:
assert src_channel.type == UNSIGNED
assert src_channel.norm
- assert src_channel.size == 8
+ assert src_channel.size <= 8
+ assert src_channel.size >= 4
assert dst_colorspace == RGB
+ if src_channel.size < 8:
+ value = '%s << %x | %s >> %x' % (value, 8 - src_channel.size, value, 2 * src_channel.size - 8)
if dst_channel.type == FLOAT:
return 'util_format_srgb_8unorm_to_linear_float(%s)' % value
else:
@@ -284,15 +287,20 @@ def conversion_expr(src_channel,
elif dst_colorspace == SRGB:
assert dst_channel.type == UNSIGNED
assert dst_channel.norm
- assert dst_channel.size == 8
+ assert dst_channel.size <= 8
assert src_colorspace == RGB
if src_channel.type == FLOAT:
- return 'util_format_linear_float_to_srgb_8unorm(%s)' % value
+ value = 'util_format_linear_float_to_srgb_8unorm(%s)' % value
else:
assert src_channel.type == UNSIGNED
assert src_channel.norm
assert src_channel.size == 8
- return 'util_format_linear_to_srgb_8unorm(%s)' % value
+ value = 'util_format_linear_to_srgb_8unorm(%s)' % value
+ # XXX rounding is all wrong.
+ if dst_channel.size < 8:
+ return '%s >> %x' % (value, 8 - dst_channel.size)
+ else:
+ return value
elif src_colorspace == ZS:
pass
elif dst_colorspace == ZS:
diff --git a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
index dad3ad2ec..a2f42189f 100644
--- a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -78,1165 +78,6 @@ struct gen_mipmap_state
};
-
-enum dtype
-{
- DTYPE_UBYTE,
- DTYPE_UBYTE_3_3_2,
- DTYPE_USHORT,
- DTYPE_USHORT_4_4_4_4,
- DTYPE_USHORT_5_6_5,
- DTYPE_USHORT_1_5_5_5_REV,
- DTYPE_UINT,
- DTYPE_FLOAT,
- DTYPE_HALF_FLOAT
-};
-
-
-typedef uint16_t half_float;
-
-
-/**
- * \name Support macros for do_row and do_row_3d
- *
- * The macro madness is here for two reasons. First, it compacts the code
- * slightly. Second, it makes it much easier to adjust the specifics of the
- * filter to tune the rounding characteristics.
- */
-/*@{*/
-#define DECLARE_ROW_POINTERS(t, e) \
- const t(*rowA)[e] = (const t(*)[e]) srcRowA; \
- const t(*rowB)[e] = (const t(*)[e]) srcRowB; \
- const t(*rowC)[e] = (const t(*)[e]) srcRowC; \
- const t(*rowD)[e] = (const t(*)[e]) srcRowD; \
- t(*dst)[e] = (t(*)[e]) dstRow
-
-#define DECLARE_ROW_POINTERS0(t) \
- const t *rowA = (const t *) srcRowA; \
- const t *rowB = (const t *) srcRowB; \
- const t *rowC = (const t *) srcRowC; \
- const t *rowD = (const t *) srcRowD; \
- t *dst = (t *) dstRow
-
-#define FILTER_SUM_3D(Aj, Ak, Bj, Bk, Cj, Ck, Dj, Dk) \
- ((unsigned) Aj + (unsigned) Ak \
- + (unsigned) Bj + (unsigned) Bk \
- + (unsigned) Cj + (unsigned) Ck \
- + (unsigned) Dj + (unsigned) Dk \
- + 4) >> 3
-
-#define FILTER_3D(e) \
- do { \
- dst[i][e] = FILTER_SUM_3D(rowA[j][e], rowA[k][e], \
- rowB[j][e], rowB[k][e], \
- rowC[j][e], rowC[k][e], \
- rowD[j][e], rowD[k][e]); \
- } while(0)
-
-#define FILTER_F_3D(e) \
- do { \
- dst[i][e] = (rowA[j][e] + rowA[k][e] \
- + rowB[j][e] + rowB[k][e] \
- + rowC[j][e] + rowC[k][e] \
- + rowD[j][e] + rowD[k][e]) * 0.125F; \
- } while(0)
-
-#define FILTER_HF_3D(e) \
- do { \
- const float aj = util_half_to_float(rowA[j][e]); \
- const float ak = util_half_to_float(rowA[k][e]); \
- const float bj = util_half_to_float(rowB[j][e]); \
- const float bk = util_half_to_float(rowB[k][e]); \
- const float cj = util_half_to_float(rowC[j][e]); \
- const float ck = util_half_to_float(rowC[k][e]); \
- const float dj = util_half_to_float(rowD[j][e]); \
- const float dk = util_half_to_float(rowD[k][e]); \
- dst[i][e] = util_float_to_half((aj + ak + bj + bk + cj + ck + dj + dk) \
- * 0.125F); \
- } while(0)
-/*@}*/
-
-
-/**
- * Average together two rows of a source image to produce a single new
- * row in the dest image. It's legal for the two source rows to point
- * to the same data. The source width must be equal to either the
- * dest width or two times the dest width.
- * \param datatype GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, GL_FLOAT, etc.
- * \param comps number of components per pixel (1..4)
- */
-static void
-do_row(enum dtype datatype, uint comps, int srcWidth,
- const void *srcRowA, const void *srcRowB,
- int dstWidth, void *dstRow)
-{
- const uint k0 = (srcWidth == dstWidth) ? 0 : 1;
- const uint colStride = (srcWidth == dstWidth) ? 1 : 2;
-
- assert(comps >= 1);
- assert(comps <= 4);
-
- /* This assertion is no longer valid with non-power-of-2 textures
- assert(srcWidth == dstWidth || srcWidth == 2 * dstWidth);
- */
-
- if (datatype == DTYPE_UBYTE && comps == 4) {
- uint i, j, k;
- const ubyte(*rowA)[4] = (const ubyte(*)[4]) srcRowA;
- const ubyte(*rowB)[4] = (const ubyte(*)[4]) srcRowB;
- ubyte(*dst)[4] = (ubyte(*)[4]) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
- dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4;
- }
- }
- else if (datatype == DTYPE_UBYTE && comps == 3) {
- uint i, j, k;
- const ubyte(*rowA)[3] = (const ubyte(*)[3]) srcRowA;
- const ubyte(*rowB)[3] = (const ubyte(*)[3]) srcRowB;
- ubyte(*dst)[3] = (ubyte(*)[3]) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
- }
- }
- else if (datatype == DTYPE_UBYTE && comps == 2) {
- uint i, j, k;
- const ubyte(*rowA)[2] = (const ubyte(*)[2]) srcRowA;
- const ubyte(*rowB)[2] = (const ubyte(*)[2]) srcRowB;
- ubyte(*dst)[2] = (ubyte(*)[2]) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) >> 2;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) >> 2;
- }
- }
- else if (datatype == DTYPE_UBYTE && comps == 1) {
- uint i, j, k;
- const ubyte *rowA = (const ubyte *) srcRowA;
- const ubyte *rowB = (const ubyte *) srcRowB;
- ubyte *dst = (ubyte *) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) >> 2;
- }
- }
-
- else if (datatype == DTYPE_USHORT && comps == 4) {
- uint i, j, k;
- const ushort(*rowA)[4] = (const ushort(*)[4]) srcRowA;
- const ushort(*rowB)[4] = (const ushort(*)[4]) srcRowB;
- ushort(*dst)[4] = (ushort(*)[4]) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
- dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4;
- }
- }
- else if (datatype == DTYPE_USHORT && comps == 3) {
- uint i, j, k;
- const ushort(*rowA)[3] = (const ushort(*)[3]) srcRowA;
- const ushort(*rowB)[3] = (const ushort(*)[3]) srcRowB;
- ushort(*dst)[3] = (ushort(*)[3]) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
- }
- }
- else if (datatype == DTYPE_USHORT && comps == 2) {
- uint i, j, k;
- const ushort(*rowA)[2] = (const ushort(*)[2]) srcRowA;
- const ushort(*rowB)[2] = (const ushort(*)[2]) srcRowB;
- ushort(*dst)[2] = (ushort(*)[2]) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
- dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
- }
- }
- else if (datatype == DTYPE_USHORT && comps == 1) {
- uint i, j, k;
- const ushort *rowA = (const ushort *) srcRowA;
- const ushort *rowB = (const ushort *) srcRowB;
- ushort *dst = (ushort *) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4;
- }
- }
-
- else if (datatype == DTYPE_FLOAT && comps == 4) {
- uint i, j, k;
- const float(*rowA)[4] = (const float(*)[4]) srcRowA;
- const float(*rowB)[4] = (const float(*)[4]) srcRowB;
- float(*dst)[4] = (float(*)[4]) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] +
- rowB[j][0] + rowB[k][0]) * 0.25F;
- dst[i][1] = (rowA[j][1] + rowA[k][1] +
- rowB[j][1] + rowB[k][1]) * 0.25F;
- dst[i][2] = (rowA[j][2] + rowA[k][2] +
- rowB[j][2] + rowB[k][2]) * 0.25F;
- dst[i][3] = (rowA[j][3] + rowA[k][3] +
- rowB[j][3] + rowB[k][3]) * 0.25F;
- }
- }
- else if (datatype == DTYPE_FLOAT && comps == 3) {
- uint i, j, k;
- const float(*rowA)[3] = (const float(*)[3]) srcRowA;
- const float(*rowB)[3] = (const float(*)[3]) srcRowB;
- float(*dst)[3] = (float(*)[3]) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] +
- rowB[j][0] + rowB[k][0]) * 0.25F;
- dst[i][1] = (rowA[j][1] + rowA[k][1] +
- rowB[j][1] + rowB[k][1]) * 0.25F;
- dst[i][2] = (rowA[j][2] + rowA[k][2] +
- rowB[j][2] + rowB[k][2]) * 0.25F;
- }
- }
- else if (datatype == DTYPE_FLOAT && comps == 2) {
- uint i, j, k;
- const float(*rowA)[2] = (const float(*)[2]) srcRowA;
- const float(*rowB)[2] = (const float(*)[2]) srcRowB;
- float(*dst)[2] = (float(*)[2]) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i][0] = (rowA[j][0] + rowA[k][0] +
- rowB[j][0] + rowB[k][0]) * 0.25F;
- dst[i][1] = (rowA[j][1] + rowA[k][1] +
- rowB[j][1] + rowB[k][1]) * 0.25F;
- }
- }
- else if (datatype == DTYPE_FLOAT && comps == 1) {
- uint i, j, k;
- const float *rowA = (const float *) srcRowA;
- const float *rowB = (const float *) srcRowB;
- float *dst = (float *) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) * 0.25F;
- }
- }
-
- else if (datatype == DTYPE_HALF_FLOAT && comps == 4) {
- uint i, j, k, comp;
- const half_float(*rowA)[4] = (const half_float(*)[4]) srcRowA;
- const half_float(*rowB)[4] = (const half_float(*)[4]) srcRowB;
- half_float(*dst)[4] = (half_float(*)[4]) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- for (comp = 0; comp < 4; comp++) {
- float aj, ak, bj, bk;
- aj = util_half_to_float(rowA[j][comp]);
- ak = util_half_to_float(rowA[k][comp]);
- bj = util_half_to_float(rowB[j][comp]);
- bk = util_half_to_float(rowB[k][comp]);
- dst[i][comp] = util_float_to_half((aj + ak + bj + bk) * 0.25F);
- }
- }
- }
- else if (datatype == DTYPE_HALF_FLOAT && comps == 3) {
- uint i, j, k, comp;
- const half_float(*rowA)[3] = (const half_float(*)[3]) srcRowA;
- const half_float(*rowB)[3] = (const half_float(*)[3]) srcRowB;
- half_float(*dst)[3] = (half_float(*)[3]) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- for (comp = 0; comp < 3; comp++) {
- float aj, ak, bj, bk;
- aj = util_half_to_float(rowA[j][comp]);
- ak = util_half_to_float(rowA[k][comp]);
- bj = util_half_to_float(rowB[j][comp]);
- bk = util_half_to_float(rowB[k][comp]);
- dst[i][comp] = util_float_to_half((aj + ak + bj + bk) * 0.25F);
- }
- }
- }
- else if (datatype == DTYPE_HALF_FLOAT && comps == 2) {
- uint i, j, k, comp;
- const half_float(*rowA)[2] = (const half_float(*)[2]) srcRowA;
- const half_float(*rowB)[2] = (const half_float(*)[2]) srcRowB;
- half_float(*dst)[2] = (half_float(*)[2]) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- for (comp = 0; comp < 2; comp++) {
- float aj, ak, bj, bk;
- aj = util_half_to_float(rowA[j][comp]);
- ak = util_half_to_float(rowA[k][comp]);
- bj = util_half_to_float(rowB[j][comp]);
- bk = util_half_to_float(rowB[k][comp]);
- dst[i][comp] = util_float_to_half((aj + ak + bj + bk) * 0.25F);
- }
- }
- }
- else if (datatype == DTYPE_HALF_FLOAT && comps == 1) {
- uint i, j, k;
- const half_float *rowA = (const half_float *) srcRowA;
- const half_float *rowB = (const half_float *) srcRowB;
- half_float *dst = (half_float *) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- float aj, ak, bj, bk;
- aj = util_half_to_float(rowA[j]);
- ak = util_half_to_float(rowA[k]);
- bj = util_half_to_float(rowB[j]);
- bk = util_half_to_float(rowB[k]);
- dst[i] = util_float_to_half((aj + ak + bj + bk) * 0.25F);
- }
- }
-
- else if (datatype == DTYPE_UINT && comps == 1) {
- uint i, j, k;
- const uint *rowA = (const uint *) srcRowA;
- const uint *rowB = (const uint *) srcRowB;
- uint *dst = (uint *) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- dst[i] = rowA[j] / 4 + rowA[k] / 4 + rowB[j] / 4 + rowB[k] / 4;
- }
- }
-
- else if (datatype == DTYPE_USHORT_5_6_5 && comps == 3) {
- uint i, j, k;
- const ushort *rowA = (const ushort *) srcRowA;
- const ushort *rowB = (const ushort *) srcRowB;
- ushort *dst = (ushort *) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- const int rowAr0 = rowA[j] & 0x1f;
- const int rowAr1 = rowA[k] & 0x1f;
- const int rowBr0 = rowB[j] & 0x1f;
- const int rowBr1 = rowB[k] & 0x1f;
- const int rowAg0 = (rowA[j] >> 5) & 0x3f;
- const int rowAg1 = (rowA[k] >> 5) & 0x3f;
- const int rowBg0 = (rowB[j] >> 5) & 0x3f;
- const int rowBg1 = (rowB[k] >> 5) & 0x3f;
- const int rowAb0 = (rowA[j] >> 11) & 0x1f;
- const int rowAb1 = (rowA[k] >> 11) & 0x1f;
- const int rowBb0 = (rowB[j] >> 11) & 0x1f;
- const int rowBb1 = (rowB[k] >> 11) & 0x1f;
- const int red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
- const int green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
- const int blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
- dst[i] = (blue << 11) | (green << 5) | red;
- }
- }
- else if (datatype == DTYPE_USHORT_4_4_4_4 && comps == 4) {
- uint i, j, k;
- const ushort *rowA = (const ushort *) srcRowA;
- const ushort *rowB = (const ushort *) srcRowB;
- ushort *dst = (ushort *) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- const int rowAr0 = rowA[j] & 0xf;
- const int rowAr1 = rowA[k] & 0xf;
- const int rowBr0 = rowB[j] & 0xf;
- const int rowBr1 = rowB[k] & 0xf;
- const int rowAg0 = (rowA[j] >> 4) & 0xf;
- const int rowAg1 = (rowA[k] >> 4) & 0xf;
- const int rowBg0 = (rowB[j] >> 4) & 0xf;
- const int rowBg1 = (rowB[k] >> 4) & 0xf;
- const int rowAb0 = (rowA[j] >> 8) & 0xf;
- const int rowAb1 = (rowA[k] >> 8) & 0xf;
- const int rowBb0 = (rowB[j] >> 8) & 0xf;
- const int rowBb1 = (rowB[k] >> 8) & 0xf;
- const int rowAa0 = (rowA[j] >> 12) & 0xf;
- const int rowAa1 = (rowA[k] >> 12) & 0xf;
- const int rowBa0 = (rowB[j] >> 12) & 0xf;
- const int rowBa1 = (rowB[k] >> 12) & 0xf;
- const int red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
- const int green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
- const int blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
- const int alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2;
- dst[i] = (alpha << 12) | (blue << 8) | (green << 4) | red;
- }
- }
- else if (datatype == DTYPE_USHORT_1_5_5_5_REV && comps == 4) {
- uint i, j, k;
- const ushort *rowA = (const ushort *) srcRowA;
- const ushort *rowB = (const ushort *) srcRowB;
- ushort *dst = (ushort *) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- const int rowAr0 = rowA[j] & 0x1f;
- const int rowAr1 = rowA[k] & 0x1f;
- const int rowBr0 = rowB[j] & 0x1f;
- const int rowBr1 = rowB[k] & 0x1f;
- const int rowAg0 = (rowA[j] >> 5) & 0x1f;
- const int rowAg1 = (rowA[k] >> 5) & 0x1f;
- const int rowBg0 = (rowB[j] >> 5) & 0x1f;
- const int rowBg1 = (rowB[k] >> 5) & 0x1f;
- const int rowAb0 = (rowA[j] >> 10) & 0x1f;
- const int rowAb1 = (rowA[k] >> 10) & 0x1f;
- const int rowBb0 = (rowB[j] >> 10) & 0x1f;
- const int rowBb1 = (rowB[k] >> 10) & 0x1f;
- const int rowAa0 = (rowA[j] >> 15) & 0x1;
- const int rowAa1 = (rowA[k] >> 15) & 0x1;
- const int rowBa0 = (rowB[j] >> 15) & 0x1;
- const int rowBa1 = (rowB[k] >> 15) & 0x1;
- const int red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
- const int green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
- const int blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
- const int alpha = (rowAa0 + rowAa1 + rowBa0 + rowBa1) >> 2;
- dst[i] = (alpha << 15) | (blue << 10) | (green << 5) | red;
- }
- }
- else if (datatype == DTYPE_UBYTE_3_3_2 && comps == 3) {
- uint i, j, k;
- const ubyte *rowA = (const ubyte *) srcRowA;
- const ubyte *rowB = (const ubyte *) srcRowB;
- ubyte *dst = (ubyte *) dstRow;
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- const int rowAr0 = rowA[j] & 0x3;
- const int rowAr1 = rowA[k] & 0x3;
- const int rowBr0 = rowB[j] & 0x3;
- const int rowBr1 = rowB[k] & 0x3;
- const int rowAg0 = (rowA[j] >> 2) & 0x7;
- const int rowAg1 = (rowA[k] >> 2) & 0x7;
- const int rowBg0 = (rowB[j] >> 2) & 0x7;
- const int rowBg1 = (rowB[k] >> 2) & 0x7;
- const int rowAb0 = (rowA[j] >> 5) & 0x7;
- const int rowAb1 = (rowA[k] >> 5) & 0x7;
- const int rowBb0 = (rowB[j] >> 5) & 0x7;
- const int rowBb1 = (rowB[k] >> 5) & 0x7;
- const int red = (rowAr0 + rowAr1 + rowBr0 + rowBr1) >> 2;
- const int green = (rowAg0 + rowAg1 + rowBg0 + rowBg1) >> 2;
- const int blue = (rowAb0 + rowAb1 + rowBb0 + rowBb1) >> 2;
- dst[i] = (blue << 5) | (green << 2) | red;
- }
- }
- else {
- debug_printf("bad format in do_row()");
- }
-}
-
-
-/**
- * Average together four rows of a source image to produce a single new
- * row in the dest image. It's legal for the two source rows to point
- * to the same data. The source width must be equal to either the
- * dest width or two times the dest width.
- *
- * \param datatype GL pixel type \c GL_UNSIGNED_BYTE, \c GL_UNSIGNED_SHORT,
- * \c GL_FLOAT, etc.
- * \param comps number of components per pixel (1..4)
- * \param srcWidth Width of a row in the source data
- * \param srcRowA Pointer to one of the rows of source data
- * \param srcRowB Pointer to one of the rows of source data
- * \param srcRowC Pointer to one of the rows of source data
- * \param srcRowD Pointer to one of the rows of source data
- * \param dstWidth Width of a row in the destination data
- * \param srcRowA Pointer to the row of destination data
- */
-static void
-do_row_3D(enum dtype datatype, uint comps, int srcWidth,
- const void *srcRowA, const void *srcRowB,
- const void *srcRowC, const void *srcRowD,
- int dstWidth, void *dstRow)
-{
- const uint k0 = (srcWidth == dstWidth) ? 0 : 1;
- const uint colStride = (srcWidth == dstWidth) ? 1 : 2;
- uint i, j, k;
-
- assert(comps >= 1);
- assert(comps <= 4);
-
- if ((datatype == DTYPE_UBYTE) && (comps == 4)) {
- DECLARE_ROW_POINTERS(ubyte, 4);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- FILTER_3D(1);
- FILTER_3D(2);
- FILTER_3D(3);
- }
- }
- else if ((datatype == DTYPE_UBYTE) && (comps == 3)) {
- DECLARE_ROW_POINTERS(ubyte, 3);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- FILTER_3D(1);
- FILTER_3D(2);
- }
- }
- else if ((datatype == DTYPE_UBYTE) && (comps == 2)) {
- DECLARE_ROW_POINTERS(ubyte, 2);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- FILTER_3D(1);
- }
- }
- else if ((datatype == DTYPE_UBYTE) && (comps == 1)) {
- DECLARE_ROW_POINTERS(ubyte, 1);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- }
- }
- else if ((datatype == DTYPE_USHORT) && (comps == 4)) {
- DECLARE_ROW_POINTERS(ushort, 4);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- FILTER_3D(1);
- FILTER_3D(2);
- FILTER_3D(3);
- }
- }
- else if ((datatype == DTYPE_USHORT) && (comps == 3)) {
- DECLARE_ROW_POINTERS(ushort, 3);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- FILTER_3D(1);
- FILTER_3D(2);
- }
- }
- else if ((datatype == DTYPE_USHORT) && (comps == 2)) {
- DECLARE_ROW_POINTERS(ushort, 2);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- FILTER_3D(1);
- }
- }
- else if ((datatype == DTYPE_USHORT) && (comps == 1)) {
- DECLARE_ROW_POINTERS(ushort, 1);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_3D(0);
- }
- }
- else if ((datatype == DTYPE_FLOAT) && (comps == 4)) {
- DECLARE_ROW_POINTERS(float, 4);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_F_3D(0);
- FILTER_F_3D(1);
- FILTER_F_3D(2);
- FILTER_F_3D(3);
- }
- }
- else if ((datatype == DTYPE_FLOAT) && (comps == 3)) {
- DECLARE_ROW_POINTERS(float, 3);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_F_3D(0);
- FILTER_F_3D(1);
- FILTER_F_3D(2);
- }
- }
- else if ((datatype == DTYPE_FLOAT) && (comps == 2)) {
- DECLARE_ROW_POINTERS(float, 2);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_F_3D(0);
- FILTER_F_3D(1);
- }
- }
- else if ((datatype == DTYPE_FLOAT) && (comps == 1)) {
- DECLARE_ROW_POINTERS(float, 1);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_F_3D(0);
- }
- }
- else if ((datatype == DTYPE_HALF_FLOAT) && (comps == 4)) {
- DECLARE_ROW_POINTERS(half_float, 4);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_HF_3D(0);
- FILTER_HF_3D(1);
- FILTER_HF_3D(2);
- FILTER_HF_3D(3);
- }
- }
- else if ((datatype == DTYPE_HALF_FLOAT) && (comps == 3)) {
- DECLARE_ROW_POINTERS(half_float, 4);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_HF_3D(0);
- FILTER_HF_3D(1);
- FILTER_HF_3D(2);
- }
- }
- else if ((datatype == DTYPE_HALF_FLOAT) && (comps == 2)) {
- DECLARE_ROW_POINTERS(half_float, 4);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_HF_3D(0);
- FILTER_HF_3D(1);
- }
- }
- else if ((datatype == DTYPE_HALF_FLOAT) && (comps == 1)) {
- DECLARE_ROW_POINTERS(half_float, 4);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- FILTER_HF_3D(0);
- }
- }
- else if ((datatype == DTYPE_UINT) && (comps == 1)) {
- const uint *rowA = (const uint *) srcRowA;
- const uint *rowB = (const uint *) srcRowB;
- const uint *rowC = (const uint *) srcRowC;
- const uint *rowD = (const uint *) srcRowD;
- float *dst = (float *) dstRow;
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- const uint64_t tmp = (((uint64_t) rowA[j] + (uint64_t) rowA[k])
- + ((uint64_t) rowB[j] + (uint64_t) rowB[k])
- + ((uint64_t) rowC[j] + (uint64_t) rowC[k])
- + ((uint64_t) rowD[j] + (uint64_t) rowD[k]));
- dst[i] = (float)((double) tmp * 0.125);
- }
- }
- else if ((datatype == DTYPE_USHORT_5_6_5) && (comps == 3)) {
- DECLARE_ROW_POINTERS0(ushort);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- const int rowAr0 = rowA[j] & 0x1f;
- const int rowAr1 = rowA[k] & 0x1f;
- const int rowBr0 = rowB[j] & 0x1f;
- const int rowBr1 = rowB[k] & 0x1f;
- const int rowCr0 = rowC[j] & 0x1f;
- const int rowCr1 = rowC[k] & 0x1f;
- const int rowDr0 = rowD[j] & 0x1f;
- const int rowDr1 = rowD[k] & 0x1f;
- const int rowAg0 = (rowA[j] >> 5) & 0x3f;
- const int rowAg1 = (rowA[k] >> 5) & 0x3f;
- const int rowBg0 = (rowB[j] >> 5) & 0x3f;
- const int rowBg1 = (rowB[k] >> 5) & 0x3f;
- const int rowCg0 = (rowC[j] >> 5) & 0x3f;
- const int rowCg1 = (rowC[k] >> 5) & 0x3f;
- const int rowDg0 = (rowD[j] >> 5) & 0x3f;
- const int rowDg1 = (rowD[k] >> 5) & 0x3f;
- const int rowAb0 = (rowA[j] >> 11) & 0x1f;
- const int rowAb1 = (rowA[k] >> 11) & 0x1f;
- const int rowBb0 = (rowB[j] >> 11) & 0x1f;
- const int rowBb1 = (rowB[k] >> 11) & 0x1f;
- const int rowCb0 = (rowC[j] >> 11) & 0x1f;
- const int rowCb1 = (rowC[k] >> 11) & 0x1f;
- const int rowDb0 = (rowD[j] >> 11) & 0x1f;
- const int rowDb1 = (rowD[k] >> 11) & 0x1f;
- const int r = FILTER_SUM_3D(rowAr0, rowAr1, rowBr0, rowBr1,
- rowCr0, rowCr1, rowDr0, rowDr1);
- const int g = FILTER_SUM_3D(rowAg0, rowAg1, rowBg0, rowBg1,
- rowCg0, rowCg1, rowDg0, rowDg1);
- const int b = FILTER_SUM_3D(rowAb0, rowAb1, rowBb0, rowBb1,
- rowCb0, rowCb1, rowDb0, rowDb1);
- dst[i] = (b << 11) | (g << 5) | r;
- }
- }
- else if ((datatype == DTYPE_USHORT_4_4_4_4) && (comps == 4)) {
- DECLARE_ROW_POINTERS0(ushort);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- const int rowAr0 = rowA[j] & 0xf;
- const int rowAr1 = rowA[k] & 0xf;
- const int rowBr0 = rowB[j] & 0xf;
- const int rowBr1 = rowB[k] & 0xf;
- const int rowCr0 = rowC[j] & 0xf;
- const int rowCr1 = rowC[k] & 0xf;
- const int rowDr0 = rowD[j] & 0xf;
- const int rowDr1 = rowD[k] & 0xf;
- const int rowAg0 = (rowA[j] >> 4) & 0xf;
- const int rowAg1 = (rowA[k] >> 4) & 0xf;
- const int rowBg0 = (rowB[j] >> 4) & 0xf;
- const int rowBg1 = (rowB[k] >> 4) & 0xf;
- const int rowCg0 = (rowC[j] >> 4) & 0xf;
- const int rowCg1 = (rowC[k] >> 4) & 0xf;
- const int rowDg0 = (rowD[j] >> 4) & 0xf;
- const int rowDg1 = (rowD[k] >> 4) & 0xf;
- const int rowAb0 = (rowA[j] >> 8) & 0xf;
- const int rowAb1 = (rowA[k] >> 8) & 0xf;
- const int rowBb0 = (rowB[j] >> 8) & 0xf;
- const int rowBb1 = (rowB[k] >> 8) & 0xf;
- const int rowCb0 = (rowC[j] >> 8) & 0xf;
- const int rowCb1 = (rowC[k] >> 8) & 0xf;
- const int rowDb0 = (rowD[j] >> 8) & 0xf;
- const int rowDb1 = (rowD[k] >> 8) & 0xf;
- const int rowAa0 = (rowA[j] >> 12) & 0xf;
- const int rowAa1 = (rowA[k] >> 12) & 0xf;
- const int rowBa0 = (rowB[j] >> 12) & 0xf;
- const int rowBa1 = (rowB[k] >> 12) & 0xf;
- const int rowCa0 = (rowC[j] >> 12) & 0xf;
- const int rowCa1 = (rowC[k] >> 12) & 0xf;
- const int rowDa0 = (rowD[j] >> 12) & 0xf;
- const int rowDa1 = (rowD[k] >> 12) & 0xf;
- const int r = FILTER_SUM_3D(rowAr0, rowAr1, rowBr0, rowBr1,
- rowCr0, rowCr1, rowDr0, rowDr1);
- const int g = FILTER_SUM_3D(rowAg0, rowAg1, rowBg0, rowBg1,
- rowCg0, rowCg1, rowDg0, rowDg1);
- const int b = FILTER_SUM_3D(rowAb0, rowAb1, rowBb0, rowBb1,
- rowCb0, rowCb1, rowDb0, rowDb1);
- const int a = FILTER_SUM_3D(rowAa0, rowAa1, rowBa0, rowBa1,
- rowCa0, rowCa1, rowDa0, rowDa1);
-
- dst[i] = (a << 12) | (b << 8) | (g << 4) | r;
- }
- }
- else if ((datatype == DTYPE_USHORT_1_5_5_5_REV) && (comps == 4)) {
- DECLARE_ROW_POINTERS0(ushort);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- const int rowAr0 = rowA[j] & 0x1f;
- const int rowAr1 = rowA[k] & 0x1f;
- const int rowBr0 = rowB[j] & 0x1f;
- const int rowBr1 = rowB[k] & 0x1f;
- const int rowCr0 = rowC[j] & 0x1f;
- const int rowCr1 = rowC[k] & 0x1f;
- const int rowDr0 = rowD[j] & 0x1f;
- const int rowDr1 = rowD[k] & 0x1f;
- const int rowAg0 = (rowA[j] >> 5) & 0x1f;
- const int rowAg1 = (rowA[k] >> 5) & 0x1f;
- const int rowBg0 = (rowB[j] >> 5) & 0x1f;
- const int rowBg1 = (rowB[k] >> 5) & 0x1f;
- const int rowCg0 = (rowC[j] >> 5) & 0x1f;
- const int rowCg1 = (rowC[k] >> 5) & 0x1f;
- const int rowDg0 = (rowD[j] >> 5) & 0x1f;
- const int rowDg1 = (rowD[k] >> 5) & 0x1f;
- const int rowAb0 = (rowA[j] >> 10) & 0x1f;
- const int rowAb1 = (rowA[k] >> 10) & 0x1f;
- const int rowBb0 = (rowB[j] >> 10) & 0x1f;
- const int rowBb1 = (rowB[k] >> 10) & 0x1f;
- const int rowCb0 = (rowC[j] >> 10) & 0x1f;
- const int rowCb1 = (rowC[k] >> 10) & 0x1f;
- const int rowDb0 = (rowD[j] >> 10) & 0x1f;
- const int rowDb1 = (rowD[k] >> 10) & 0x1f;
- const int rowAa0 = (rowA[j] >> 15) & 0x1;
- const int rowAa1 = (rowA[k] >> 15) & 0x1;
- const int rowBa0 = (rowB[j] >> 15) & 0x1;
- const int rowBa1 = (rowB[k] >> 15) & 0x1;
- const int rowCa0 = (rowC[j] >> 15) & 0x1;
- const int rowCa1 = (rowC[k] >> 15) & 0x1;
- const int rowDa0 = (rowD[j] >> 15) & 0x1;
- const int rowDa1 = (rowD[k] >> 15) & 0x1;
- const int r = FILTER_SUM_3D(rowAr0, rowAr1, rowBr0, rowBr1,
- rowCr0, rowCr1, rowDr0, rowDr1);
- const int g = FILTER_SUM_3D(rowAg0, rowAg1, rowBg0, rowBg1,
- rowCg0, rowCg1, rowDg0, rowDg1);
- const int b = FILTER_SUM_3D(rowAb0, rowAb1, rowBb0, rowBb1,
- rowCb0, rowCb1, rowDb0, rowDb1);
- const int a = FILTER_SUM_3D(rowAa0, rowAa1, rowBa0, rowBa1,
- rowCa0, rowCa1, rowDa0, rowDa1);
-
- dst[i] = (a << 15) | (b << 10) | (g << 5) | r;
- }
- }
- else if ((datatype == DTYPE_UBYTE_3_3_2) && (comps == 3)) {
- DECLARE_ROW_POINTERS0(ushort);
-
- for (i = j = 0, k = k0; i < (uint) dstWidth;
- i++, j += colStride, k += colStride) {
- const int rowAr0 = rowA[j] & 0x3;
- const int rowAr1 = rowA[k] & 0x3;
- const int rowBr0 = rowB[j] & 0x3;
- const int rowBr1 = rowB[k] & 0x3;
- const int rowCr0 = rowC[j] & 0x3;
- const int rowCr1 = rowC[k] & 0x3;
- const int rowDr0 = rowD[j] & 0x3;
- const int rowDr1 = rowD[k] & 0x3;
- const int rowAg0 = (rowA[j] >> 2) & 0x7;
- const int rowAg1 = (rowA[k] >> 2) & 0x7;
- const int rowBg0 = (rowB[j] >> 2) & 0x7;
- const int rowBg1 = (rowB[k] >> 2) & 0x7;
- const int rowCg0 = (rowC[j] >> 2) & 0x7;
- const int rowCg1 = (rowC[k] >> 2) & 0x7;
- const int rowDg0 = (rowD[j] >> 2) & 0x7;
- const int rowDg1 = (rowD[k] >> 2) & 0x7;
- const int rowAb0 = (rowA[j] >> 5) & 0x7;
- const int rowAb1 = (rowA[k] >> 5) & 0x7;
- const int rowBb0 = (rowB[j] >> 5) & 0x7;
- const int rowBb1 = (rowB[k] >> 5) & 0x7;
- const int rowCb0 = (rowC[j] >> 5) & 0x7;
- const int rowCb1 = (rowC[k] >> 5) & 0x7;
- const int rowDb0 = (rowD[j] >> 5) & 0x7;
- const int rowDb1 = (rowD[k] >> 5) & 0x7;
- const int r = FILTER_SUM_3D(rowAr0, rowAr1, rowBr0, rowBr1,
- rowCr0, rowCr1, rowDr0, rowDr1);
- const int g = FILTER_SUM_3D(rowAg0, rowAg1, rowBg0, rowBg1,
- rowCg0, rowCg1, rowDg0, rowDg1);
- const int b = FILTER_SUM_3D(rowAb0, rowAb1, rowBb0, rowBb1,
- rowCb0, rowCb1, rowDb0, rowDb1);
- dst[i] = (b << 5) | (g << 2) | r;
- }
- }
- else {
- debug_printf("bad format in do_row_3D()");
- }
-}
-
-
-
-static void
-format_to_type_comps(enum pipe_format pformat,
- enum dtype *datatype, uint *comps)
-{
- /* XXX I think this could be implemented in terms of the pf_*() functions */
- switch (pformat) {
- case PIPE_FORMAT_B8G8R8A8_UNORM:
- case PIPE_FORMAT_B8G8R8X8_UNORM:
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- case PIPE_FORMAT_X8R8G8B8_UNORM:
- case PIPE_FORMAT_A8B8G8R8_SRGB:
- case PIPE_FORMAT_X8B8G8R8_SRGB:
- case PIPE_FORMAT_B8G8R8A8_SRGB:
- case PIPE_FORMAT_B8G8R8X8_SRGB:
- case PIPE_FORMAT_A8R8G8B8_SRGB:
- case PIPE_FORMAT_X8R8G8B8_SRGB:
- case PIPE_FORMAT_R8G8B8_SRGB:
- *datatype = DTYPE_UBYTE;
- *comps = 4;
- return;
- case PIPE_FORMAT_B5G5R5X1_UNORM:
- case PIPE_FORMAT_B5G5R5A1_UNORM:
- *datatype = DTYPE_USHORT_1_5_5_5_REV;
- *comps = 4;
- return;
- case PIPE_FORMAT_B4G4R4A4_UNORM:
- *datatype = DTYPE_USHORT_4_4_4_4;
- *comps = 4;
- return;
- case PIPE_FORMAT_B5G6R5_UNORM:
- *datatype = DTYPE_USHORT_5_6_5;
- *comps = 3;
- return;
- case PIPE_FORMAT_L8_UNORM:
- case PIPE_FORMAT_L8_SRGB:
- case PIPE_FORMAT_A8_UNORM:
- case PIPE_FORMAT_I8_UNORM:
- *datatype = DTYPE_UBYTE;
- *comps = 1;
- return;
- case PIPE_FORMAT_L8A8_UNORM:
- case PIPE_FORMAT_L8A8_SRGB:
- *datatype = DTYPE_UBYTE;
- *comps = 2;
- return;
- default:
- assert(0);
- *datatype = DTYPE_UBYTE;
- *comps = 0;
- break;
- }
-}
-
-
-static void
-reduce_1d(enum pipe_format pformat,
- int srcWidth, const ubyte *srcPtr,
- int dstWidth, ubyte *dstPtr)
-{
- enum dtype datatype;
- uint comps;
-
- format_to_type_comps(pformat, &datatype, &comps);
-
- /* we just duplicate the input row, kind of hack, saves code */
- do_row(datatype, comps,
- srcWidth, srcPtr, srcPtr,
- dstWidth, dstPtr);
-}
-
-
-/**
- * Strides are in bytes. If zero, it'll be computed as width * bpp.
- */
-static void
-reduce_2d(enum pipe_format pformat,
- int srcWidth, int srcHeight,
- int srcRowStride, const ubyte *srcPtr,
- int dstWidth, int dstHeight,
- int dstRowStride, ubyte *dstPtr)
-{
- enum dtype datatype;
- uint comps;
- const int bpt = util_format_get_blocksize(pformat);
- const ubyte *srcA, *srcB;
- ubyte *dst;
- int row;
-
- format_to_type_comps(pformat, &datatype, &comps);
-
- if (!srcRowStride)
- srcRowStride = bpt * srcWidth;
-
- if (!dstRowStride)
- dstRowStride = bpt * dstWidth;
-
- /* Compute src and dst pointers */
- srcA = srcPtr;
- if (srcHeight > 1)
- srcB = srcA + srcRowStride;
- else
- srcB = srcA;
- dst = dstPtr;
-
- for (row = 0; row < dstHeight; row++) {
- do_row(datatype, comps,
- srcWidth, srcA, srcB,
- dstWidth, dst);
- srcA += 2 * srcRowStride;
- srcB += 2 * srcRowStride;
- dst += dstRowStride;
- }
-}
-
-
-static void
-reduce_3d(enum pipe_format pformat,
- int srcWidth, int srcHeight, int srcDepth,
- int srcRowStride, int srcImageStride, const ubyte *srcPtr,
- int dstWidth, int dstHeight, int dstDepth,
- int dstRowStride, int dstImageStride, ubyte *dstPtr)
-{
- const int bpt = util_format_get_blocksize(pformat);
- int img, row;
- int srcImageOffset, srcRowOffset;
- enum dtype datatype;
- uint comps;
-
- format_to_type_comps(pformat, &datatype, &comps);
-
- /* XXX I think we should rather assert those strides */
- if (!srcImageStride)
- srcImageStride = srcWidth * srcHeight * bpt;
- if (!dstImageStride)
- dstImageStride = dstWidth * dstHeight * bpt;
-
- if (!srcRowStride)
- srcRowStride = srcWidth * bpt;
- if (!dstRowStride)
- dstRowStride = dstWidth * bpt;
-
- /* Offset between adjacent src images to be averaged together */
- srcImageOffset = (srcDepth == dstDepth) ? 0 : srcImageStride;
-
- /* Offset between adjacent src rows to be averaged together */
- srcRowOffset = (srcHeight == dstHeight) ? 0 : srcRowStride;
-
- /*
- * Need to average together up to 8 src pixels for each dest pixel.
- * Break that down into 3 operations:
- * 1. take two rows from source image and average them together.
- * 2. take two rows from next source image and average them together.
- * 3. take the two averaged rows and average them for the final dst row.
- */
-
- /*
- printf("mip3d %d x %d x %d -> %d x %d x %d\n",
- srcWidth, srcHeight, srcDepth, dstWidth, dstHeight, dstDepth);
- */
-
- for (img = 0; img < dstDepth; img++) {
- /* first source image pointer */
- const ubyte *imgSrcA = srcPtr
- + img * (srcImageStride + srcImageOffset);
- /* second source image pointer */
- const ubyte *imgSrcB = imgSrcA + srcImageOffset;
- /* address of the dest image */
- ubyte *imgDst = dstPtr + img * dstImageStride;
-
- /* setup the four source row pointers and the dest row pointer */
- const ubyte *srcImgARowA = imgSrcA;
- const ubyte *srcImgARowB = imgSrcA + srcRowOffset;
- const ubyte *srcImgBRowA = imgSrcB;
- const ubyte *srcImgBRowB = imgSrcB + srcRowOffset;
- ubyte *dstImgRow = imgDst;
-
- for (row = 0; row < dstHeight; row++) {
- do_row_3D(datatype, comps, srcWidth,
- srcImgARowA, srcImgARowB,
- srcImgBRowA, srcImgBRowB,
- dstWidth, dstImgRow);
-
- /* advance to next rows */
- srcImgARowA += srcRowStride + srcRowOffset;
- srcImgARowB += srcRowStride + srcRowOffset;
- srcImgBRowA += srcRowStride + srcRowOffset;
- srcImgBRowB += srcRowStride + srcRowOffset;
- dstImgRow += dstImageStride;
- }
- }
-}
-
-
-
-
-static void
-make_1d_mipmap(struct gen_mipmap_state *ctx,
- struct pipe_resource *pt,
- uint layer, uint baseLevel, uint lastLevel)
-{
- struct pipe_context *pipe = ctx->pipe;
- uint dstLevel;
-
- for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
- const uint srcLevel = dstLevel - 1;
- struct pipe_transfer *srcTrans, *dstTrans;
- void *srcMap, *dstMap;
-
- srcMap = pipe_transfer_map(pipe, pt, srcLevel, layer,
- PIPE_TRANSFER_READ, 0, 0,
- u_minify(pt->width0, srcLevel),
- u_minify(pt->height0, srcLevel), &srcTrans);
- dstMap = pipe_transfer_map(pipe, pt, dstLevel, layer,
- PIPE_TRANSFER_WRITE, 0, 0,
- u_minify(pt->width0, dstLevel),
- u_minify(pt->height0, dstLevel), &dstTrans);
-
- reduce_1d(pt->format,
- srcTrans->box.width, srcMap,
- dstTrans->box.width, dstMap);
-
- pipe->transfer_unmap(pipe, srcTrans);
- pipe->transfer_unmap(pipe, dstTrans);
- }
-}
-
-
-static void
-make_2d_mipmap(struct gen_mipmap_state *ctx,
- struct pipe_resource *pt,
- uint layer, uint baseLevel, uint lastLevel)
-{
- struct pipe_context *pipe = ctx->pipe;
- uint dstLevel;
-
- assert(util_format_get_blockwidth(pt->format) == 1);
- assert(util_format_get_blockheight(pt->format) == 1);
-
- for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
- const uint srcLevel = dstLevel - 1;
- struct pipe_transfer *srcTrans, *dstTrans;
- ubyte *srcMap, *dstMap;
-
- srcMap = pipe_transfer_map(pipe, pt, srcLevel, layer,
- PIPE_TRANSFER_READ, 0, 0,
- u_minify(pt->width0, srcLevel),
- u_minify(pt->height0, srcLevel), &srcTrans);
- dstMap = pipe_transfer_map(pipe, pt, dstLevel, layer,
- PIPE_TRANSFER_WRITE, 0, 0,
- u_minify(pt->width0, dstLevel),
- u_minify(pt->height0, dstLevel), &dstTrans);
-
- reduce_2d(pt->format,
- srcTrans->box.width, srcTrans->box.height,
- srcTrans->stride, srcMap,
- dstTrans->box.width, dstTrans->box.height,
- dstTrans->stride, dstMap);
-
- pipe->transfer_unmap(pipe, srcTrans);
- pipe->transfer_unmap(pipe, dstTrans);
- }
-}
-
-
-/* XXX looks a bit more like it could work now but need to test */
-static void
-make_3d_mipmap(struct gen_mipmap_state *ctx,
- struct pipe_resource *pt,
- uint face, uint baseLevel, uint lastLevel)
-{
- struct pipe_context *pipe = ctx->pipe;
- uint dstLevel;
- struct pipe_box src_box, dst_box;
-
- assert(util_format_get_blockwidth(pt->format) == 1);
- assert(util_format_get_blockheight(pt->format) == 1);
-
- src_box.x = src_box.y = src_box.z = 0;
- dst_box.x = dst_box.y = dst_box.z = 0;
-
- for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
- const uint srcLevel = dstLevel - 1;
- struct pipe_transfer *srcTrans, *dstTrans;
- ubyte *srcMap, *dstMap;
- struct pipe_box src_box, dst_box;
- src_box.width = u_minify(pt->width0, srcLevel);
- src_box.height = u_minify(pt->height0, srcLevel);
- src_box.depth = u_minify(pt->depth0, srcLevel);
- dst_box.width = u_minify(pt->width0, dstLevel);
- dst_box.height = u_minify(pt->height0, dstLevel);
- dst_box.depth = u_minify(pt->depth0, dstLevel);
-
- srcMap = pipe->transfer_map(pipe, pt, srcLevel,
- PIPE_TRANSFER_READ,
- &src_box, &srcTrans);
- dstMap = pipe->transfer_map(pipe, pt, dstLevel,
- PIPE_TRANSFER_WRITE,
- &dst_box, &dstTrans);
-
- reduce_3d(pt->format,
- srcTrans->box.width, srcTrans->box.height, srcTrans->box.depth,
- srcTrans->stride, srcTrans->layer_stride, srcMap,
- dstTrans->box.width, dstTrans->box.height, dstTrans->box.depth,
- dstTrans->stride, dstTrans->layer_stride, dstMap);
-
- pipe->transfer_unmap(pipe, srcTrans);
- pipe->transfer_unmap(pipe, dstTrans);
- }
-}
-
-
-static void
-fallback_gen_mipmap(struct gen_mipmap_state *ctx,
- struct pipe_resource *pt,
- uint layer, uint baseLevel, uint lastLevel)
-{
- switch (pt->target) {
- case PIPE_TEXTURE_1D:
- make_1d_mipmap(ctx, pt, layer, baseLevel, lastLevel);
- break;
- case PIPE_TEXTURE_2D:
- case PIPE_TEXTURE_RECT:
- case PIPE_TEXTURE_CUBE:
- make_2d_mipmap(ctx, pt, layer, baseLevel, lastLevel);
- break;
- case PIPE_TEXTURE_3D:
- make_3d_mipmap(ctx, pt, layer, baseLevel, lastLevel);
- break;
- default:
- assert(0);
- }
-}
-
-
/**
* Create a mipmap generation context.
* The idea is to create one of these and re-use it each time we need to
@@ -1382,7 +223,7 @@ get_next_slot(struct gen_mipmap_state *ctx)
static unsigned
set_vertex_data(struct gen_mipmap_state *ctx,
enum pipe_texture_target tex_target,
- uint layer, float r)
+ uint face, float r)
{
unsigned offset;
@@ -1403,14 +244,21 @@ set_vertex_data(struct gen_mipmap_state *ctx,
ctx->vertices[3][0][1] = 1.0f;
/* Setup vertex texcoords. This is a little tricky for cube maps. */
- if (tex_target == PIPE_TEXTURE_CUBE) {
+ if (tex_target == PIPE_TEXTURE_CUBE ||
+ tex_target == PIPE_TEXTURE_CUBE_ARRAY) {
static const float st[4][2] = {
{0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f}
};
- util_map_texcoords2d_onto_cubemap(layer, &st[0][0], 2,
+ util_map_texcoords2d_onto_cubemap(face, &st[0][0], 2,
&ctx->vertices[0][1][0], 8,
FALSE);
+
+ /* set the layer for cube arrays */
+ ctx->vertices[0][1][3] = r;
+ ctx->vertices[1][1][3] = r;
+ ctx->vertices[2][1][3] = r;
+ ctx->vertices[3][1][3] = r;
}
else if (tex_target == PIPE_TEXTURE_1D_ARRAY) {
/* 1D texture array */
@@ -1520,36 +368,15 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
assert(filter == PIPE_TEX_FILTER_LINEAR ||
filter == PIPE_TEX_FILTER_NEAREST);
- switch (pt->target) {
- case PIPE_TEXTURE_1D:
- type = TGSI_TEXTURE_1D;
- break;
- case PIPE_TEXTURE_2D:
- type = TGSI_TEXTURE_2D;
- break;
- case PIPE_TEXTURE_3D:
- type = TGSI_TEXTURE_3D;
- break;
- case PIPE_TEXTURE_CUBE:
- type = TGSI_TEXTURE_CUBE;
- break;
- case PIPE_TEXTURE_1D_ARRAY:
- type = TGSI_TEXTURE_1D_ARRAY;
- break;
- case PIPE_TEXTURE_2D_ARRAY:
- type = TGSI_TEXTURE_2D_ARRAY;
- break;
- default:
- assert(0);
- type = TGSI_TEXTURE_2D;
- }
+ type = util_pipe_tex_to_tgsi_tex(pt->target, 1);
/* check if we can render in the texture's format */
if (!screen->is_format_supported(screen, psv->format, pt->target,
pt->nr_samples,
is_depth ? PIPE_BIND_DEPTH_STENCIL :
PIPE_BIND_RENDER_TARGET)) {
- fallback_gen_mipmap(ctx, pt, face, baseLevel, lastLevel);
+ /* The caller should check if the format is renderable. */
+ assert(0);
return;
}
@@ -1600,7 +427,9 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
if (pt->target == PIPE_TEXTURE_3D)
nr_layers = u_minify(pt->depth0, dstLevel);
- else if (pt->target == PIPE_TEXTURE_2D_ARRAY || pt->target == PIPE_TEXTURE_1D_ARRAY)
+ else if (pt->target == PIPE_TEXTURE_2D_ARRAY ||
+ pt->target == PIPE_TEXTURE_1D_ARRAY ||
+ pt->target == PIPE_TEXTURE_CUBE_ARRAY)
nr_layers = pt->array_size;
else
nr_layers = 1;
@@ -1613,9 +442,14 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
layer = i;
/* XXX hmm really? */
rcoord = (float)layer / (float)nr_layers + 1.0f / (float)(nr_layers * 2);
- } else if (pt->target == PIPE_TEXTURE_2D_ARRAY || pt->target == PIPE_TEXTURE_1D_ARRAY) {
+ } else if (pt->target == PIPE_TEXTURE_2D_ARRAY ||
+ pt->target == PIPE_TEXTURE_1D_ARRAY) {
layer = i;
rcoord = (float)layer;
+ } else if (pt->target == PIPE_TEXTURE_CUBE_ARRAY) {
+ layer = i;
+ face = layer % 6;
+ rcoord = layer / 6;
} else
layer = face;
diff --git a/mesalib/src/glsl/builtin_functions.cpp b/mesalib/src/glsl/builtin_functions.cpp
index c4f39abb7..43746f055 100755
--- a/mesalib/src/glsl/builtin_functions.cpp
+++ b/mesalib/src/glsl/builtin_functions.cpp
@@ -194,16 +194,17 @@ shader_integer_mix(const _mesa_glsl_parse_state *state)
}
static bool
-shader_packing(const _mesa_glsl_parse_state *state)
+shader_packing_or_es3(const _mesa_glsl_parse_state *state)
{
return state->ARB_shading_language_packing_enable ||
- state->is_version(400, 0);
+ state->is_version(400, 300);
}
static bool
-shader_packing_or_es3(const _mesa_glsl_parse_state *state)
+shader_packing_or_es3_or_gpu_shader5(const _mesa_glsl_parse_state *state)
{
return state->ARB_shading_language_packing_enable ||
+ state->ARB_gpu_shader5_enable ||
state->is_version(400, 300);
}
@@ -214,6 +215,13 @@ gpu_shader5(const _mesa_glsl_parse_state *state)
}
static bool
+shader_packing_or_gpu_shader5(const _mesa_glsl_parse_state *state)
+{
+ return state->ARB_shading_language_packing_enable ||
+ gpu_shader5(state);
+}
+
+static bool
texture_array_lod(const _mesa_glsl_parse_state *state)
{
return lod_exists_in_stage(state) &&
@@ -991,16 +999,16 @@ builtin_builder::create_builtins()
_uintBitsToFloat(glsl_type::uvec4_type),
NULL);
- add_function("packUnorm2x16", _packUnorm2x16(shader_packing_or_es3), NULL);
- add_function("packSnorm2x16", _packSnorm2x16(shader_packing_or_es3), NULL);
- add_function("packUnorm4x8", _packUnorm4x8(shader_packing), NULL);
- add_function("packSnorm4x8", _packSnorm4x8(shader_packing), NULL);
- add_function("unpackUnorm2x16", _unpackUnorm2x16(shader_packing_or_es3), NULL);
- add_function("unpackSnorm2x16", _unpackSnorm2x16(shader_packing_or_es3), NULL);
- add_function("unpackUnorm4x8", _unpackUnorm4x8(shader_packing), NULL);
- add_function("unpackSnorm4x8", _unpackSnorm4x8(shader_packing), NULL);
- add_function("packHalf2x16", _packHalf2x16(shader_packing_or_es3), NULL);
- add_function("unpackHalf2x16", _unpackHalf2x16(shader_packing_or_es3), NULL);
+ add_function("packUnorm2x16", _packUnorm2x16(shader_packing_or_es3_or_gpu_shader5), NULL);
+ add_function("packSnorm2x16", _packSnorm2x16(shader_packing_or_es3), NULL);
+ add_function("packUnorm4x8", _packUnorm4x8(shader_packing_or_gpu_shader5), NULL);
+ add_function("packSnorm4x8", _packSnorm4x8(shader_packing_or_gpu_shader5), NULL);
+ add_function("unpackUnorm2x16", _unpackUnorm2x16(shader_packing_or_es3_or_gpu_shader5), NULL);
+ add_function("unpackSnorm2x16", _unpackSnorm2x16(shader_packing_or_es3), NULL);
+ add_function("unpackUnorm4x8", _unpackUnorm4x8(shader_packing_or_gpu_shader5), NULL);
+ add_function("unpackSnorm4x8", _unpackSnorm4x8(shader_packing_or_gpu_shader5), NULL);
+ add_function("packHalf2x16", _packHalf2x16(shader_packing_or_es3), NULL);
+ add_function("unpackHalf2x16", _unpackHalf2x16(shader_packing_or_es3), NULL);
F(length)
F(distance)
@@ -3041,7 +3049,7 @@ builtin_builder::_length(const glsl_type *type)
ir_variable *x = in_var(type, "x");
MAKE_SIG(glsl_type::float_type, always_available, 1, x);
- body.emit(ret(sqrt(dotlike(x, x))));
+ body.emit(ret(sqrt(dot(x, x))));
return sig;
}
@@ -3131,7 +3139,7 @@ builtin_builder::_faceforward(const glsl_type *type)
ir_variable *Nref = in_var(type, "Nref");
MAKE_SIG(type, always_available, 3, N, I, Nref);
- body.emit(if_tree(less(dotlike(Nref, I), imm(0.0f)),
+ body.emit(if_tree(less(dot(Nref, I), imm(0.0f)),
ret(N), ret(neg(N))));
return sig;
@@ -3145,7 +3153,7 @@ builtin_builder::_reflect(const glsl_type *type)
MAKE_SIG(type, always_available, 2, I, N);
/* I - 2 * dot(N, I) * N */
- body.emit(ret(sub(I, mul(imm(2.0f), mul(dotlike(N, I), N)))));
+ body.emit(ret(sub(I, mul(imm(2.0f), mul(dot(N, I), N)))));
return sig;
}
@@ -3159,7 +3167,7 @@ builtin_builder::_refract(const glsl_type *type)
MAKE_SIG(type, always_available, 3, I, N, eta);
ir_variable *n_dot_i = body.make_temp(glsl_type::float_type, "n_dot_i");
- body.emit(assign(n_dot_i, dotlike(N, I)));
+ body.emit(assign(n_dot_i, dot(N, I)));
/* From the GLSL 1.10 specification:
* k = 1.0 - eta * eta * (1.0 - dot(N, I) * dot(N, I))
diff --git a/mesalib/src/glsl/ir_builder.cpp b/mesalib/src/glsl/ir_builder.cpp
index 7f41ed69e..f4a1c6efa 100644
--- a/mesalib/src/glsl/ir_builder.cpp
+++ b/mesalib/src/glsl/ir_builder.cpp
@@ -251,13 +251,8 @@ ir_expression *round_even(operand a)
return expr(ir_unop_round_even, a);
}
-ir_expression *dot(operand a, operand b)
-{
- return expr(ir_binop_dot, a, b);
-}
-
/* dot for vectors, mul for scalars */
-ir_expression *dotlike(operand a, operand b)
+ir_expression *dot(operand a, operand b)
{
assert(a.val->type == b.val->type);
diff --git a/mesalib/src/glsl/ir_builder.h b/mesalib/src/glsl/ir_builder.h
index f00e6f3b3..108b53a5e 100644
--- a/mesalib/src/glsl/ir_builder.h
+++ b/mesalib/src/glsl/ir_builder.h
@@ -139,7 +139,6 @@ ir_expression *carry(operand a, operand b);
ir_expression *borrow(operand a, operand b);
ir_expression *round_even(operand a);
ir_expression *dot(operand a, operand b);
-ir_expression *dotlike(operand a, operand b);
ir_expression *clamp(operand a, operand b, operand c);
ir_expression *saturate(operand a);
ir_expression *abs(operand a);
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index f6b266185..3bf278965 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -2303,17 +2303,10 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
}
/* Mark all generic shader inputs and outputs as unpaired. */
- if (prog->_LinkedShaders[MESA_SHADER_VERTEX] != NULL) {
- link_invalidate_variable_locations(
- prog->_LinkedShaders[MESA_SHADER_VERTEX]->ir);
- }
- if (prog->_LinkedShaders[MESA_SHADER_GEOMETRY] != NULL) {
- link_invalidate_variable_locations(
- prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->ir);
- }
- if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] != NULL) {
- link_invalidate_variable_locations(
- prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->ir);
+ for (unsigned i = MESA_SHADER_VERTEX; i <= MESA_SHADER_FRAGMENT; i++) {
+ if (prog->_LinkedShaders[i] != NULL) {
+ link_invalidate_variable_locations(prog->_LinkedShaders[i]->ir);
+ }
}
/* FINISHME: The value of the max_attribute_index parameter is
diff --git a/mesalib/src/glsl/lower_packed_varyings.cpp b/mesalib/src/glsl/lower_packed_varyings.cpp
index c23d1801b..8c1b8850b 100644
--- a/mesalib/src/glsl/lower_packed_varyings.cpp
+++ b/mesalib/src/glsl/lower_packed_varyings.cpp
@@ -199,8 +199,8 @@ private:
/**
* Number of generic varying slots which are used by this shader. This is
- * used to allocate temporary intermediate data structures. If any any
- * varying used by this shader has a location greater than or equal to
+ * used to allocate temporary intermediate data structures. If any varying
+ * used by this shader has a location greater than or equal to
* location_base + locations_used, an assertion will fire.
*/
const unsigned locations_used;
diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp
index 5c49a785c..8494bd9ec 100644
--- a/mesalib/src/glsl/opt_algebraic.cpp
+++ b/mesalib/src/glsl/opt_algebraic.cpp
@@ -528,6 +528,14 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
if (is_vec_two(op_const[0]))
return expr(ir_unop_exp2, ir->operands[1]);
+ if (is_vec_two(op_const[1])) {
+ ir_variable *x = new(ir) ir_variable(ir->operands[1]->type, "x",
+ ir_var_temporary);
+ base_ir->insert_before(x);
+ base_ir->insert_before(assign(x, ir->operands[0]));
+ return mul(x, x);
+ }
+
break;
case ir_unop_rcp:
diff --git a/mesalib/src/glsl/opt_dead_code_local.cpp b/mesalib/src/glsl/opt_dead_code_local.cpp
index e7d46edbe..0c5c684a4 100644
--- a/mesalib/src/glsl/opt_dead_code_local.cpp
+++ b/mesalib/src/glsl/opt_dead_code_local.cpp
@@ -51,14 +51,14 @@ public:
assert(ir);
this->lhs = lhs;
this->ir = ir;
- this->available = ir->write_mask;
+ this->unused = ir->write_mask;
}
ir_variable *lhs;
ir_assignment *ir;
/* bitmask of xyzw channels written that haven't been used so far. */
- int available;
+ int unused;
};
class kill_for_derefs_visitor : public ir_hierarchical_visitor {
@@ -68,7 +68,7 @@ public:
this->assignments = assignments;
}
- void kill_channels(ir_variable *const var, int used)
+ void use_channels(ir_variable *const var, int used)
{
foreach_list_safe(n, this->assignments) {
assignment_entry *entry = (assignment_entry *) n;
@@ -76,14 +76,14 @@ public:
if (entry->lhs == var) {
if (var->type->is_scalar() || var->type->is_vector()) {
if (debug)
- printf("kill %s (0x%01x - 0x%01x)\n", entry->lhs->name,
- entry->available, used);
- entry->available &= ~used;
- if (!entry->available)
+ printf("used %s (0x%01x - 0x%01x)\n", entry->lhs->name,
+ entry->unused, used & 0xf);
+ entry->unused &= ~used;
+ if (!entry->unused)
entry->remove();
} else {
if (debug)
- printf("kill %s\n", entry->lhs->name);
+ printf("used %s\n", entry->lhs->name);
entry->remove();
}
}
@@ -92,7 +92,7 @@ public:
virtual ir_visitor_status visit(ir_dereference_variable *ir)
{
- kill_channels(ir->var, ~0);
+ use_channels(ir->var, ~0);
return visit_continue;
}
@@ -109,7 +109,7 @@ public:
used |= 1 << ir->mask.z;
used |= 1 << ir->mask.w;
- kill_channels(deref->var, used);
+ use_channels(deref->var, used);
return visit_continue_with_parent;
}
@@ -202,7 +202,7 @@ process_assignment(void *ctx, ir_assignment *ir, exec_list *assignments)
if (entry->lhs != var)
continue;
- int remove = entry->available & ir->write_mask;
+ int remove = entry->unused & ir->write_mask;
if (debug) {
printf("%s 0x%01x - 0x%01x = 0x%01x\n",
var->name,
@@ -219,7 +219,7 @@ process_assignment(void *ctx, ir_assignment *ir, exec_list *assignments)
}
entry->ir->write_mask &= ~remove;
- entry->available &= ~remove;
+ entry->unused &= ~remove;
if (entry->ir->write_mask == 0) {
/* Delete the dead assignment. */
entry->ir->remove();
@@ -283,7 +283,7 @@ process_assignment(void *ctx, ir_assignment *ir, exec_list *assignments)
foreach_list(n, assignments) {
assignment_entry *entry = (assignment_entry *) n;
- printf(" %s (0x%01x)\n", entry->lhs->name, entry->available);
+ printf(" %s (0x%01x)\n", entry->lhs->name, entry->unused);
}
}
diff --git a/mesalib/src/loader/Makefile.sources b/mesalib/src/loader/Makefile.sources
index 51a64ea6a..1a1345fcd 100644
--- a/mesalib/src/loader/Makefile.sources
+++ b/mesalib/src/loader/Makefile.sources
@@ -1,2 +1,3 @@
LOADER_C_FILES := \
- loader.c \ No newline at end of file
+ loader.c \
+ pci_id_driver_map.c
diff --git a/mesalib/src/loader/loader.c b/mesalib/src/loader/loader.c
index 811f8a257..e343f4a57 100644
--- a/mesalib/src/loader/loader.c
+++ b/mesalib/src/loader/loader.c
@@ -78,7 +78,7 @@
#endif
#define __IS_LOADER
-#include "pci_ids/pci_id_driver_map.h"
+#include "pci_id_driver_map.h"
static void default_logger(int level, const char *fmt, ...)
{
@@ -352,6 +352,9 @@ loader_get_driver_for_fd(int fd, unsigned driver_types)
if (!(driver_types & driver_map[i].driver_types))
continue;
+ if (driver_map[i].predicate && !driver_map[i].predicate(fd))
+ continue;
+
if (driver_map[i].num_chips_ids == -1) {
driver = strdup(driver_map[i].driver);
goto out;
diff --git a/mesalib/src/loader/pci_id_driver_map.c b/mesalib/src/loader/pci_id_driver_map.c
new file mode 100644
index 000000000..cb6f705ac
--- /dev/null
+++ b/mesalib/src/loader/pci_id_driver_map.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2014 Ilia Mirkin
+ *
+ * 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.
+ */
+
+int is_nouveau_vieux(int fd);
+
+#ifndef __NOT_HAVE_DRM_H
+
+#include <xf86drm.h>
+#include <nouveau_drm.h>
+
+static int
+nouveau_chipset(int fd)
+{
+ struct drm_nouveau_getparam gp = { NOUVEAU_GETPARAM_CHIPSET_ID, 0 };
+ int ret;
+
+ ret = drmCommandWriteRead(fd, DRM_NOUVEAU_GETPARAM, &gp, sizeof(gp));
+ if (ret)
+ return -1;
+
+ return gp.value;
+}
+
+int
+is_nouveau_vieux(int fd)
+{
+ int chipset = nouveau_chipset(fd);
+ return chipset > 0 && chipset < 0x30;
+}
+
+#else
+
+int is_nouveau_vieux(int fd) { return 0; }
+
+#endif
diff --git a/mesalib/src/loader/pci_id_driver_map.h b/mesalib/src/loader/pci_id_driver_map.h
new file mode 100644
index 000000000..11e39d3a2
--- /dev/null
+++ b/mesalib/src/loader/pci_id_driver_map.h
@@ -0,0 +1,85 @@
+#ifndef _PCI_ID_DRIVER_MAP_H_
+#define _PCI_ID_DRIVER_MAP_H_
+
+#include <stddef.h>
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+#endif
+
+#ifndef __IS_LOADER
+# error "Only include from loader.c"
+#endif
+
+static const int i915_chip_ids[] = {
+#define CHIPSET(chip, desc, name) chip,
+#include "pci_ids/i915_pci_ids.h"
+#undef CHIPSET
+};
+
+static const int i965_chip_ids[] = {
+#define CHIPSET(chip, family, name) chip,
+#include "pci_ids/i965_pci_ids.h"
+#undef CHIPSET
+};
+
+static const int r100_chip_ids[] = {
+#define CHIPSET(chip, name, family) chip,
+#include "pci_ids/radeon_pci_ids.h"
+#undef CHIPSET
+};
+
+static const int r200_chip_ids[] = {
+#define CHIPSET(chip, name, family) chip,
+#include "pci_ids/r200_pci_ids.h"
+#undef CHIPSET
+};
+
+static const int r300_chip_ids[] = {
+#define CHIPSET(chip, name, family) chip,
+#include "pci_ids/r300_pci_ids.h"
+#undef CHIPSET
+};
+
+static const int r600_chip_ids[] = {
+#define CHIPSET(chip, name, family) chip,
+#include "pci_ids/r600_pci_ids.h"
+#undef CHIPSET
+};
+
+static const int radeonsi_chip_ids[] = {
+#define CHIPSET(chip, name, family) chip,
+#include "pci_ids/radeonsi_pci_ids.h"
+#undef CHIPSET
+};
+
+static const int vmwgfx_chip_ids[] = {
+#define CHIPSET(chip, name, family) chip,
+#include "pci_ids/vmwgfx_pci_ids.h"
+#undef CHIPSET
+};
+
+int is_nouveau_vieux(int fd);
+
+static const struct {
+ int vendor_id;
+ const char *driver;
+ const int *chip_ids;
+ int num_chips_ids;
+ unsigned driver_types;
+ int (*predicate)(int fd);
+} driver_map[] = {
+ { 0x8086, "i915", i915_chip_ids, ARRAY_SIZE(i915_chip_ids), _LOADER_DRI | _LOADER_GALLIUM },
+ { 0x8086, "i965", i965_chip_ids, ARRAY_SIZE(i965_chip_ids), _LOADER_DRI | _LOADER_GALLIUM },
+ { 0x1002, "radeon", r100_chip_ids, ARRAY_SIZE(r100_chip_ids), _LOADER_DRI },
+ { 0x1002, "r200", r200_chip_ids, ARRAY_SIZE(r200_chip_ids), _LOADER_DRI },
+ { 0x1002, "r300", r300_chip_ids, ARRAY_SIZE(r300_chip_ids), _LOADER_GALLIUM },
+ { 0x1002, "r600", r600_chip_ids, ARRAY_SIZE(r600_chip_ids), _LOADER_GALLIUM },
+ { 0x1002, "radeonsi", radeonsi_chip_ids, ARRAY_SIZE(radeonsi_chip_ids), _LOADER_GALLIUM},
+ { 0x10de, "nouveau_vieux", NULL, -1, _LOADER_DRI, is_nouveau_vieux },
+ { 0x10de, "nouveau", NULL, -1, _LOADER_GALLIUM },
+ { 0x15ad, "vmwgfx", vmwgfx_chip_ids, ARRAY_SIZE(vmwgfx_chip_ids), _LOADER_GALLIUM },
+ { 0x0000, NULL, NULL, 0 },
+};
+
+#endif /* _PCI_ID_DRIVER_MAP_H_ */
diff --git a/mesalib/src/mapi/mapi_glapi.c b/mesalib/src/mapi/mapi_glapi.c
index 7b0903be9..127dfafac 100644
--- a/mesalib/src/mapi/mapi_glapi.c
+++ b/mesalib/src/mapi/mapi_glapi.c
@@ -222,6 +222,16 @@ _glapi_get_proc_name(unsigned int offset)
return stub ? stub_get_name(stub) : NULL;
}
+/**
+ * This is a deprecated function which should not be used anymore.
+ * It's only present to satisfy linking with older versions of libGL.
+ */
+unsigned long
+_glthread_GetID(void)
+{
+ return 0;
+}
+
void
_glapi_noop_enable_warnings(unsigned char enable)
{
diff --git a/mesalib/src/mesa/main/blend.c b/mesalib/src/mesa/main/blend.c
index eb4f1d6be..c37c0fea5 100644
--- a/mesalib/src/mesa/main/blend.c
+++ b/mesalib/src/mesa/main/blend.c
@@ -911,7 +911,9 @@ void _mesa_init_color( struct gl_context * ctx )
ctx->Color.LogicOp = GL_COPY;
ctx->Color.DitherFlag = GL_TRUE;
- if (ctx->Visual.doubleBufferMode) {
+ /* GL_FRONT is not possible on GLES. Instead GL_BACK will render to either
+ * the front or the back buffer depending on the config */
+ if (ctx->Visual.doubleBufferMode || _mesa_is_gles(ctx)) {
ctx->Color.DrawBuffer[0] = GL_BACK;
}
else {
diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c
index 6cbce9d5d..b13a7af65 100644
--- a/mesalib/src/mesa/main/buffers.c
+++ b/mesalib/src/mesa/main/buffers.c
@@ -101,7 +101,7 @@ draw_buffer_enum_to_bitmask(const struct gl_context *ctx, GLenum buffer)
case GL_FRONT:
return BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT;
case GL_BACK:
- if (_mesa_is_gles3(ctx)) {
+ if (_mesa_is_gles(ctx)) {
/* Page 181 (page 192 of the PDF) in section 4.2.1 of the OpenGL
* ES 3.0.1 specification says:
*
@@ -111,6 +111,11 @@ draw_buffer_enum_to_bitmask(const struct gl_context *ctx, GLenum buffer)
*
* Since there is no stereo rendering in ES 3.0, only return the
* LEFT bits. This also satisfies the "n must be 1" requirement.
+ *
+ * We also do this for GLES 1 and 2 because those APIs have no
+ * concept of selecting the front and back buffer anyway and it's
+ * convenient to be able to maintain the magic behaviour of
+ * GL_BACK in that case.
*/
if (ctx->DrawBuffer->Visual.doubleBufferMode)
return BUFFER_BIT_BACK_LEFT;
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index a19180870..21dee98b6 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -1013,7 +1013,8 @@ _mesa_initialize_dispatch_tables(struct gl_context *ctx)
*
* \param ctx the context to initialize
* \param api the GL API type to create the context for
- * \param visual describes the visual attributes for this context
+ * \param visual describes the visual attributes for this context or NULL to
+ * create a configless context
* \param share_list points to context to share textures, display lists,
* etc with, or NULL
* \param driverFunctions table of device driver functions for this context
@@ -1033,12 +1034,20 @@ _mesa_initialize_context(struct gl_context *ctx,
assert(driverFunctions->FreeTextureImageBuffer);
ctx->API = api;
- ctx->Visual = *visual;
ctx->DrawBuffer = NULL;
ctx->ReadBuffer = NULL;
ctx->WinSysDrawBuffer = NULL;
ctx->WinSysReadBuffer = NULL;
+ if (visual) {
+ ctx->Visual = *visual;
+ ctx->HasConfig = GL_TRUE;
+ }
+ else {
+ memset(&ctx->Visual, 0, sizeof ctx->Visual);
+ ctx->HasConfig = GL_FALSE;
+ }
+
if (_mesa_is_desktop_gl(ctx)) {
_mesa_override_gl_version(ctx);
}
@@ -1145,7 +1154,8 @@ fail:
* the rendering context.
*
* \param api the GL API type to create the context for
- * \param visual a struct gl_config pointer (we copy the struct contents)
+ * \param visual a struct gl_config pointer (we copy the struct contents) or
+ * NULL to create a configless context
* \param share_list another context to share display lists with or NULL
* \param driverFunctions points to the dd_function_table into which the
* driver has plugged in all its special functions.
@@ -1160,8 +1170,6 @@ _mesa_create_context(gl_api api,
{
struct gl_context *ctx;
- ASSERT(visual);
-
ctx = calloc(1, sizeof(struct gl_context));
if (!ctx)
return NULL;
@@ -1475,6 +1483,54 @@ _mesa_check_init_viewport(struct gl_context *ctx, GLuint width, GLuint height)
}
}
+static void
+handle_first_current(struct gl_context *ctx)
+{
+ GLenum buffer;
+ GLint bufferIndex;
+
+ assert(ctx->Version > 0);
+
+ ctx->Extensions.String = _mesa_make_extension_string(ctx);
+
+ check_context_limits(ctx);
+
+ /* According to GL_MESA_configless_context the default value of
+ * glDrawBuffers depends on the config of the first surface it is bound to.
+ * For GLES it is always GL_BACK which has a magic interpretation */
+ if (!ctx->HasConfig && _mesa_is_desktop_gl(ctx)) {
+ if (ctx->DrawBuffer != _mesa_get_incomplete_framebuffer()) {
+ if (ctx->DrawBuffer->Visual.doubleBufferMode)
+ buffer = GL_BACK;
+ else
+ buffer = GL_FRONT;
+
+ _mesa_drawbuffers(ctx, 1, &buffer, NULL /* destMask */);
+ }
+
+ if (ctx->ReadBuffer != _mesa_get_incomplete_framebuffer()) {
+ if (ctx->ReadBuffer->Visual.doubleBufferMode) {
+ buffer = GL_BACK;
+ bufferIndex = BUFFER_BACK_LEFT;
+ }
+ else {
+ buffer = GL_FRONT;
+ bufferIndex = BUFFER_FRONT_LEFT;
+ }
+
+ _mesa_readbuffer(ctx, buffer, bufferIndex);
+ }
+ }
+
+ /* We can use this to help debug user's problems. Tell them to set
+ * the MESA_INFO env variable before running their app. Then the
+ * first time each context is made current we'll print some useful
+ * information.
+ */
+ if (_mesa_getenv("MESA_INFO")) {
+ _mesa_print_info(ctx);
+ }
+}
/**
* Bind the given context to the given drawBuffer and readBuffer and
@@ -1567,21 +1623,7 @@ _mesa_make_current( struct gl_context *newCtx,
}
if (newCtx->FirstTimeCurrent) {
- assert(newCtx->Version > 0);
-
- newCtx->Extensions.String = _mesa_make_extension_string(newCtx);
-
- check_context_limits(newCtx);
-
- /* We can use this to help debug user's problems. Tell them to set
- * the MESA_INFO env variable before running their app. Then the
- * first time each context is made current we'll print some useful
- * information.
- */
- if (_mesa_getenv("MESA_INFO")) {
- _mesa_print_info(newCtx);
- }
-
+ handle_first_current(newCtx);
newCtx->FirstTimeCurrent = GL_FALSE;
}
}
diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c
index 8ec6a8c33..9151718ea 100644
--- a/mesalib/src/mesa/main/errors.c
+++ b/mesalib/src/mesa/main/errors.c
@@ -969,7 +969,7 @@ _mesa_init_errors(struct gl_context *ctx)
/**
* Loop through debug group stack tearing down states for
- * filtering debug messages.
+ * filtering debug messages. Then free debug output state.
*/
void
_mesa_free_errors_data(struct gl_context *ctx)
@@ -980,6 +980,9 @@ _mesa_free_errors_data(struct gl_context *ctx)
for (i = 0; i <= ctx->Debug->GroupStackDepth; i++) {
free_errors_data(ctx, i);
}
+ FREE(ctx->Debug);
+ /* set to NULL just in case it is used before context is completely gone. */
+ ctx->Debug = NULL;
}
}
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index a9dcc5144..dfe2f1e93 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -1565,10 +1565,6 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
return ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ARB_texture_float &&
ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
- case GL_RGB9_E5:
- return (_mesa_is_desktop_gl(ctx)
- && ctx->Extensions.EXT_texture_shared_exponent)
- ? GL_RGB : 0;
case GL_R11F_G11F_B10F:
return ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_packed_float) ||
_mesa_is_gles3(ctx) /* EXT_color_buffer_float */ )
diff --git a/mesalib/src/mesa/main/genmipmap.c b/mesalib/src/mesa/main/genmipmap.c
index dcd482da2..9d111cab2 100644
--- a/mesalib/src/mesa/main/genmipmap.c
+++ b/mesalib/src/mesa/main/genmipmap.c
@@ -74,6 +74,10 @@ _mesa_GenerateMipmap(GLenum target)
error = (_mesa_is_gles(ctx) && ctx->Version < 30)
|| !ctx->Extensions.EXT_texture_array;
break;
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ error = _mesa_is_gles(ctx) ||
+ !ctx->Extensions.ARB_texture_cube_map_array;
+ break;
default:
error = GL_TRUE;
}
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index b1908515c..88cf202df 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -1997,7 +1997,7 @@ _mesa_GetBooleani_v( GLenum pname, GLuint index, GLboolean *params )
params[3] = INT_TO_BOOLEAN(v.value_int_4[3]);
break;
case TYPE_INT64:
- params[0] = INT64_TO_BOOLEAN(v.value_int);
+ params[0] = INT64_TO_BOOLEAN(v.value_int64);
break;
default:
; /* nothing - GL error was recorded */
@@ -2042,7 +2042,7 @@ _mesa_GetIntegeri_v( GLenum pname, GLuint index, GLint *params )
params[3] = v.value_int_4[3];
break;
case TYPE_INT64:
- params[0] = INT64_TO_INT(v.value_int);
+ params[0] = INT64_TO_INT(v.value_int64);
break;
default:
; /* nothing - GL error was recorded */
@@ -2067,7 +2067,7 @@ _mesa_GetInteger64i_v( GLenum pname, GLuint index, GLint64 *params )
params[3] = v.value_int_4[3];
break;
case TYPE_INT64:
- params[0] = v.value_int;
+ params[0] = v.value_int64;
break;
default:
; /* nothing - GL error was recorded */
diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c
index 521b2d8eb..cc109cc52 100644
--- a/mesalib/src/mesa/main/mipmap.c
+++ b/mesalib/src/mesa/main/mipmap.c
@@ -1548,23 +1548,18 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
const GLint dstDepthNB = dstDepth - 2 * border;
GLint img, row;
GLint bytesPerSrcImage, bytesPerDstImage;
- GLint bytesPerSrcRow, bytesPerDstRow;
GLint srcImageOffset, srcRowOffset;
(void) srcDepthNB; /* silence warnings */
-
- bytesPerSrcImage = srcWidth * srcHeight * bpt;
- bytesPerDstImage = dstWidth * dstHeight * bpt;
-
- bytesPerSrcRow = srcWidth * bpt;
- bytesPerDstRow = dstWidth * bpt;
+ bytesPerSrcImage = srcRowStride * srcHeight * bpt;
+ bytesPerDstImage = dstRowStride * dstHeight * bpt;
/* Offset between adjacent src images to be averaged together */
srcImageOffset = (srcDepth == dstDepth) ? 0 : 1;
/* Offset between adjacent src rows to be averaged together */
- srcRowOffset = (srcHeight == dstHeight) ? 0 : srcWidth * bpt;
+ srcRowOffset = (srcHeight == dstHeight) ? 0 : srcRowStride;
/*
* Need to average together up to 8 src pixels for each dest pixel.
@@ -1582,14 +1577,14 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
for (img = 0; img < dstDepthNB; img++) {
/* first source image pointer, skipping border */
const GLubyte *imgSrcA = srcPtr[img * 2 + border]
- + bytesPerSrcRow * border + bpt * border;
+ + srcRowStride * border + bpt * border;
/* second source image pointer, skipping border */
const GLubyte *imgSrcB = srcPtr[img * 2 + srcImageOffset + border]
- + bytesPerSrcRow * border + bpt * border;
+ + srcRowStride * border + bpt * border;
/* address of the dest image, skipping border */
GLubyte *imgDst = dstPtr[img + border]
- + bytesPerDstRow * border + bpt * border;
+ + dstRowStride * border + bpt * border;
/* setup the four source row pointers and the dest row pointer */
const GLubyte *srcImgARowA = imgSrcA;
@@ -1605,11 +1600,11 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
dstWidthNB, dstImgRow);
/* advance to next rows */
- srcImgARowA += bytesPerSrcRow + srcRowOffset;
- srcImgARowB += bytesPerSrcRow + srcRowOffset;
- srcImgBRowA += bytesPerSrcRow + srcRowOffset;
- srcImgBRowB += bytesPerSrcRow + srcRowOffset;
- dstImgRow += bytesPerDstRow;
+ srcImgARowA += srcRowStride + srcRowOffset;
+ srcImgARowB += srcRowStride + srcRowOffset;
+ srcImgBRowA += srcRowStride + srcRowOffset;
+ srcImgBRowB += srcRowStride + srcRowOffset;
+ dstImgRow += dstRowStride;
}
}
@@ -1638,8 +1633,8 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
memcpy(dst, src, bpt);
/* do border along [img][row=dstHeight-1][col=0] */
- src = srcPtr[img * 2] + (srcHeight - 1) * bytesPerSrcRow;
- dst = dstPtr[img] + (dstHeight - 1) * bytesPerDstRow;
+ src = srcPtr[img * 2] + (srcHeight - 1) * srcRowStride;
+ dst = dstPtr[img] + (dstHeight - 1) * dstRowStride;
memcpy(dst, src, bpt);
/* do border along [img][row=0][col=dstWidth-1] */
@@ -1668,10 +1663,10 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
/* do border along [img][row=dstHeight-1][col=0] */
srcA = srcPtr[img * 2 + 0]
- + (srcHeight - 1) * bytesPerSrcRow;
+ + (srcHeight - 1) * srcRowStride;
srcB = srcPtr[img * 2 + srcImageOffset]
- + (srcHeight - 1) * bytesPerSrcRow;
- dst = dstPtr[img] + (dstHeight - 1) * bytesPerDstRow;
+ + (srcHeight - 1) * srcRowStride;
+ dst = dstPtr[img] + (dstHeight - 1) * dstRowStride;
do_row(datatype, comps, 1, srcA, srcB, 1, dst);
/* do border along [img][row=0][col=dstWidth-1] */
@@ -1746,6 +1741,7 @@ _mesa_generate_mipmap_level(GLenum target,
}
break;
case GL_TEXTURE_2D_ARRAY_EXT:
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
for (i = 0; i < dstDepth; i++) {
make_2d_mipmap(datatype, comps, border,
srcWidth, srcHeight, srcData[i], srcRowStride,
@@ -1788,7 +1784,8 @@ _mesa_next_mipmap_level_size(GLenum target, GLint border,
}
if ((srcDepth - 2 * border > 1) &&
- (target != GL_TEXTURE_2D_ARRAY_EXT)) {
+ (target != GL_TEXTURE_2D_ARRAY_EXT &&
+ target != GL_TEXTURE_CUBE_MAP_ARRAY)) {
*dstDepth = (srcDepth - 2 * border) / 2 + 2 * border;
}
else {
@@ -2029,7 +2026,8 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
/* only two types of compressed textures at this time */
assert(texObj->Target == GL_TEXTURE_2D ||
texObj->Target == GL_TEXTURE_2D_ARRAY ||
- texObj->Target == GL_TEXTURE_CUBE_MAP_ARB);
+ texObj->Target == GL_TEXTURE_CUBE_MAP_ARB ||
+ texObj->Target == GL_TEXTURE_CUBE_MAP_ARRAY);
/*
* Choose a format for the temporary, uncompressed base image.
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 7c83d664f..c6d90c579 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -4212,6 +4212,12 @@ struct gl_context
GLboolean FirstTimeCurrent;
/*@}*/
+ /**
+ * False if this context was created without a config. This is needed
+ * because the initial state of glDrawBuffers depends on this
+ */
+ GLboolean HasConfig;
+
/** software compression/decompression supported or not */
GLboolean Mesa_DXTn;
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index a6c3581bf..57a766f99 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -160,6 +160,9 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
case GL_DEPTH_COMPONENT24:
case GL_DEPTH_COMPONENT32:
return GL_DEPTH_COMPONENT;
+ case GL_DEPTH_STENCIL:
+ case GL_DEPTH24_STENCIL8:
+ return GL_DEPTH_STENCIL;
default:
; /* fallthrough */
}
@@ -301,14 +304,6 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
}
}
- switch (internalFormat) {
- case GL_DEPTH_STENCIL:
- case GL_DEPTH24_STENCIL8:
- return GL_DEPTH_STENCIL;
- default:
- ; /* fallthrough */
- }
-
if (ctx->Extensions.EXT_texture_sRGB) {
switch (internalFormat) {
case GL_SRGB_EXT:
@@ -1662,7 +1657,10 @@ error_check_subtexture_dimensions(struct gl_context *ctx,
/* check zoffset and depth */
if (dims > 2) {
- GLint zBorder = (target == GL_TEXTURE_2D_ARRAY) ? 0 : destImage->Border;
+ GLint zBorder = (target == GL_TEXTURE_2D_ARRAY ||
+ target == GL_TEXTURE_CUBE_MAP_ARRAY) ?
+ 0 : destImage->Border;
+
if (zoffset < -zBorder) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s3D(zoffset)", function);
return GL_TRUE;
diff --git a/mesalib/src/mesa/program/register_allocate.c b/mesalib/src/mesa/program/register_allocate.c
index 4eed0b5aa..6fac69033 100644
--- a/mesalib/src/mesa/program/register_allocate.c
+++ b/mesalib/src/mesa/program/register_allocate.c
@@ -82,7 +82,7 @@
#define NO_REG ~0
struct ra_reg {
- GLboolean *conflicts;
+ BITSET_WORD *conflicts;
unsigned int *conflict_list;
unsigned int conflict_list_size;
unsigned int num_conflicts;
@@ -99,7 +99,12 @@ struct ra_regs {
};
struct ra_class {
- GLboolean *regs;
+ /**
+ * Bitset indicating which registers belong to this class.
+ *
+ * (If bit N is set, then register N belongs to this class.)
+ */
+ BITSET_WORD *regs;
/**
* p(B) in Runeson/Nyström paper.
@@ -139,7 +144,7 @@ struct ra_node {
* "remove the edge from the graph" in simplification without
* having to actually modify the adjacency_list.
*/
- GLboolean in_stack;
+ bool in_stack;
/* For an implementation that needs register spilling, this is the
* approximate cost of spilling this node.
@@ -186,8 +191,9 @@ ra_alloc_reg_set(void *mem_ctx, unsigned int count)
regs->regs = rzalloc_array(regs, struct ra_reg, count);
for (i = 0; i < count; i++) {
- regs->regs[i].conflicts = rzalloc_array(regs->regs, GLboolean, count);
- regs->regs[i].conflicts[i] = GL_TRUE;
+ regs->regs[i].conflicts = rzalloc_array(regs->regs, BITSET_WORD,
+ BITSET_WORDS(count));
+ BITSET_SET(regs->regs[i].conflicts, i);
regs->regs[i].conflict_list = ralloc_array(regs->regs, unsigned int, 4);
regs->regs[i].conflict_list_size = 4;
@@ -225,13 +231,13 @@ ra_add_conflict_list(struct ra_regs *regs, unsigned int r1, unsigned int r2)
unsigned int, reg1->conflict_list_size);
}
reg1->conflict_list[reg1->num_conflicts++] = r2;
- reg1->conflicts[r2] = GL_TRUE;
+ BITSET_SET(reg1->conflicts, r2);
}
void
ra_add_reg_conflict(struct ra_regs *regs, unsigned int r1, unsigned int r2)
{
- if (!regs->regs[r1].conflicts[r2]) {
+ if (!BITSET_TEST(regs->regs[r1].conflicts, r2)) {
ra_add_conflict_list(regs, r1, r2);
ra_add_conflict_list(regs, r2, r1);
}
@@ -269,7 +275,7 @@ ra_alloc_reg_class(struct ra_regs *regs)
class = rzalloc(regs, struct ra_class);
regs->classes[regs->class_count] = class;
- class->regs = rzalloc_array(class, GLboolean, regs->count);
+ class->regs = rzalloc_array(class, BITSET_WORD, BITSET_WORDS(regs->count));
return regs->class_count++;
}
@@ -279,11 +285,20 @@ ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int r)
{
struct ra_class *class = regs->classes[c];
- class->regs[r] = GL_TRUE;
+ BITSET_SET(class->regs, r);
class->p++;
}
/**
+ * Returns true if the register belongs to the given class.
+ */
+static bool
+reg_belongs_to_class(unsigned int r, struct ra_class *c)
+{
+ return BITSET_TEST(c->regs, r);
+}
+
+/**
* Must be called after all conflicts and register classes have been
* set up and before the register set is used for allocation.
* To avoid costly q value computation, use the q_values paramater
@@ -319,12 +334,12 @@ ra_set_finalize(struct ra_regs *regs, unsigned int **q_values)
int conflicts = 0;
int i;
- if (!regs->classes[c]->regs[rc])
+ if (!reg_belongs_to_class(rc, regs->classes[c]))
continue;
for (i = 0; i < regs->regs[rc].num_conflicts; i++) {
unsigned int rb = regs->regs[rc].conflict_list[i];
- if (regs->classes[b]->regs[rb])
+ if (BITSET_TEST(regs->classes[b]->regs, rb))
conflicts++;
}
max_conflicts = MAX2(max_conflicts, conflicts);
@@ -397,7 +412,8 @@ ra_add_node_interference(struct ra_graph *g,
}
}
-static GLboolean pq_test(struct ra_graph *g, unsigned int n)
+static bool
+pq_test(struct ra_graph *g, unsigned int n)
{
unsigned int j;
unsigned int q = 0;
@@ -420,18 +436,18 @@ static GLboolean pq_test(struct ra_graph *g, unsigned int n)
* trivially-colorable nodes into a stack of nodes to be colored,
* removing them from the graph, and rinsing and repeating.
*
- * Returns GL_TRUE if all nodes were removed from the graph. GL_FALSE
+ * Returns true if all nodes were removed from the graph. false
* means that either spilling will be required, or optimistic coloring
* should be applied.
*/
-GLboolean
+bool
ra_simplify(struct ra_graph *g)
{
- GLboolean progress = GL_TRUE;
+ bool progress = true;
int i;
while (progress) {
- progress = GL_FALSE;
+ progress = false;
for (i = g->count - 1; i >= 0; i--) {
if (g->nodes[i].in_stack || g->nodes[i].reg != NO_REG)
@@ -440,18 +456,18 @@ ra_simplify(struct ra_graph *g)
if (pq_test(g, i)) {
g->stack[g->stack_count] = i;
g->stack_count++;
- g->nodes[i].in_stack = GL_TRUE;
- progress = GL_TRUE;
+ g->nodes[i].in_stack = true;
+ progress = true;
}
}
}
for (i = 0; i < g->count; i++) {
if (!g->nodes[i].in_stack && g->nodes[i].reg == -1)
- return GL_FALSE;
+ return false;
}
- return GL_TRUE;
+ return true;
}
/**
@@ -459,9 +475,9 @@ ra_simplify(struct ra_graph *g)
* registers as they go.
*
* If all nodes were trivially colorable, then this must succeed. If
- * not (optimistic coloring), then it may return GL_FALSE;
+ * not (optimistic coloring), then it may return false;
*/
-GLboolean
+bool
ra_select(struct ra_graph *g)
{
int i;
@@ -478,7 +494,7 @@ ra_select(struct ra_graph *g)
*/
for (ri = 0; ri < g->regs->count; ri++) {
r = (start_search_reg + ri) % g->regs->count;
- if (!c->regs[r])
+ if (!reg_belongs_to_class(r, c))
continue;
/* Check if any of our neighbors conflict with this register choice. */
@@ -486,7 +502,7 @@ ra_select(struct ra_graph *g)
unsigned int n2 = g->nodes[n].adjacency_list[i];
if (!g->nodes[n2].in_stack &&
- g->regs->regs[r].conflicts[g->nodes[n2].reg]) {
+ BITSET_TEST(g->regs->regs[r].conflicts, g->nodes[n2].reg)) {
break;
}
}
@@ -494,17 +510,17 @@ ra_select(struct ra_graph *g)
break;
}
if (ri == g->regs->count)
- return GL_FALSE;
+ return false;
g->nodes[n].reg = r;
- g->nodes[n].in_stack = GL_FALSE;
+ g->nodes[n].in_stack = false;
g->stack_count--;
if (g->regs->round_robin)
start_search_reg = r + 1;
}
- return GL_TRUE;
+ return true;
}
/**
@@ -526,11 +542,11 @@ ra_optimistic_color(struct ra_graph *g)
g->stack[g->stack_count] = i;
g->stack_count++;
- g->nodes[i].in_stack = GL_TRUE;
+ g->nodes[i].in_stack = true;
}
}
-GLboolean
+bool
ra_allocate_no_spills(struct ra_graph *g)
{
if (!ra_simplify(g)) {
@@ -562,7 +578,7 @@ void
ra_set_node_reg(struct ra_graph *g, unsigned int n, unsigned int reg)
{
g->nodes[n].reg = reg;
- g->nodes[n].in_stack = GL_FALSE;
+ g->nodes[n].in_stack = false;
}
static float
diff --git a/mesalib/src/mesa/program/register_allocate.h b/mesalib/src/mesa/program/register_allocate.h
index fa119e320..337dcf709 100644
--- a/mesalib/src/mesa/program/register_allocate.h
+++ b/mesalib/src/mesa/program/register_allocate.h
@@ -25,6 +25,8 @@
*
*/
+#include <stdbool.h>
+
struct ra_class;
struct ra_regs;
@@ -64,10 +66,10 @@ void ra_add_node_interference(struct ra_graph *g,
/** @} */
/** @{ Graph-coloring register allocation */
-GLboolean ra_simplify(struct ra_graph *g);
+bool ra_simplify(struct ra_graph *g);
void ra_optimistic_color(struct ra_graph *g);
-GLboolean ra_select(struct ra_graph *g);
-GLboolean ra_allocate_no_spills(struct ra_graph *g);
+bool ra_select(struct ra_graph *g);
+bool ra_allocate_no_spills(struct ra_graph *g);
unsigned int ra_get_node_reg(struct ra_graph *g, unsigned int n);
void ra_set_node_reg(struct ra_graph * g, unsigned int n, unsigned int reg);
diff --git a/mesalib/src/mesa/state_tracker/st_atom.c b/mesalib/src/mesa/state_tracker/st_atom.c
index 32ce1eaaa..99e9df26b 100644
--- a/mesalib/src/mesa/state_tracker/st_atom.c
+++ b/mesalib/src/mesa/state_tracker/st_atom.c
@@ -132,16 +132,26 @@ static void check_program_state( struct st_context *st )
static void check_attrib_edgeflag(struct st_context *st)
{
const struct gl_client_array **arrays = st->ctx->Array._DrawArrays;
- GLboolean vertDataEdgeFlags;
+ GLboolean vertdata_edgeflags, edgeflag_culls_prims, edgeflags_enabled;
if (!arrays)
return;
- vertDataEdgeFlags = arrays[VERT_ATTRIB_EDGEFLAG]->BufferObj &&
- arrays[VERT_ATTRIB_EDGEFLAG]->BufferObj->Name;
- if (vertDataEdgeFlags != st->vertdata_edgeflags) {
- st->vertdata_edgeflags = vertDataEdgeFlags;
- st->dirty.st |= ST_NEW_EDGEFLAGS_DATA;
+ edgeflags_enabled = st->ctx->Polygon.FrontMode != GL_FILL ||
+ st->ctx->Polygon.BackMode != GL_FILL;
+
+ vertdata_edgeflags = edgeflags_enabled &&
+ arrays[VERT_ATTRIB_EDGEFLAG]->StrideB != 0;
+ if (vertdata_edgeflags != st->vertdata_edgeflags) {
+ st->vertdata_edgeflags = vertdata_edgeflags;
+ st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
+ }
+
+ edgeflag_culls_prims = edgeflags_enabled && !vertdata_edgeflags &&
+ !st->ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0];
+ if (edgeflag_culls_prims != st->edgeflag_culls_prims) {
+ st->edgeflag_culls_prims = edgeflag_culls_prims;
+ st->dirty.st |= ST_NEW_RASTERIZER;
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
index a4f3ffee3..ee5e9e574 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -236,6 +236,14 @@ static void update_raster_state( struct st_context *st )
/* ST_NEW_RASTERIZER */
raster->rasterizer_discard = ctx->RasterDiscard;
+ if (st->edgeflag_culls_prims) {
+ /* All edge flags are FALSE. Cull the affected faces. */
+ if (raster->fill_front != PIPE_POLYGON_MODE_FILL)
+ raster->cull_face |= PIPE_FACE_FRONT;
+ if (raster->fill_back != PIPE_POLYGON_MODE_FILL)
+ raster->cull_face |= PIPE_FACE_BACK;
+ }
+
/* _NEW_TRANSFORM */
raster->depth_clip = ctx->Transform.DepthClamp == GL_FALSE;
raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled;
diff --git a/mesalib/src/mesa/state_tracker/st_atom_shader.c b/mesalib/src/mesa/state_tracker/st_atom_shader.c
index ba04c1fb7..67c615713 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_shader.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_shader.c
@@ -141,11 +141,8 @@ update_vp( struct st_context *st )
* edgeflag semantics, and extend the vertex shader to pass through
* the input to the output. We'll need to use similar logic to set
* up the extra vertex_element input for edgeflags.
- * _NEW_POLYGON, ST_NEW_EDGEFLAGS_DATA
*/
- key.passthrough_edgeflags = (st->vertdata_edgeflags && (
- st->ctx->Polygon.FrontMode != GL_FILL ||
- st->ctx->Polygon.BackMode != GL_FILL));
+ key.passthrough_edgeflags = st->vertdata_edgeflags;
key.clamp_color = st->clamp_vert_color_in_shader &&
st->ctx->Light._ClampVertexColor;
@@ -164,8 +161,8 @@ update_vp( struct st_context *st )
const struct st_tracked_state st_update_vp = {
"st_update_vp", /* name */
{ /* dirty */
- _NEW_POLYGON, /* mesa */
- ST_NEW_VERTEX_PROGRAM | ST_NEW_EDGEFLAGS_DATA /* st */
+ 0, /* mesa */
+ ST_NEW_VERTEX_PROGRAM /* st */
},
update_vp /* update */
};
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index 9c699a015..0e00dd4fa 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -47,7 +47,7 @@ struct u_upload_mgr;
#define ST_NEW_FRAGMENT_PROGRAM (1 << 1)
#define ST_NEW_VERTEX_PROGRAM (1 << 2)
#define ST_NEW_FRAMEBUFFER (1 << 3)
-#define ST_NEW_EDGEFLAGS_DATA (1 << 4)
+/* gap, re-use it */
#define ST_NEW_GEOMETRY_PROGRAM (1 << 5)
#define ST_NEW_VERTEX_ARRAYS (1 << 6)
#define ST_NEW_RASTERIZER (1 << 7)
@@ -131,6 +131,7 @@ struct st_context
GLboolean missing_textures;
GLboolean vertdata_edgeflags;
+ GLboolean edgeflag_culls_prims;
/** Mapping from VARYING_SLOT_x to post-transformed vertex slot */
const GLuint *vertex_result_to_slot;
diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c
index 355c180f8..dba5870a0 100644
--- a/mesalib/src/mesa/state_tracker/st_draw.c
+++ b/mesalib/src/mesa/state_tracker/st_draw.c
@@ -164,16 +164,6 @@ translate_prim(const struct gl_context *ctx, unsigned prim)
STATIC_ASSERT(GL_QUADS == PIPE_PRIM_QUADS);
STATIC_ASSERT(GL_TRIANGLE_STRIP_ADJACENCY == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY);
- /* Avoid quadstrips if it's easy to do so:
- * Note: it's important to do the correct trimming if we change the
- * prim type! We do that wherever this function is called.
- */
- if (prim == GL_QUAD_STRIP &&
- ctx->Light.ShadeModel != GL_FLAT &&
- ctx->Polygon.FrontMode == GL_FILL &&
- ctx->Polygon.BackMode == GL_FILL)
- prim = GL_TRIANGLE_STRIP;
-
return prim;
}
diff --git a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
index 04333f75e..b615575b5 100644
--- a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
@@ -221,7 +221,8 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
else {
dstHeight = u_minify(pt->height0, dstLevel);
}
- if (texObj->Target == GL_TEXTURE_2D_ARRAY) {
+ if (texObj->Target == GL_TEXTURE_2D_ARRAY ||
+ texObj->Target == GL_TEXTURE_CUBE_MAP_ARRAY) {
dstDepth = pt->array_size;
}
else {
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c
index e9074ac97..692a57008 100644
--- a/mesalib/src/mesa/state_tracker/st_program.c
+++ b/mesalib/src/mesa/state_tracker/st_program.c
@@ -342,14 +342,14 @@ st_translate_vertex_program(struct st_context *st,
stvp->glsl_to_tgsi,
&stvp->Base.Base,
/* inputs */
- stvp->num_inputs,
+ vpv->num_inputs,
stvp->input_to_index,
NULL, /* input semantic name */
NULL, /* input semantic index */
NULL, /* interp mode */
NULL, /* is centroid */
/* outputs */
- stvp->num_outputs,
+ num_outputs,
stvp->result_to_output,
stvp->output_semantic_name,
stvp->output_semantic_index,
diff --git a/mkfontscale/hash.c b/mkfontscale/hash.c
index 58f1b6940..adf59412b 100644
--- a/mkfontscale/hash.c
+++ b/mkfontscale/hash.c
@@ -20,7 +20,9 @@
THE SOFTWARE.
*/
+#ifdef HAVE_CONFIG_H
#include "config.h"
+#endif
#include <stdlib.h>
#include <unistd.h>
diff --git a/mkfontscale/mkfontscale.c b/mkfontscale/mkfontscale.c
index a2e96fff0..92e23df5f 100644
--- a/mkfontscale/mkfontscale.c
+++ b/mkfontscale/mkfontscale.c
@@ -20,7 +20,9 @@
THE SOFTWARE.
*/
+#ifdef HAVE_CONFIG_H
#include "config.h"
+#endif
#include <stdio.h>
#include <stdlib.h>
diff --git a/pixman/pixman/pixman-arm-simd-asm.h b/pixman/pixman/pixman-arm-simd-asm.h
index 65436062b..24b1ad2f9 100644
--- a/pixman/pixman/pixman-arm-simd-asm.h
+++ b/pixman/pixman/pixman-arm-simd-asm.h
@@ -741,12 +741,9 @@ fname:
preload_leading_step1 mask_bpp, WK2, MASK
preload_leading_step1 dst_r_bpp, WK3, DST
- tst DST, #15
+ ands WK0, DST, #15
beq 154f
- rsb WK0, DST, #0 /* bits 0-3 = number of leading bytes until destination aligned */
- .if (src_bpp != 0 && src_bpp != 2*dst_w_bpp) || (mask_bpp != 0 && mask_bpp != 2*dst_w_bpp)
- PF and, WK0, WK0, #15
- .endif
+ rsb WK0, WK0, #16 /* number of leading bytes until destination aligned */
preload_leading_step2 src_bpp, src_bpp_shift, WK1, SRC
preload_leading_step2 mask_bpp, mask_bpp_shift, WK2, MASK
@@ -755,18 +752,18 @@ fname:
leading_15bytes process_head, process_tail
154: /* Destination now 16-byte aligned; we have at least one prefetch on each channel as well as at least one 16-byte output block */
- .if (src_bpp > 0) && (mask_bpp == 0) && ((flags) & FLAG_PROCESS_PRESERVES_SCRATCH)
+ .if (src_bpp > 0) && (mask_bpp == 0) && ((flags) & FLAG_PROCESS_PRESERVES_SCRATCH)
and SCRATCH, SRC, #31
rsb SCRATCH, SCRATCH, #32*prefetch_distance
- .elseif (src_bpp == 0) && (mask_bpp > 0) && ((flags) & FLAG_PROCESS_PRESERVES_SCRATCH)
+ .elseif (src_bpp == 0) && (mask_bpp > 0) && ((flags) & FLAG_PROCESS_PRESERVES_SCRATCH)
and SCRATCH, MASK, #31
rsb SCRATCH, SCRATCH, #32*prefetch_distance
- .endif
- .ifc "process_inner_loop",""
+ .endif
+ .ifc "process_inner_loop",""
switch_on_alignment wide_case_inner_loop_and_trailing_pixels, process_head, process_tail, wide_case_inner_loop, 157f
- .else
+ .else
switch_on_alignment wide_case_inner_loop_and_trailing_pixels, process_head, process_tail, process_inner_loop, 157f
- .endif
+ .endif
157: /* Check for another line */
end_of_line 1, %((flags) & FLAG_SPILL_LINE_VARS_WIDE), 151b
@@ -787,9 +784,9 @@ fname:
preload_line 0, dst_r_bpp, dst_bpp_shift, DST
sub X, X, #128/dst_w_bpp /* simplifies inner loop termination */
- tst DST, #15
+ ands WK0, DST, #15
beq 164f
- rsb WK0, DST, #0 /* bits 0-3 = number of leading bytes until destination aligned */
+ rsb WK0, WK0, #16 /* number of leading bytes until destination aligned */
leading_15bytes process_head, process_tail
diff --git a/pixman/test/lowlevel-blt-bench.c b/pixman/test/lowlevel-blt-bench.c
index 1049e21e7..3da094a2b 100644
--- a/pixman/test/lowlevel-blt-bench.c
+++ b/pixman/test/lowlevel-blt-bench.c
@@ -713,7 +713,8 @@ tests_tbl[] =
{ "outrev_n_8888_1555_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OUT_REV, PIXMAN_a8r8g8b8, 2, PIXMAN_a1r5g5b5 },
{ "outrev_n_8888_x888_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OUT_REV, PIXMAN_a8r8g8b8, 2, PIXMAN_x8r8g8b8 },
{ "outrev_n_8888_8888_ca", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OUT_REV, PIXMAN_a8r8g8b8, 2, PIXMAN_a8r8g8b8 },
- { "over_reverse_n_8888", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_OVER_REVERSE, PIXMAN_null, 0, PIXMAN_a8r8g8b8 },
+ { "over_reverse_n_8888", PIXMAN_a8r8g8b8, 1, PIXMAN_OP_OVER_REVERSE, PIXMAN_null, 0, PIXMAN_a8r8g8b8 },
+ { "in_reverse_8888_8888", PIXMAN_a8r8g8b8, 0, PIXMAN_OP_IN_REVERSE, PIXMAN_null, 0, PIXMAN_a8r8g8b8 },
{ "pixbuf", PIXMAN_x8b8g8r8, 0, PIXMAN_OP_SRC, PIXMAN_a8b8g8r8, 0, PIXMAN_a8r8g8b8 },
{ "rpixbuf", PIXMAN_x8b8g8r8, 0, PIXMAN_OP_SRC, PIXMAN_a8b8g8r8, 0, PIXMAN_a8b8g8r8 },
};
diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c
index 700788213..33a280d3f 100644
--- a/xorg-server/Xi/exevents.c
+++ b/xorg-server/Xi/exevents.c
@@ -232,7 +232,7 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master)
mk->sourceid = device->id;
- if (!XkbCopyDeviceKeymap(master, device))
+ if (!XkbDeviceApplyKeymap(master, device->key->xkbInfo->desc))
FatalError("Couldn't pivot keymap from device to core!\n");
}
diff --git a/xorg-server/glamor/glamor.c b/xorg-server/glamor/glamor.c
index e85617927..0f7d68b70 100644
--- a/xorg-server/glamor/glamor.c
+++ b/xorg-server/glamor/glamor.c
@@ -271,6 +271,29 @@ glamor_set_debug_level(int *debug_level)
int glamor_debug_level;
+/**
+ * Creates any pixmaps used internally by glamor, since those can't be
+ * allocated at ScreenInit time.
+ */
+static Bool
+glamor_create_screen_resources(ScreenPtr screen)
+{
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+ Bool ret = TRUE;
+
+ screen->CreateScreenResources =
+ glamor_priv->saved_procs.create_screen_resources;
+ if (screen->CreateScreenResources)
+ ret = screen->CreateScreenResources(screen);
+ screen->CreateScreenResources = glamor_create_screen_resources;
+
+ if (!glamor_realize_glyph_caches(screen)) {
+ ErrorF("Failed to initialize glyph cache\n");
+ ret = FALSE;
+ }
+
+ return ret;
+}
/** Set up glamor for an already-configured GL context. */
Bool
@@ -290,6 +313,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
if (glamor_priv == NULL)
return FALSE;
+ glamor_priv->flags = flags;
if (flags & GLAMOR_INVERTED_Y_AXIS) {
glamor_priv->yInverted = TRUE;
}
@@ -349,6 +373,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
}
}
+ glamor_priv->has_khr_debug = glamor_gl_has_extension("GL_KHR_debug");
glamor_priv->has_pack_invert =
glamor_gl_has_extension("GL_MESA_pack_invert");
glamor_priv->has_fbo_blit =
@@ -374,6 +399,10 @@ glamor_init(ScreenPtr screen, unsigned int flags)
glamor_priv->saved_procs.close_screen = screen->CloseScreen;
screen->CloseScreen = glamor_close_screen;
+ glamor_priv->saved_procs.create_screen_resources =
+ screen->CreateScreenResources;
+ screen->CreateScreenResources = glamor_create_screen_resources;
+
if (flags & GLAMOR_USE_SCREEN) {
if (!RegisterBlockAndWakeupHandlers(_glamor_block_handler,
_glamor_wakeup_handler,
@@ -457,8 +486,8 @@ glamor_init(ScreenPtr screen, unsigned int flags)
glamor_init_xv_shader(screen);
#endif
glamor_pixmap_init(screen);
+ glamor_glyphs_init(screen);
- glamor_priv->flags = flags;
glamor_priv->screen = screen;
return TRUE;
@@ -535,6 +564,8 @@ glamor_close_screen(ScreenPtr screen)
flags = glamor_priv->flags;
glamor_glyphs_fini(screen);
screen->CloseScreen = glamor_priv->saved_procs.close_screen;
+ screen->CreateScreenResources =
+ glamor_priv->saved_procs.create_screen_resources;
if (flags & GLAMOR_USE_SCREEN) {
screen->CreateGC = glamor_priv->saved_procs.create_gc;
@@ -617,7 +648,7 @@ glamor_fd_from_pixmap(ScreenPtr screen,
}
int
-glamor_name_from_pixmap(PixmapPtr pixmap)
+glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
{
glamor_pixmap_private *pixmap_priv;
glamor_screen_private *glamor_priv =
@@ -633,7 +664,7 @@ glamor_name_from_pixmap(PixmapPtr pixmap)
return glamor_egl_dri3_fd_name_from_tex(pixmap->drawable.pScreen,
pixmap,
pixmap_priv->base.fbo->tex,
- TRUE, NULL, NULL);
+ TRUE, stride, size);
default:
break;
}
diff --git a/xorg-server/glamor/glamor.h b/xorg-server/glamor/glamor.h
index e25dc735c..d05d2f4ea 100644
--- a/xorg-server/glamor/glamor.h
+++ b/xorg-server/glamor/glamor.h
@@ -131,14 +131,6 @@ extern _X_EXPORT void glamor_set_screen_pixmap(PixmapPtr screen_pixmap,
extern _X_EXPORT uint32_t glamor_get_pixmap_texture(PixmapPtr pixmap);
-/* @glamor_glyphs_init: Initialize glyphs internal data structures.
- *
- * @pScreen: Current screen pointer.
- *
- * This function must be called after the glamor_init and the texture
- * can be allocated. An example is to call it when create the screen
- * resources at DDX layer.
- */
extern _X_EXPORT Bool glamor_glyphs_init(ScreenPtr pScreen);
extern _X_EXPORT void glamor_set_pixmap_texture(PixmapPtr pixmap,
@@ -218,7 +210,8 @@ extern _X_EXPORT int glamor_fd_from_pixmap(ScreenPtr screen,
*
* Returns the name on success, -1 on error.
* */
-extern _X_EXPORT int glamor_name_from_pixmap(PixmapPtr pixmap);
+extern _X_EXPORT int glamor_name_from_pixmap(PixmapPtr pixmap,
+ CARD16 *stride, CARD32 *size);
/* @glamor_pixmap_from_fd: Creates a pixmap to wrap a dma-buf fd.
*
@@ -255,14 +248,6 @@ extern _X_EXPORT PixmapPtr glamor_pixmap_from_fd(ScreenPtr screen,
* */
extern _X_EXPORT Bool glamor_egl_init(ScrnInfoPtr scrn, int fd);
-/* @glamor_egl_init_textured_pixmap: Initialization for textured pixmap allocation.
- *
- * @screen: Current screen pointer.
- *
- * This function must be called before any textured pixmap's creation including
- * the screen pixmap. Could be called from DDX's screenInit function after the calling
- * to glamor_init..
- */
extern _X_EXPORT Bool glamor_egl_init_textured_pixmap(ScreenPtr screen);
/* @glamor_egl_create_textured_screen: Create textured screen pixmap.
diff --git a/xorg-server/glamor/glamor_addtraps.c b/xorg-server/glamor/glamor_addtraps.c
index 655d87e3d..fdc0f4232 100644
--- a/xorg-server/glamor/glamor_addtraps.c
+++ b/xorg-server/glamor/glamor_addtraps.c
@@ -40,8 +40,8 @@ _glamor_add_traps(PicturePtr pPicture,
if (glamor_prepare_access_picture(pPicture, GLAMOR_ACCESS_RW)) {
fbAddTraps(pPicture, x_off, y_off, ntrap, traps);
- glamor_finish_access_picture(pPicture, GLAMOR_ACCESS_RW);
}
+ glamor_finish_access_picture(pPicture);
return TRUE;
}
diff --git a/xorg-server/glamor/glamor_copyarea.c b/xorg-server/glamor/glamor_copyarea.c
index d6bcacd36..996611c6c 100644
--- a/xorg-server/glamor/glamor_copyarea.c
+++ b/xorg-server/glamor/glamor_copyarea.c
@@ -137,7 +137,7 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap);
- if (!src_pixmap_priv->base.gl_fbo) {
+ if (src_pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) {
#ifndef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
glamor_delayed_fallback(dst->pScreen, "src has no fbo.\n");
return FALSE;
@@ -205,7 +205,6 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glUseProgram(0);
/* The source texture is bound to a fbo, we have to flush it here. */
glamor_put_context(glamor_priv);
glamor_priv->state = RENDER_STATE;
@@ -570,15 +569,15 @@ _glamor_copy_n_to_n(DrawablePtr src,
glamor_get_drawable_location(src),
glamor_get_drawable_location(dst));
- if (glamor_prepare_access(dst, GLAMOR_ACCESS_RW)) {
- if (dst == src || glamor_prepare_access(src, GLAMOR_ACCESS_RO)) {
- fbCopyNtoN(src, dst, gc, box, nbox,
- dx, dy, reverse, upsidedown, bitplane, closure);
- if (dst != src)
- glamor_finish_access(src, GLAMOR_ACCESS_RO);
- }
- glamor_finish_access(dst, GLAMOR_ACCESS_RW);
+ if (glamor_prepare_access(dst, GLAMOR_ACCESS_RW) &&
+ glamor_prepare_access(src, GLAMOR_ACCESS_RO) &&
+ glamor_prepare_access_gc(gc)) {
+ fbCopyNtoN(src, dst, gc, box, nbox,
+ dx, dy, reverse, upsidedown, bitplane, closure);
}
+ glamor_finish_access_gc(gc);
+ glamor_finish_access(src);
+ glamor_finish_access(dst);
ok = TRUE;
done:
diff --git a/xorg-server/glamor/glamor_copyplane.c b/xorg-server/glamor/glamor_copyplane.c
index c42d33e94..2bd2de30d 100644
--- a/xorg-server/glamor/glamor_copyplane.c
+++ b/xorg-server/glamor/glamor_copyplane.c
@@ -38,12 +38,15 @@ _glamor_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
&& glamor_ddx_fallback_check_pixmap(pDst))
goto fail;
- glamor_prepare_access(pDst, GLAMOR_ACCESS_RW);
- glamor_prepare_access(pSrc, GLAMOR_ACCESS_RO);
- *pRegion = fbCopyPlane(pSrc, pDst, pGC, srcx, srcy, w, h,
- dstx, dsty, bitPlane);
- glamor_finish_access(pSrc, GLAMOR_ACCESS_RO);
- glamor_finish_access(pDst, GLAMOR_ACCESS_RW);
+ if (glamor_prepare_access(pDst, GLAMOR_ACCESS_RW) &&
+ glamor_prepare_access(pSrc, GLAMOR_ACCESS_RO) &&
+ glamor_prepare_access_gc(pGC)) {
+ *pRegion = fbCopyPlane(pSrc, pDst, pGC, srcx, srcy, w, h,
+ dstx, dsty, bitPlane);
+ }
+ glamor_finish_access_gc(pGC);
+ glamor_finish_access(pSrc);
+ glamor_finish_access(pDst);
return TRUE;
fail:
diff --git a/xorg-server/glamor/glamor_core.c b/xorg-server/glamor/glamor_core.c
index 58838095b..6c0b3c834 100644
--- a/xorg-server/glamor/glamor_core.c
+++ b/xorg-server/glamor/glamor_core.c
@@ -42,7 +42,8 @@ glamor_get_drawable_location(const DrawablePtr drawable)
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_screen_private *glamor_priv =
glamor_get_screen_private(drawable->pScreen);
- if (pixmap_priv == NULL || pixmap_priv->base.gl_fbo == 0)
+ if (pixmap_priv == NULL ||
+ pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED)
return 'm';
if (pixmap_priv->base.fbo->fb == glamor_priv->screen_fbo)
return 's';
@@ -82,9 +83,10 @@ glamor_compile_glsl_prog(GLenum type, const char *source)
}
void
-glamor_link_glsl_prog(GLint prog)
+glamor_link_glsl_prog(ScreenPtr screen, GLint prog, const char *format, ...)
{
GLint ok;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
glLinkProgram(prog);
glGetProgramiv(prog, GL_LINK_STATUS, &ok);
@@ -99,12 +101,36 @@ glamor_link_glsl_prog(GLint prog)
ErrorF("Failed to link: %s\n", info);
FatalError("GLSL link failure\n");
}
+
+ if (glamor_priv->has_khr_debug) {
+ char *label;
+ va_list va;
+
+ va_start(va, format);
+ XNFvasprintf(&label, format, va);
+ glObjectLabel(GL_PROGRAM, prog, -1, label);
+ free(label);
+ va_end(va);
+ }
}
Bool
glamor_prepare_access(DrawablePtr drawable, glamor_access_t access)
{
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+ glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+ if (pixmap->devPrivate.ptr) {
+ /* Already mapped, nothing needs to be done. Note that we
+ * aren't allowing promotion from RO to RW, because it would
+ * require re-mapping the PBO.
+ */
+ assert(!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) ||
+ access == GLAMOR_ACCESS_RO ||
+ pixmap_priv->base.mapped_for_write);
+ return TRUE;
+ }
+ pixmap_priv->base.map_access = access;
return glamor_download_pixmap_to_cpu(pixmap, access);
}
@@ -242,13 +268,15 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
GLAMOR_VERTEX_POS, "v_position");
glBindAttribLocation(glamor_priv->finish_access_prog[0],
GLAMOR_VERTEX_SOURCE, "v_texcoord0");
- glamor_link_glsl_prog(glamor_priv->finish_access_prog[0]);
+ glamor_link_glsl_prog(screen, glamor_priv->finish_access_prog[0],
+ "finish access 0");
glBindAttribLocation(glamor_priv->finish_access_prog[1],
GLAMOR_VERTEX_POS, "v_position");
glBindAttribLocation(glamor_priv->finish_access_prog[1],
GLAMOR_VERTEX_SOURCE, "v_texcoord0");
- glamor_link_glsl_prog(glamor_priv->finish_access_prog[1]);
+ glamor_link_glsl_prog(screen, glamor_priv->finish_access_prog[1],
+ "finish access 1");
glamor_priv->finish_access_revert[0] =
glGetUniformLocation(glamor_priv->finish_access_prog[0], "revert");
@@ -261,7 +289,6 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
glUniform1i(sampler_uniform_location, 0);
glUniform1i(glamor_priv->finish_access_revert[0], 0);
glUniform1i(glamor_priv->finish_access_swap_rb[0], 0);
- glUseProgram(0);
glamor_priv->finish_access_revert[1] =
glGetUniformLocation(glamor_priv->finish_access_prog[1], "revert");
@@ -273,7 +300,6 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
glUniform1i(glamor_priv->finish_access_revert[1], 0);
glUniform1i(sampler_uniform_location, 0);
glUniform1i(glamor_priv->finish_access_swap_rb[1], 0);
- glUseProgram(0);
glamor_put_context(glamor_priv);
}
@@ -290,7 +316,7 @@ glamor_fini_finish_access_shaders(ScreenPtr screen)
}
void
-glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode)
+glamor_finish_access(DrawablePtr drawable)
{
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
@@ -300,7 +326,15 @@ glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode)
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv))
return;
- if (access_mode != GLAMOR_ACCESS_RO) {
+ /* If we are doing a series of unmaps from a nested map, we're
+ * done. None of the callers do any rendering to maps after
+ * starting an unmap sequence, so we don't need to delay until the
+ * last nested unmap.
+ */
+ if (!pixmap->devPrivate.ptr)
+ return;
+
+ if (pixmap_priv->base.map_access == GLAMOR_ACCESS_RW) {
glamor_restore_pixmap_to_texture(pixmap);
}
@@ -348,7 +382,7 @@ glamor_prepare_access_gc(GCPtr gc)
if (!glamor_prepare_access(&gc->tile.pixmap->drawable,
GLAMOR_ACCESS_RO)) {
if (gc->stipple)
- glamor_finish_access(&gc->stipple->drawable, GLAMOR_ACCESS_RO);
+ glamor_finish_access(&gc->stipple->drawable);
return FALSE;
}
}
@@ -362,9 +396,9 @@ void
glamor_finish_access_gc(GCPtr gc)
{
if (gc->fillStyle == FillTiled)
- glamor_finish_access(&gc->tile.pixmap->drawable, GLAMOR_ACCESS_RO);
+ glamor_finish_access(&gc->tile.pixmap->drawable);
if (gc->stipple)
- glamor_finish_access(&gc->stipple->drawable, GLAMOR_ACCESS_RO);
+ glamor_finish_access(&gc->stipple->drawable);
}
Bool
@@ -438,7 +472,7 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
(&old_tile->drawable, GLAMOR_ACCESS_RO)) {
new_tile =
fb24_32ReformatTile(old_tile, drawable->bitsPerPixel);
- glamor_finish_access(&old_tile->drawable, GLAMOR_ACCESS_RO);
+ glamor_finish_access(&old_tile->drawable);
}
}
if (new_tile) {
@@ -461,8 +495,7 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
if (glamor_prepare_access
(&gc->tile.pixmap->drawable, GLAMOR_ACCESS_RW)) {
fbPadPixmap(gc->tile.pixmap);
- glamor_finish_access
- (&gc->tile.pixmap->drawable, GLAMOR_ACCESS_RW);
+ glamor_finish_access(&gc->tile.pixmap->drawable);
}
}
}
@@ -478,7 +511,7 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
*/
if (glamor_prepare_access(&gc->stipple->drawable, GLAMOR_ACCESS_RW)) {
fbValidateGC(gc, changes, drawable);
- glamor_finish_access(&gc->stipple->drawable, GLAMOR_ACCESS_RW);
+ glamor_finish_access(&gc->stipple->drawable);
}
}
else {
@@ -522,7 +555,7 @@ glamor_bitmap_to_region(PixmapPtr pixmap)
if (!glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RO))
return NULL;
ret = fbPixmapToRegion(pixmap);
- glamor_finish_access(&pixmap->drawable, GLAMOR_ACCESS_RO);
+ glamor_finish_access(&pixmap->drawable);
return ret;
}
diff --git a/xorg-server/glamor/glamor_egl.c b/xorg-server/glamor/glamor_egl.c
index 05e6bd02e..812342129 100644
--- a/xorg-server/glamor/glamor_egl.c
+++ b/xorg-server/glamor/glamor_egl.c
@@ -54,10 +54,6 @@
static const char glamor_name[] = "glamor";
-static DevPrivateKeyRec glamor_egl_pixmap_private_key_index;
-DevPrivateKey glamor_egl_pixmap_private_key =
- &glamor_egl_pixmap_private_key_index;
-
static void
glamor_identify(int flags)
{
@@ -228,11 +224,13 @@ Bool
glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ struct glamor_pixmap_private *pixmap_priv;
struct glamor_egl_screen_private *glamor_egl;
PixmapPtr screen_pixmap;
glamor_egl = glamor_egl_get_screen_private(scrn);
screen_pixmap = screen->GetScreenPixmap(screen);
+ pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
if (!glamor_egl_create_textured_pixmap(screen_pixmap, handle, stride)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
@@ -240,8 +238,7 @@ glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride)
return FALSE;
}
- glamor_egl->front_image = dixLookupPrivate(&screen_pixmap->devPrivates,
- glamor_egl_pixmap_private_key);
+ glamor_egl->front_image = pixmap_priv->base.image;
glamor_set_screen_pixmap(screen_pixmap, glamor_egl->back_pixmap);
return TRUE;
}
@@ -282,6 +279,8 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
struct glamor_screen_private *glamor_priv =
glamor_get_screen_private(screen);
+ struct glamor_pixmap_private *pixmap_priv =
+ glamor_get_pixmap_private(pixmap);
struct glamor_egl_screen_private *glamor_egl;
EGLImageKHR image;
GLuint texture;
@@ -316,7 +315,7 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
glamor_create_texture_from_image(glamor_egl, image, &texture);
glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM);
glamor_set_pixmap_texture(pixmap, texture);
- dixSetPrivate(&pixmap->devPrivates, glamor_egl_pixmap_private_key, image);
+ pixmap_priv->base.image = image;
ret = TRUE;
done:
@@ -331,6 +330,8 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo)
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
struct glamor_screen_private *glamor_priv =
glamor_get_screen_private(screen);
+ struct glamor_pixmap_private *pixmap_priv =
+ glamor_get_pixmap_private(pixmap);
struct glamor_egl_screen_private *glamor_egl;
EGLImageKHR image;
GLuint texture;
@@ -350,7 +351,7 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo)
glamor_create_texture_from_image(glamor_egl, image, &texture);
glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM);
glamor_set_pixmap_texture(pixmap, texture);
- dixSetPrivate(&pixmap->devPrivates, glamor_egl_pixmap_private_key, image);
+ pixmap_priv->base.image = image;
ret = TRUE;
done:
@@ -395,6 +396,8 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
{
#ifdef GLAMOR_HAS_GBM
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
+ struct glamor_pixmap_private *pixmap_priv =
+ glamor_get_pixmap_private(pixmap);
struct glamor_screen_private *glamor_priv =
glamor_get_screen_private(screen);
struct glamor_egl_screen_private *glamor_egl;
@@ -412,10 +415,8 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
glamor_get_context(glamor_priv);
- image = dixLookupPrivate(&pixmap->devPrivates,
- glamor_egl_pixmap_private_key);
-
- if (image == EGL_NO_IMAGE_KHR || image == NULL) {
+ image = pixmap_priv->base.image;
+ if (!image) {
image = eglCreateImageKHR(glamor_egl->display,
glamor_egl->context,
EGL_GL_TEXTURE_2D_KHR,
@@ -424,8 +425,7 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
if (image == EGL_NO_IMAGE_KHR)
goto failure;
- dixSetPrivate(&pixmap->devPrivates,
- glamor_egl_pixmap_private_key, image);
+ pixmap_priv->base.image = image;
glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM);
}
@@ -441,10 +441,10 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
}
else {
if (glamor_get_fd_from_bo(glamor_egl->fd, bo, &fd)) {
- *stride = pixmap->devKind;
- *size = pixmap->devKind * gbm_bo_get_height(bo);
}
}
+ *stride = pixmap->devKind;
+ *size = pixmap->devKind * gbm_bo_get_height(bo);
gbm_bo_destroy(bo);
failure:
@@ -530,20 +530,18 @@ static void
_glamor_egl_destroy_pixmap_image(PixmapPtr pixmap)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
- EGLImageKHR image;
struct glamor_egl_screen_private *glamor_egl =
glamor_egl_get_screen_private(scrn);
+ struct glamor_pixmap_private *pixmap_priv =
+ glamor_get_pixmap_private(pixmap);
- image = dixLookupPrivate(&pixmap->devPrivates,
- glamor_egl_pixmap_private_key);
- if (image != EGL_NO_IMAGE_KHR && image != NULL) {
+ if (pixmap_priv->base.image) {
/* Before destroy an image which was attached to
* a texture. we must call glFlush to make sure the
* operation on that texture has been done.*/
glamor_block_handler(pixmap->drawable.pScreen);
- eglDestroyImageKHR(glamor_egl->display, image);
- dixSetPrivate(&pixmap->devPrivates, glamor_egl_pixmap_private_key,
- NULL);
+ eglDestroyImageKHR(glamor_egl->display, pixmap_priv->base.image);
+ pixmap_priv->base.image = NULL;
}
}
@@ -553,21 +551,21 @@ glamor_egl_exchange_buffers(PixmapPtr front, PixmapPtr back)
ScrnInfoPtr scrn = xf86ScreenToScrn(front->drawable.pScreen);
struct glamor_egl_screen_private *glamor_egl =
glamor_egl_get_screen_private(scrn);
- EGLImageKHR old_front_image;
- EGLImageKHR new_front_image;
+ EGLImageKHR temp;
+ struct glamor_pixmap_private *front_priv =
+ glamor_get_pixmap_private(front);
+ struct glamor_pixmap_private *back_priv =
+ glamor_get_pixmap_private(back);
glamor_pixmap_exchange_fbos(front, back);
- new_front_image =
- dixLookupPrivate(&back->devPrivates, glamor_egl_pixmap_private_key);
- old_front_image =
- dixLookupPrivate(&front->devPrivates, glamor_egl_pixmap_private_key);
- dixSetPrivate(&front->devPrivates, glamor_egl_pixmap_private_key,
- new_front_image);
- dixSetPrivate(&back->devPrivates, glamor_egl_pixmap_private_key,
- old_front_image);
+
+ temp = back_priv->base.image;
+ back_priv->base.image = front_priv->base.image;
+ front_priv->base.image = temp;
+
glamor_set_pixmap_type(front, GLAMOR_TEXTURE_DRM);
glamor_set_pixmap_type(back, GLAMOR_TEXTURE_DRM);
- glamor_egl->front_image = new_front_image;
+ glamor_egl->front_image = front_priv->base.image;
}
@@ -584,24 +582,23 @@ glamor_egl_close_screen(ScreenPtr screen)
{
ScrnInfoPtr scrn;
struct glamor_egl_screen_private *glamor_egl;
+ struct glamor_pixmap_private *pixmap_priv;
PixmapPtr screen_pixmap;
- EGLImageKHR back_image;
scrn = xf86ScreenToScrn(screen);
glamor_egl = glamor_egl_get_screen_private(scrn);
screen_pixmap = screen->GetScreenPixmap(screen);
+ pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
- eglDestroyImageKHR(glamor_egl->display,glamor_egl->front_image);
- dixSetPrivate(&screen_pixmap->devPrivates, glamor_egl_pixmap_private_key,
- NULL);
+ eglDestroyImageKHR(glamor_egl->display, glamor_egl->front_image);
+ pixmap_priv->base.image = NULL;
glamor_egl->front_image = NULL;
+
if (glamor_egl->back_pixmap && *glamor_egl->back_pixmap) {
- back_image = dixLookupPrivate(&(*glamor_egl->back_pixmap)->devPrivates,
- glamor_egl_pixmap_private_key);
- if (back_image != NULL && back_image != EGL_NO_IMAGE_KHR) {
- eglDestroyImageKHR(glamor_egl->display, back_image);
- dixSetPrivate(&(*glamor_egl->back_pixmap)->devPrivates,
- glamor_egl_pixmap_private_key, NULL);
+ pixmap_priv = glamor_get_pixmap_private(*glamor_egl->back_pixmap);
+ if (pixmap_priv->base.image) {
+ eglDestroyImageKHR(glamor_egl->display, pixmap_priv->base.image);
+ pixmap_priv->base.image = NULL;
}
}
@@ -610,25 +607,6 @@ glamor_egl_close_screen(ScreenPtr screen)
return screen->CloseScreen(screen);
}
-static Bool
-glamor_egl_has_extension(struct glamor_egl_screen_private *glamor_egl,
- const char *extension)
-{
- const char *pext;
- int ext_len;
-
- ext_len = strlen(extension);
- pext = (const char *) eglQueryString(glamor_egl->display, EGL_EXTENSIONS);
- if (pext == NULL || extension == NULL)
- return FALSE;
- while ((pext = strstr(pext, extension)) != NULL) {
- if (pext[ext_len] == ' ' || pext[ext_len] == '\0')
- return TRUE;
- pext += ext_len;
- }
- return FALSE;
-}
-
static int
glamor_dri3_open(ScreenPtr screen,
RRProviderPtr provider,
@@ -799,14 +777,14 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
xf86Msg(X_INFO, "%s: EGL version %s:\n", glamor_name, version);
#define GLAMOR_CHECK_EGL_EXTENSION(EXT) \
- if (!glamor_egl_has_extension(glamor_egl, "EGL_" #EXT)) { \
+ if (!epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT)) { \
ErrorF("EGL_" #EXT " required.\n"); \
return FALSE; \
}
#define GLAMOR_CHECK_EGL_EXTENSIONS(EXT1, EXT2) \
- if (!glamor_egl_has_extension(glamor_egl, "EGL_" #EXT1) && \
- !glamor_egl_has_extension(glamor_egl, "EGL_" #EXT2)) { \
+ if (!epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT1) && \
+ !epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT2)) { \
ErrorF("EGL_" #EXT1 " or EGL_" #EXT2 " required.\n"); \
return FALSE; \
}
@@ -821,8 +799,10 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
#endif
#ifdef GLAMOR_HAS_GBM
- if (glamor_egl_has_extension(glamor_egl, "EGL_KHR_gl_texture_2D_image") &&
- glamor_egl_has_extension(glamor_egl, "EGL_EXT_image_dma_buf_import"))
+ if (epoxy_has_egl_extension(glamor_egl->display,
+ "EGL_KHR_gl_texture_2D_image") &&
+ epoxy_has_egl_extension(glamor_egl->display,
+ "EGL_EXT_image_dma_buf_import"))
glamor_egl->dri3_capable = TRUE;
#endif
@@ -851,20 +831,9 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
return TRUE;
}
+/** Stub to retain compatibility with pre-server-1.16 ABI. */
Bool
glamor_egl_init_textured_pixmap(ScreenPtr screen)
{
- ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
- struct glamor_egl_screen_private *glamor_egl =
- glamor_egl_get_screen_private(scrn);
- if (!dixRegisterPrivateKey
- (glamor_egl_pixmap_private_key, PRIVATE_PIXMAP, 0)) {
- LogMessage(X_WARNING,
- "glamor%d: Failed to allocate egl pixmap private\n",
- screen->myNum);
- return FALSE;
- }
- if (glamor_egl->dri3_capable)
- glamor_enable_dri3(screen);
return TRUE;
}
diff --git a/xorg-server/glamor/glamor_fbo.c b/xorg-server/glamor/glamor_fbo.c
index 281cf830e..640b6fd81 100644
--- a/xorg-server/glamor/glamor_fbo.c
+++ b/xorg-server/glamor/glamor_fbo.c
@@ -505,7 +505,7 @@ glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo)
case GLAMOR_TEXTURE_LARGE:
case GLAMOR_TEXTURE_ONLY:
case GLAMOR_TEXTURE_DRM:
- pixmap_priv->base.gl_fbo = 1;
+ pixmap_priv->base.gl_fbo = GLAMOR_FBO_NORMAL;
if (fbo->tex != 0)
pixmap_priv->base.gl_tex = 1;
else {
diff --git a/xorg-server/glamor/glamor_fill.c b/xorg-server/glamor/glamor_fill.c
index dda55eace..7461b62fa 100644
--- a/xorg-server/glamor/glamor_fill.c
+++ b/xorg-server/glamor/glamor_fill.c
@@ -27,10 +27,14 @@
#include "glamor_priv.h"
-/** @file glamor_fillspans.c
+/** @file glamor_fill.c
*
* GC fill implementation, based loosely on fb_fill.c
*/
+
+/**
+ * Fills the given rectangle of a drawable with the GC's fill style.
+ */
Bool
glamor_fill(DrawablePtr drawable,
GCPtr gc, int x, int y, int width, int height, Bool fallback)
@@ -108,13 +112,12 @@ glamor_fill(DrawablePtr drawable,
x = 0;
y = 0;
}
- if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
- if (glamor_prepare_access_gc(gc)) {
- fbFill(drawable, gc, x, y, width, height);
- glamor_finish_access_gc(gc);
- }
- glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
+ if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) &&
+ glamor_prepare_access_gc(gc)) {
+ fbFill(drawable, gc, x, y, width, height);
}
+ glamor_finish_access_gc(gc);
+ glamor_finish_access(drawable);
if (sub_pixmap != NULL) {
if (gc->fillStyle != FillSolid) {
@@ -162,7 +165,7 @@ glamor_init_solid_shader(ScreenPtr screen)
glBindAttribLocation(glamor_priv->solid_prog,
GLAMOR_VERTEX_POS, "v_position");
- glamor_link_glsl_prog(glamor_priv->solid_prog);
+ glamor_link_glsl_prog(screen, glamor_priv->solid_prog, "solid");
glamor_priv->solid_color_uniform_location =
glGetUniformLocation(glamor_priv->solid_prog, "color");
@@ -187,9 +190,9 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color)
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
GLfloat xscale, yscale;
- float vertices[32];
- float *pvertices = vertices;
- int valid_nbox = ARRAY_SIZE(vertices);
+ float stack_vertices[32];
+ float *vertices = stack_vertices;
+ int valid_nbox = ARRAY_SIZE(stack_vertices) / (4 * 2);
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
@@ -200,20 +203,18 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color)
pixmap_priv_get_dest_scale(pixmap_priv, &xscale, &yscale);
- if (_X_UNLIKELY(nbox * 4 * 2 > ARRAY_SIZE(vertices))) {
- int allocated_box;
+ if (nbox > valid_nbox) {
+ int allocated_nbox;
+ float *new_vertices;
- if (nbox * 6 > GLAMOR_COMPOSITE_VBO_VERT_CNT) {
- allocated_box = GLAMOR_COMPOSITE_VBO_VERT_CNT / 6;
- }
+ if (nbox > GLAMOR_COMPOSITE_VBO_VERT_CNT / 6)
+ allocated_nbox = GLAMOR_COMPOSITE_VBO_VERT_CNT / 6;
else
- allocated_box = nbox;
- pvertices = malloc(allocated_box * 4 * 2 * sizeof(float));
- if (pvertices)
- valid_nbox = allocated_box;
- else {
- pvertices = vertices;
- valid_nbox = ARRAY_SIZE(vertices) / (4 * 2);
+ allocated_nbox = nbox;
+ new_vertices = malloc(allocated_nbox * 4 * 2 * sizeof(float));
+ if (new_vertices) {
+ vertices = new_vertices;
+ valid_nbox = allocated_nbox;
}
}
@@ -221,22 +222,22 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo);
glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
- GL_FALSE, 2 * sizeof(float), pvertices);
+ GL_FALSE, 2 * sizeof(float), vertices);
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
while (nbox) {
int box_cnt, i;
- float *valid_vertices;
+ float *next_box;
- valid_vertices = pvertices;
+ next_box = vertices;
box_cnt = nbox > valid_nbox ? valid_nbox : nbox;
for (i = 0; i < box_cnt; i++) {
glamor_set_normalize_vcoords(pixmap_priv, xscale, yscale,
box[i].x1, box[i].y1,
box[i].x2, box[i].y2,
glamor_priv->yInverted,
- valid_vertices);
- valid_vertices += 4 * 2;
+ next_box);
+ next_box += 4 * 2;
}
if (box_cnt == 1)
glDrawArrays(GL_TRIANGLE_FAN, 0, box_cnt * 4);
@@ -253,16 +254,21 @@ _glamor_solid_boxes(PixmapPtr pixmap, BoxPtr box, int nbox, float *color)
box += box_cnt;
}
- if (pvertices != vertices)
- free(pvertices);
+ if (vertices != stack_vertices)
+ free(vertices);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glUseProgram(0);
glamor_put_context(glamor_priv);
glamor_priv->state = RENDER_STATE;
glamor_priv->render_idle_cnt = 0;
}
+/**
+ * Fills the given rectangles of pixmap with an X pixel value.
+ *
+ * This is a helper used by other code after clipping and translation
+ * of coordinates to a glamor backing pixmap.
+ */
Bool
glamor_solid_boxes(PixmapPtr pixmap,
BoxPtr box, int nbox, unsigned long fg_pixel)
@@ -310,6 +316,12 @@ glamor_solid_boxes(PixmapPtr pixmap,
return TRUE;
}
+/**
+ * Fills a rectangle of a pixmap with an X pixel value.
+ *
+ * This is a helper used by other glamor code mostly for clearing of
+ * buffers to 0.
+ */
Bool
glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
unsigned char alu, unsigned long planemask, unsigned long fg_pixel)
diff --git a/xorg-server/glamor/glamor_fillspans.c b/xorg-server/glamor/glamor_fillspans.c
index 7261d2842..8cbd79f6d 100644
--- a/xorg-server/glamor/glamor_fillspans.c
+++ b/xorg-server/glamor/glamor_fillspans.c
@@ -79,13 +79,12 @@ _glamor_fill_spans(DrawablePtr drawable,
}
glamor_fallback("to %p (%c)\n", drawable,
glamor_get_drawable_location(drawable));
- if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
- if (glamor_prepare_access_gc(gc)) {
- fbFillSpans(drawable, gc, n, points, widths, sorted);
- glamor_finish_access_gc(gc);
- }
- glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
+ if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) &&
+ glamor_prepare_access_gc(gc)) {
+ fbFillSpans(drawable, gc, n, points, widths, sorted);
}
+ glamor_finish_access_gc(gc);
+ glamor_finish_access(drawable);
ret = TRUE;
done:
diff --git a/xorg-server/glamor/glamor_getimage.c b/xorg-server/glamor/glamor_getimage.c
index 5609e707f..a932473e8 100644
--- a/xorg-server/glamor/glamor_getimage.c
+++ b/xorg-server/glamor/glamor_getimage.c
@@ -44,8 +44,6 @@ _glamor_get_image(DrawablePtr drawable, int x, int y, int w, int h,
if (format != ZPixmap)
goto fall_back;
- pixmap = glamor_get_drawable_pixmap(drawable);
- glamor_get_drawable_deltas(drawable, pixmap, &x_off, &y_off);
if (!glamor_set_planemask(pixmap, planeMask)) {
glamor_fallback("Failedto set planemask in glamor_solid.\n");
diff --git a/xorg-server/glamor/glamor_getspans.c b/xorg-server/glamor/glamor_getspans.c
index ff58725d6..42df87f3d 100644
--- a/xorg-server/glamor/glamor_getspans.c
+++ b/xorg-server/glamor/glamor_getspans.c
@@ -69,8 +69,8 @@ _glamor_get_spans(DrawablePtr drawable,
ret = TRUE;
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RO)) {
fbGetSpans(drawable, wmax, points, widths, count, dst);
- glamor_finish_access(drawable, GLAMOR_ACCESS_RO);
}
+ glamor_finish_access(drawable);
done:
return ret;
}
diff --git a/xorg-server/glamor/glamor_glx.c b/xorg-server/glamor/glamor_glx.c
index 311bf758d..8f47c3d2c 100644
--- a/xorg-server/glamor/glamor_glx.c
+++ b/xorg-server/glamor/glamor_glx.c
@@ -53,13 +53,7 @@ glamor_glx_get_context(struct glamor_context *glamor_ctx)
static void
glamor_glx_put_context(struct glamor_context *glamor_ctx)
{
- if (--glamor_ctx->get_count)
- return;
-
- /* We actually reset the context, so that indirect GLX's EGL usage
- * won't get confused by ours.
- */
- glXMakeCurrent(glamor_ctx->display, None, NULL);
+ --glamor_ctx->get_count;
}
Bool
diff --git a/xorg-server/glamor/glamor_glyphblt.c b/xorg-server/glamor/glamor_glyphblt.c
index 6f754ce2b..a58cef907 100644
--- a/xorg-server/glamor/glamor_glyphblt.c
+++ b/xorg-server/glamor/glamor_glyphblt.c
@@ -27,6 +27,140 @@
*/
#include "glamor_priv.h"
+#include <dixfontstr.h>
+
+static Bool
+glamor_poly_glyph_blt_pixels(DrawablePtr drawable, GCPtr gc,
+ int x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci)
+{
+ ScreenPtr screen = drawable->pScreen;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+ PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+ glamor_pixmap_private *pixmap_priv;
+ int off_x, off_y;
+ GLfloat xscale, yscale;
+ float color[4];
+ unsigned long fg_pixel = gc->fgPixel;
+ char *vbo_offset;
+ RegionPtr clip;
+ int num_points, max_points;
+ float *points = NULL;
+
+ x += drawable->x;
+ y += drawable->y;
+
+ if (gc->fillStyle != FillSolid) {
+ glamor_fallback("gc fillstyle not solid\n");
+ return FALSE;
+ }
+
+ pixmap_priv = glamor_get_pixmap_private(pixmap);
+ if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+ return FALSE;
+
+ glamor_get_context(glamor_priv);
+ if (!glamor_set_alu(screen, gc->alu)) {
+ if (gc->alu == GXclear)
+ fg_pixel = 0;
+ else {
+ glamor_fallback("unsupported alu %x\n", gc->alu);
+ glamor_put_context(glamor_priv);
+ return FALSE;
+ }
+ }
+
+ if (!glamor_set_planemask(pixmap, gc->planemask)) {
+ glamor_fallback("Failed to set planemask in %s.\n", __FUNCTION__);
+ glamor_put_context(glamor_priv);
+ return FALSE;
+ }
+
+ glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
+
+ glamor_set_destination_pixmap_priv_nc(pixmap_priv);
+ pixmap_priv_get_dest_scale(pixmap_priv, &xscale, &yscale);
+
+ glUseProgram(glamor_priv->solid_prog);
+
+ glamor_get_rgba_from_pixel(fg_pixel,
+ &color[0], &color[1], &color[2], &color[3],
+ format_for_pixmap(pixmap));
+ glUniform4fv(glamor_priv->solid_color_uniform_location, 1, color);
+
+ clip = fbGetCompositeClip(gc);
+
+ glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+ max_points = 500;
+ num_points = 0;
+ while (nglyph--) {
+ CharInfoPtr charinfo = *ppci++;
+ int w = GLYPHWIDTHPIXELS(charinfo);
+ int h = GLYPHHEIGHTPIXELS(charinfo);
+ uint8_t *glyphbits = FONTGLYPHBITS(NULL, charinfo);
+
+ if (w && h) {
+ int glyph_x = x + charinfo->metrics.leftSideBearing;
+ int glyph_y = y - charinfo->metrics.ascent;
+ int glyph_stride = GLYPHWIDTHBYTESPADDED(charinfo);
+ int xx, yy;
+
+ for (yy = 0; yy < h; yy++) {
+ uint8_t *glyph_row = glyphbits + glyph_stride * yy;
+ for (xx = 0; xx < w; xx++) {
+ int pt_x_i = glyph_x + xx;
+ int pt_y_i = glyph_y + yy;
+ float pt_x_f, pt_y_f;
+ if (!(glyph_row[xx / 8] & (1 << xx % 8)))
+ continue;
+
+ if (!RegionContainsPoint(clip, pt_x_i, pt_y_i, NULL))
+ continue;
+
+ if (!num_points) {
+ points = glamor_get_vbo_space(screen,
+ max_points * 2 * sizeof(float),
+ &vbo_offset);
+
+ glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
+ GL_FALSE, 2 * sizeof(float),
+ vbo_offset);
+ }
+
+ pt_x_f = v_from_x_coord_x(xscale, pt_x_i + off_x + 0.5);
+ if (glamor_priv->yInverted)
+ pt_y_f = v_from_x_coord_y_inverted(yscale, pt_y_i + off_y + 0.5);
+ else
+ pt_y_f = v_from_x_coord_y(yscale, pt_y_i + off_y + 0.5);
+
+ points[num_points * 2 + 0] = pt_x_f;
+ points[num_points * 2 + 1] = pt_y_f;
+ num_points++;
+
+ if (num_points == max_points) {
+ glamor_put_vbo_space(screen);
+ glDrawArrays(GL_POINTS, 0, num_points);
+ num_points = 0;
+ }
+ }
+ }
+ }
+
+ x += charinfo->metrics.characterWidth;
+ }
+
+ if (num_points) {
+ glamor_put_vbo_space(screen);
+ glDrawArrays(GL_POINTS, 0, num_points);
+ }
+
+ glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+ glamor_put_context(glamor_priv);
+
+ return TRUE;
+}
static Bool
_glamor_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
@@ -64,6 +198,9 @@ _glamor_poly_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr *ppci, void *pglyphBase, Bool fallback)
{
+ if (glamor_poly_glyph_blt_pixels(pDrawable, pGC, x, y, nglyph, ppci))
+ return TRUE;
+
if (!fallback && glamor_ddx_fallback_check_pixmap(pDrawable)
&& glamor_ddx_fallback_check_gc(pGC))
return FALSE;
@@ -91,15 +228,129 @@ glamor_poly_glyph_blt_nf(DrawablePtr pDrawable, GCPtr pGC,
}
static Bool
+glamor_push_pixels_points(GCPtr gc, PixmapPtr bitmap,
+ DrawablePtr drawable, int w, int h, int x, int y)
+{
+ ScreenPtr screen = drawable->pScreen;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+ PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+ glamor_pixmap_private *pixmap_priv;
+ uint8_t *bitmap_data = bitmap->devPrivate.ptr;
+ int bitmap_stride = bitmap->devKind;
+ int off_x, off_y;
+ int yy, xx;
+ GLfloat xscale, yscale;
+ float color[4];
+ unsigned long fg_pixel = gc->fgPixel;
+ float *points, *next_point;
+ int num_points = 0;
+ char *vbo_offset;
+ RegionPtr clip;
+
+ if (w * h > MAXINT / (2 * sizeof(float)))
+ return FALSE;
+
+ if (gc->fillStyle != FillSolid) {
+ glamor_fallback("gc fillstyle not solid\n");
+ return FALSE;
+ }
+
+ pixmap_priv = glamor_get_pixmap_private(pixmap);
+ if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+ return FALSE;
+
+ glamor_get_context(glamor_priv);
+ if (!glamor_set_alu(screen, gc->alu)) {
+ if (gc->alu == GXclear)
+ fg_pixel = 0;
+ else {
+ glamor_fallback("unsupported alu %x\n", gc->alu);
+ glamor_put_context(glamor_priv);
+ return FALSE;
+ }
+ }
+
+ if (!glamor_set_planemask(pixmap, gc->planemask)) {
+ glamor_fallback("Failed to set planemask in %s.\n", __FUNCTION__);
+ glamor_put_context(glamor_priv);
+ return FALSE;
+ }
+
+ glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
+
+ glamor_set_destination_pixmap_priv_nc(pixmap_priv);
+ pixmap_priv_get_dest_scale(pixmap_priv, &xscale, &yscale);
+
+ glUseProgram(glamor_priv->solid_prog);
+
+ glamor_get_rgba_from_pixel(fg_pixel,
+ &color[0], &color[1], &color[2], &color[3],
+ format_for_pixmap(pixmap));
+ glUniform4fv(glamor_priv->solid_color_uniform_location, 1, color);
+
+ points = glamor_get_vbo_space(screen, w * h * sizeof(float) * 2,
+ &vbo_offset);
+ next_point = points;
+
+ clip = fbGetCompositeClip(gc);
+
+ /* Note that because fb sets miTranslate in the GC, our incoming X
+ * and Y are in screen coordinate space (same for spans, but not
+ * other operations).
+ */
+ for (yy = 0; yy < h; yy++) {
+ uint8_t *bitmap_row = bitmap_data + yy * bitmap_stride;
+ for (xx = 0; xx < w; xx++) {
+ if (bitmap_row[xx / 8] & (1 << xx % 8) &&
+ RegionContainsPoint(clip,
+ x + xx,
+ y + yy,
+ NULL)) {
+ next_point[0] = v_from_x_coord_x(xscale, x + xx + off_x + 0.5);
+ if (glamor_priv->yInverted)
+ next_point[1] = v_from_x_coord_y_inverted(yscale, y + yy + off_y + 0.5);
+ else
+ next_point[1] = v_from_x_coord_y(yscale, y + yy + off_y + 0.5);
+
+ next_point += 2;
+ num_points++;
+ }
+ }
+ }
+ glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
+ GL_FALSE, 2 * sizeof(float),
+ vbo_offset);
+ glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+ glamor_put_vbo_space(screen);
+
+ glDrawArrays(GL_POINTS, 0, num_points);
+
+ glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+ glamor_put_context(glamor_priv);
+
+ return TRUE;
+}
+
+static Bool
_glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap,
DrawablePtr pDrawable, int w, int h, int x, int y,
Bool fallback)
{
+ glamor_pixmap_private *pixmap_priv;
+
if (!fallback && glamor_ddx_fallback_check_pixmap(pDrawable)
&& glamor_ddx_fallback_check_pixmap(&pBitmap->drawable)
&& glamor_ddx_fallback_check_gc(pGC))
return FALSE;
+ pixmap_priv = glamor_get_pixmap_private(pBitmap);
+ if (pixmap_priv->type == GLAMOR_MEMORY) {
+ if (glamor_push_pixels_points(pGC, pBitmap, pDrawable, w, h, x, y))
+ return TRUE;
+ }
+
miPushPixels(pGC, pBitmap, pDrawable, w, h, x, y);
return TRUE;
}
diff --git a/xorg-server/glamor/glamor_glyphs.c b/xorg-server/glamor/glamor_glyphs.c
index caafa4348..2b2c735d4 100644
--- a/xorg-server/glamor/glamor_glyphs.c
+++ b/xorg-server/glamor/glamor_glyphs.c
@@ -303,7 +303,7 @@ glamor_glyphs_fini(ScreenPtr pScreen)
* rest of the allocated structures for all caches with the given format.
*/
-static Bool
+Bool
glamor_realize_glyph_caches(ScreenPtr pScreen)
{
glamor_screen_private *glamor = glamor_get_screen_private(pScreen);
@@ -314,10 +314,6 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
};
int i;
- if (glamor->glyph_cache_initialized)
- return TRUE;
-
- glamor->glyph_cache_initialized = TRUE;
memset(glamor->glyphCaches, 0, sizeof(glamor->glyphCaches));
for (i = 0; i < sizeof(formats) / sizeof(formats[0]); i++) {
@@ -370,16 +366,27 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
return FALSE;
}
+/**
+ * Called by glamor_create_screen_resources() to set up the glyph cache.
+ *
+ * This was previously required to be called by the drivers, but not
+ * as of the xserver 1.16 ABI.
+ */
Bool
glamor_glyphs_init(ScreenPtr pScreen)
{
+ glamor_screen_private *glamor = glamor_get_screen_private(pScreen);
+
+ if (glamor->glyph_cache_initialized)
+ return TRUE;
+
if (!dixRegisterPrivateKey(&glamor_glyph_key,
PRIVATE_GLYPH, sizeof(struct glamor_glyph)))
return FALSE;
- /* Skip pixmap creation if we don't intend to use it. */
+ glamor->glyph_cache_initialized = TRUE;
- return glamor_realize_glyph_caches(pScreen);
+ return TRUE;
}
/* The most efficient thing to way to upload the glyph to the screen
diff --git a/xorg-server/glamor/glamor_gradient.c b/xorg-server/glamor/glamor_gradient.c
index 6a7b528f9..f77d6a8e3 100644
--- a/xorg-server/glamor/glamor_gradient.c
+++ b/xorg-server/glamor/glamor_gradient.c
@@ -377,9 +377,7 @@ _glamor_create_radial_gradient_program(ScreenPtr screen, int stops_count,
glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_POS, "v_position");
glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_SOURCE, "v_texcoord");
- glamor_link_glsl_prog(gradient_prog);
-
- glUseProgram(0);
+ glamor_link_glsl_prog(screen, gradient_prog, "radial gradient");
if (dyn_gen) {
index = 2;
@@ -590,9 +588,7 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count,
glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_POS, "v_position");
glBindAttribLocation(gradient_prog, GLAMOR_VERTEX_SOURCE, "v_texcoord");
- glamor_link_glsl_prog(gradient_prog);
-
- glUseProgram(0);
+ glamor_link_glsl_prog(screen, gradient_prog, "linear gradient");
if (dyn_gen) {
index = 2;
@@ -983,8 +979,6 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
"repeat_type");
n_stop_uniform_location = glGetUniformLocation(gradient_prog, "n_stop");
A_value_uniform_location = glGetUniformLocation(gradient_prog, "A_value");
- repeat_type_uniform_location =glGetUniformLocation(gradient_prog,
- "repeat_type");
c1_uniform_location = glGetUniformLocation(gradient_prog, "c1");
r1_uniform_location = glGetUniformLocation(gradient_prog, "r1");
c2_uniform_location = glGetUniformLocation(gradient_prog, "c2");
@@ -1171,7 +1165,6 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glUseProgram(0);
glamor_put_context(glamor_priv);
return dst_picture;
@@ -1193,7 +1186,6 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glUseProgram(0);
glamor_put_context(glamor_priv);
return NULL;
}
@@ -1524,7 +1516,6 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glUseProgram(0);
glamor_put_context(glamor_priv);
return dst_picture;
@@ -1546,7 +1537,6 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glUseProgram(0);
glamor_put_context(glamor_priv);
return NULL;
}
diff --git a/xorg-server/glamor/glamor_picture.c b/xorg-server/glamor/glamor_picture.c
index 8bbe2e98b..5fdc5f9b0 100644
--- a/xorg-server/glamor/glamor_picture.c
+++ b/xorg-server/glamor/glamor_picture.c
@@ -55,12 +55,12 @@ glamor_prepare_access_picture(PicturePtr picture, glamor_access_t access)
}
void
-glamor_finish_access_picture(PicturePtr picture, glamor_access_t access)
+glamor_finish_access_picture(PicturePtr picture)
{
if (!picture || !picture->pDrawable)
return;
- glamor_finish_access(picture->pDrawable, access);
+ glamor_finish_access(picture->pDrawable);
}
/*
diff --git a/xorg-server/glamor/glamor_pixmap.c b/xorg-server/glamor/glamor_pixmap.c
index 119e4d9d1..615faad33 100644
--- a/xorg-server/glamor/glamor_pixmap.c
+++ b/xorg-server/glamor/glamor_pixmap.c
@@ -725,8 +725,11 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
- if (bits == NULL)
+ assert(pbo || bits != 0);
+ if (bits == NULL) {
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
+ glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
+ }
if (non_sub)
glTexImage2D(GL_TEXTURE_2D, 0, iformat, w, h, 0, format, type, bits);
else
@@ -853,7 +856,6 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- glUseProgram(0);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glDeleteTextures(1, &tex);
@@ -886,7 +888,7 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha,
pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
- if (pixmap_priv->base.gl_fbo)
+ if (pixmap_priv->base.gl_fbo != GLAMOR_FBO_UNATTACHED)
return 0;
if (pixmap_priv->base.fbo
@@ -1178,7 +1180,6 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glUseProgram(0);
glamor_put_context(glamor_priv);
return temp_fbo;
}
@@ -1216,8 +1217,6 @@ _glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, GLenum format,
gl_access = GL_READ_ONLY;
gl_usage = GL_STREAM_READ;
break;
- case GLAMOR_ACCESS_WO:
- return bits;
case GLAMOR_ACCESS_RW:
gl_access = GL_READ_WRITE;
gl_usage = GL_DYNAMIC_DRAW;
@@ -1472,8 +1471,7 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
stride = pixmap->devKind;
- if (access == GLAMOR_ACCESS_WO
- || glamor_priv->gl_flavor == GLAMOR_GL_ES2
+ if (glamor_priv->gl_flavor == GLAMOR_GL_ES2
|| (!glamor_priv->has_pack_invert && !glamor_priv->yInverted)
|| pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
data = malloc(stride * pixmap->drawable.height);
@@ -1603,12 +1601,6 @@ glamor_get_sub_pixmap(PixmapPtr pixmap, int x, int y, int w, int h,
return NULL;
w = (x + w) > pixmap->drawable.width ? (pixmap->drawable.width - x) : w;
h = (y + h) > pixmap->drawable.height ? (pixmap->drawable.height - y) : h;
- if (access == GLAMOR_ACCESS_WO) {
- sub_pixmap = glamor_create_pixmap(pixmap->drawable.pScreen, w, h,
- pixmap->drawable.depth,
- GLAMOR_CREATE_PIXMAP_CPU);
- return sub_pixmap;
- }
glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
pixmap_priv = glamor_get_pixmap_private(pixmap);
diff --git a/xorg-server/glamor/glamor_polyfillrect.c b/xorg-server/glamor/glamor_polyfillrect.c
index a25fc4ed5..1e361a44f 100644
--- a/xorg-server/glamor/glamor_polyfillrect.c
+++ b/xorg-server/glamor/glamor_polyfillrect.c
@@ -96,13 +96,12 @@ _glamor_poly_fill_rect(DrawablePtr drawable,
glamor_fallback(" to %p (%c)\n",
drawable, glamor_get_drawable_location(drawable));
- if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
- if (glamor_prepare_access_gc(gc)) {
- fbPolyFillRect(drawable, gc, nrect, prect);
- glamor_finish_access_gc(gc);
- }
- glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
+ if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) &&
+ glamor_prepare_access_gc(gc)) {
+ fbPolyFillRect(drawable, gc, nrect, prect);
}
+ glamor_finish_access_gc(gc);
+ glamor_finish_access(drawable);
ret = TRUE;
done:
diff --git a/xorg-server/glamor/glamor_polylines.c b/xorg-server/glamor/glamor_polylines.c
index b94161760..1adf45ddc 100644
--- a/xorg-server/glamor/glamor_polylines.c
+++ b/xorg-server/glamor/glamor_polylines.c
@@ -51,8 +51,9 @@ _glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
/* This ends up in miSetSpans, which is accelerated as well as we
* can hope X wide lines will be.
*/
- goto wide_line;
+ goto fail;
}
+
if (gc->lineStyle != LineSolid) {
glamor_fallback("non-solid fill line style %d\n", gc->lineStyle);
goto fail;
@@ -104,20 +105,19 @@ _glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
&& glamor_ddx_fallback_check_gc(gc))
return FALSE;
- if (gc->lineWidth == 0) {
- if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
- if (glamor_prepare_access_gc(gc)) {
- fbPolyLine(drawable, gc, mode, n, points);
- glamor_finish_access_gc(gc);
- }
- glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
- }
- }
- else {
- wide_line:
- /* fb calls mi functions in the lineWidth != 0 case. */
- fbPolyLine(drawable, gc, mode, n, points);
+ switch (gc->lineStyle) {
+ case LineSolid:
+ if (gc->lineWidth == 0)
+ miZeroLine(drawable, gc, mode, n, points);
+ else
+ miWideLine(drawable, gc, mode, n, points);
+ break;
+ case LineOnOffDash:
+ case LineDoubleDash:
+ miWideDash(drawable, gc, mode, n, points);
+ break;
}
+
return TRUE;
}
diff --git a/xorg-server/glamor/glamor_priv.h b/xorg-server/glamor/glamor_priv.h
index d15eabd9e..bc7d3f827 100644
--- a/xorg-server/glamor/glamor_priv.h
+++ b/xorg-server/glamor/glamor_priv.h
@@ -36,6 +36,10 @@
#include "glamor.h"
#include <epoxy/gl.h>
+#if GLAMOR_HAS_GBM
+#define MESA_EGL_NO_X11_HEADERS
+#include <epoxy/egl.h>
+#endif
#define GLAMOR_DEFAULT_PRECISION \
"#ifdef GL_ES\n" \
@@ -169,6 +173,7 @@ typedef struct {
struct glamor_saved_procs {
CloseScreenProcPtr close_screen;
+ CreateScreenResourcesProcPtr create_screen_resources;
CreateGCProcPtr create_gc;
CreatePixmapProcPtr create_pixmap;
DestroyPixmapProcPtr destroy_pixmap;
@@ -209,6 +214,7 @@ typedef struct glamor_screen_private {
int has_pack_invert;
int has_fbo_blit;
int has_buffer_storage;
+ int has_khr_debug;
int max_fbo_size;
struct xorg_list
@@ -283,11 +289,23 @@ typedef struct glamor_screen_private {
typedef enum glamor_access {
GLAMOR_ACCESS_RO,
GLAMOR_ACCESS_RW,
- GLAMOR_ACCESS_WO,
} glamor_access_t;
-#define GLAMOR_FBO_NORMAL 1
-#define GLAMOR_FBO_DOWNLOADED 2
+enum glamor_fbo_state {
+ /** There is no storage attached to the pixmap. */
+ GLAMOR_FBO_UNATTACHED,
+ /**
+ * The pixmap has FBO storage attached, but devPrivate.ptr doesn't
+ * point at anything.
+ */
+ GLAMOR_FBO_NORMAL,
+ /**
+ * The FBO is present and can be accessed as a linear memory
+ * mapping through devPrivate.ptr.
+ */
+ GLAMOR_FBO_DOWNLOADED,
+};
+
/* glamor_pixmap_fbo:
* @list: to be used to link to the cache pool list.
* @expire: when push to cache pool list, set a expire count.
@@ -319,12 +337,6 @@ typedef struct glamor_pixmap_fbo {
/*
* glamor_pixmap_private - glamor pixmap's private structure.
- * @gl_fbo:
- * 0 - The pixmap doesn't has a fbo attached to it.
- * GLAMOR_FBO_NORMAL - The pixmap has a fbo and can be accessed normally.
- * GLAMOR_FBO_DOWNLOADED - The pixmap has a fbo and already downloaded to
- * CPU, so it can only be treated as a in-memory pixmap
- * if this bit is set.
* @gl_tex: The pixmap is in a gl texture originally.
* @is_picture: The drawable is attached to a picture.
* @pict_format: the corresponding picture's format.
@@ -398,7 +410,13 @@ typedef struct glamor_pixmap_clipped_regions {
typedef struct glamor_pixmap_private_base {
glamor_pixmap_type_t type;
- unsigned char gl_fbo:2;
+ enum glamor_fbo_state gl_fbo;
+ /**
+ * If devPrivate.ptr is non-NULL (meaning we're within
+ * glamor_prepare_access), determies whether we should re-upload
+ * that data on glamor_finish_access().
+ */
+ glamor_access_t map_access;
unsigned char is_picture:1;
unsigned char gl_tex:1;
glamor_pixmap_fbo *fbo;
@@ -406,6 +424,9 @@ typedef struct glamor_pixmap_private_base {
int drm_stride;
glamor_screen_private *glamor_priv;
PicturePtr picture;
+#if GLAMOR_HAS_GBM
+ EGLImageKHR image;
+#endif
} glamor_pixmap_private_base_t;
/*
@@ -558,7 +579,7 @@ void glamor_copy_window(WindowPtr win, DDXPointRec old_origin,
/* glamor_core.c */
Bool glamor_prepare_access(DrawablePtr drawable, glamor_access_t access);
-void glamor_finish_access(DrawablePtr drawable, glamor_access_t access);
+void glamor_finish_access(DrawablePtr drawable);
Bool glamor_prepare_access_window(WindowPtr window);
void glamor_finish_access_window(WindowPtr window);
Bool glamor_prepare_access_gc(GCPtr gc);
@@ -574,7 +595,8 @@ Bool glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple,
unsigned long fg_pixel, unsigned long bg_pixel,
int stipple_x, int stipple_y);
GLint glamor_compile_glsl_prog(GLenum type, const char *source);
-void glamor_link_glsl_prog(GLint prog);
+void glamor_link_glsl_prog(ScreenPtr screen, GLint prog,
+ const char *format, ...) _X_ATTRIBUTE_PRINTF(3,4);
void glamor_get_color_4f_from_pixel(PixmapPtr pixmap,
unsigned long fg_pixel, GLfloat *color);
@@ -627,6 +649,7 @@ void glamor_get_spans(DrawablePtr drawable,
int nspans, char *dst_start);
/* glamor_glyphs.c */
+Bool glamor_realize_glyph_caches(ScreenPtr screen);
void glamor_glyphs_fini(ScreenPtr screen);
void glamor_glyphs(CARD8 op,
PicturePtr pSrc,
@@ -768,7 +791,7 @@ glamor_put_vbo_space(ScreenPtr screen);
* One copy of current pixmap's texture will be put into
* the pixmap->devPrivate.ptr. Will use pbo to map to
* the pointer if possible.
- * The pixmap must be a gl texture pixmap. gl_fbo and
+ * The pixmap must be a gl texture pixmap. gl_fbo must be GLAMOR_FBO_NORMAL and
* gl_tex must be 1. Used by glamor_prepare_access.
*
*/
@@ -783,9 +806,8 @@ void *glamor_download_sub_pixmap_to_cpu(PixmapPtr pixmap, int x, int y, int w,
* glamor_download_pixmap_to_cpu to its original
* gl texture. Used by glamor_finish_access.
*
- * The pixmap must be
- * in texture originally. In other word, the gl_fbo
- * must be 1.
+ * The pixmap must originally be a texture -- gl_fbo must be
+ * GLAMOR_FBO_NORMAL.
**/
void glamor_restore_pixmap_to_texture(PixmapPtr pixmap);
@@ -884,7 +906,7 @@ void glamor_set_window_pixmap(WindowPtr pWindow, PixmapPtr pPixmap);
Bool glamor_prepare_access_picture(PicturePtr picture, glamor_access_t access);
-void glamor_finish_access_picture(PicturePtr picture, glamor_access_t access);
+void glamor_finish_access_picture(PicturePtr picture);
void glamor_destroy_picture(PicturePtr picture);
diff --git a/xorg-server/glamor/glamor_putimage.c b/xorg-server/glamor/glamor_putimage.c
index 702e89f14..cf7197bfc 100644
--- a/xorg-server/glamor/glamor_putimage.c
+++ b/xorg-server/glamor/glamor_putimage.c
@@ -35,204 +35,7 @@
void
glamor_init_putimage_shaders(ScreenPtr screen)
{
-#if 0
- glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- const char *xybitmap_vs =
- "uniform float x_bias;\n"
- "uniform float x_scale;\n"
- "uniform float y_bias;\n"
- "uniform float y_scale;\n"
- "varying vec2 bitmap_coords;\n"
- "void main()\n"
- "{\n"
- " gl_Position = vec4((gl_Vertex.x + x_bias) * x_scale,\n"
- " (gl_Vertex.y + y_bias) * y_scale,\n"
- " 0,\n"
- " 1);\n"
- " bitmap_coords = gl_MultiTexCoord0.xy;\n"
- "}\n";
- const char *xybitmap_fs =
- "uniform vec4 fg, bg;\n"
- "varying vec2 bitmap_coords;\n"
- "uniform sampler2D bitmap_sampler;\n"
- "void main()\n"
- "{\n"
- " float bitmap_value = texture2D(bitmap_sampler,\n"
- " bitmap_coords).x;\n"
- " gl_FragColor = mix(bg, fg, bitmap_value);\n"
- "}\n";
- GLint fs_prog, vs_prog, prog;
- GLint sampler_uniform_location;
-
- if (!GLEW_ARB_fragment_shader)
- return;
-
- prog = glCreateProgram();
- vs_prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER, xybitmap_vs);
- fs_prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER, xybitmap_fs);
- glAttachShader(prog, vs_prog);
- glAttachShader(prog, fs_prog);
- glamor_link_glsl_prog(prog);
-
- glUseProgram(prog);
- sampler_uniform_location = glGetUniformLocation(prog, "bitmap_sampler");
- glUniform1i(sampler_uniform_location, 0);
-
- glamor_priv->put_image_xybitmap_fg_uniform_location =
- glGetUniformLocation(prog, "fg");
- glamor_priv->put_image_xybitmap_bg_uniform_location =
- glGetUniformLocation(prog, "bg");
- glamor_get_transform_uniform_locations(prog,
- &glamor_priv->
- put_image_xybitmap_transform);
- glamor_priv->put_image_xybitmap_prog = prog;
- glUseProgram(0);
-#endif
-}
-
-/* Do an XYBitmap putimage. The bits are byte-aligned rows of bitmap
- * data (where each row starts at a bit index of left_pad), and the
- * destination gets filled with the gc's fg color where the bitmap is set
- * and the bg color where the bitmap is unset.
- *
- * Implement this by passing the bitmap right through to GL, and sampling
- * it to choose between fg and bg in the fragment shader. The driver may
- * be exploding the bitmap up to be an 8-bit alpha texture, in which
- * case we might be better off just doing the fg/bg choosing in the CPU
- * and just draw the resulting texture to the destination.
- */
-#if 0
-
-static int
-y_flip(PixmapPtr pixmap, int y)
-{
- ScreenPtr screen = pixmap->drawable.pScreen;
- PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
-
- if (pixmap == screen_pixmap)
- return (pixmap->drawable.height - 1) - y;
- else
- return y;
-}
-
-static void
-glamor_put_image_xybitmap(DrawablePtr drawable, GCPtr gc,
- int x, int y, int w, int h, int left_pad,
- int image_format, char *bits)
-{
- ScreenPtr screen = drawable->pScreen;
- PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
- glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
- float fg[4], bg[4];
- GLuint tex;
- unsigned int stride = PixmapBytePad(1, w + left_pad);
- RegionPtr clip;
- BoxPtr box;
- int nbox;
- float dest_coords[8];
-
- const float bitmap_coords[8] = {
- 0.0, 0.0,
- 1.0, 0.0,
- 1.0, 1.0,
- 0.0, 1.0,
- };
- GLfloat xscale, yscale;
- glamor_pixmap_private *pixmap_priv;
-
- pixmap_priv = glamor_get_pixmap_private(pixmap);
-
- pixmap_priv_get_scale(pixmap_priv, &xscale, &yscale);
-
- glamor_set_normalize_vcoords(xscale, yscale,
- x, y,
- x + w, y + h,
- glamor_priv->yInverted, dest_coords);
-
- glamor_fallback("glamor_put_image_xybitmap: disabled\n");
- goto fail;
-
- if (glamor_priv->put_image_xybitmap_prog == 0) {
- ErrorF("no program for xybitmap putimage\n");
- goto fail;
- }
-
- glamor_set_alu(gc->alu);
- if (!glamor_set_planemask(pixmap, gc->planemask))
- goto fail;
-
- glUseProgram(glamor_priv->put_image_xybitmap_prog);
-
- glamor_get_color_4f_from_pixel(pixmap, gc->fgPixel, fg);
- glUniform4fv(glamor_priv->put_image_xybitmap_fg_uniform_location, 1, fg);
- glamor_get_color_4f_from_pixel(pixmap, gc->bgPixel, bg);
- glUniform4fv(glamor_priv->put_image_xybitmap_bg_uniform_location, 1, bg);
-
- glGenTextures(1, &tex);
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, tex);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, stride * 8);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, left_pad);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA,
- w, h, 0, GL_COLOR_INDEX, GL_BITMAP, bits);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
-
- /* Now that we've set up our bitmap texture and the shader, shove
- * the destination rectangle through the cliprects and run the
- * shader on the resulting fragments.
- */
- glVertexPointer(2, GL_FLOAT, 0, dest_coords);
- glEnableClientState(GL_VERTEX_ARRAY);
- glClientActiveTexture(GL_TEXTURE0);
- glTexCoordPointer(2, GL_FLOAT, 0, bitmap_coords);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-
- glEnable(GL_SCISSOR_TEST);
- clip = fbGetCompositeClip(gc);
- for (nbox = REGION_NUM_RECTS(clip), box = REGION_RECTS(clip); nbox--; box++) {
- int x1 = x;
- int y1 = y;
- int x2 = x + w;
- int y2 = y + h;
-
- if (x1 < box->x1)
- x1 = box->x1;
- if (y1 < box->y1)
- y1 = box->y1;
- if (x2 > box->x2)
- x2 = box->x2;
- if (y2 > box->y2)
- y2 = box->y2;
- if (x1 >= x2 || y1 >= y2)
- continue;
-
- glScissor(box->x1, y_flip(pixmap, box->y1),
- box->x2 - box->x1, box->y2 - box->y1);
- glDrawArrays(GL_QUADS, 0, 4);
- }
-
- glDisable(GL_SCISSOR_TEST);
- glamor_set_alu(GXcopy);
- glamor_set_planemask(pixmap, ~0);
- glDeleteTextures(1, &tex);
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- return;
- glamor_set_alu(GXcopy);
- glamor_set_planemask(pixmap, ~0);
- glamor_fallback(": to %p (%c)\n",
- drawable, glamor_get_drawable_location(drawable));
- fail:
- if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
- fbPutImage(drawable, gc, 1, x, y, w, h, left_pad, XYBitmap, bits);
- glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
- }
}
-#endif
void
glamor_fini_putimage_shaders(ScreenPtr screen)
diff --git a/xorg-server/glamor/glamor_render.c b/xorg-server/glamor/glamor_render.c
index 086526d2e..c0ee22c2f 100644
--- a/xorg-server/glamor/glamor_render.c
+++ b/xorg-server/glamor/glamor_render.c
@@ -332,7 +332,7 @@ glamor_create_composite_shader(ScreenPtr screen, struct shader_key *key,
glBindAttribLocation(prog, GLAMOR_VERTEX_SOURCE, "v_texcoord0");
glBindAttribLocation(prog, GLAMOR_VERTEX_MASK, "v_texcoord1");
- glamor_link_glsl_prog(prog);
+ glamor_link_glsl_prog(screen, prog, "composite");
shader->prog = prog;
@@ -961,11 +961,7 @@ glamor_composite_choose_shader(CARD8 op,
* Does it need special handle? */
glamor_fallback("source == dest\n");
}
- if (source_pixmap_priv->base.gl_fbo == 0) {
- /* XXX in Xephyr, we may have gl_fbo equal to 1 but gl_tex
- * equal to zero when the pixmap is screen pixmap. Then we may
- * refer the tex zero directly latter in the composition.
- * It seems that it works fine, but it may have potential problem*/
+ if (source_pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) {
#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
source_status = GLAMOR_UPLOAD_PENDING;
#else
@@ -982,7 +978,7 @@ glamor_composite_choose_shader(CARD8 op,
glamor_fallback("mask == dest\n");
goto fail;
}
- if (mask_pixmap_priv->base.gl_fbo == 0) {
+ if (mask_pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) {
#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
mask_status = GLAMOR_UPLOAD_PENDING;
#else
@@ -1339,7 +1335,6 @@ glamor_composite_with_shader(CARD8 op,
glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
glDisable(GL_BLEND);
DEBUGF("finish rendering.\n");
- glUseProgram(0);
glamor_priv->state = RENDER_STATE;
glamor_priv->render_idle_cnt = 0;
if (saved_source_format)
@@ -1788,22 +1783,17 @@ _glamor_composite(CARD8 op,
if (mask && mask->pDrawable && !mask->transform)
GET_SUB_PICTURE(mask, GLAMOR_ACCESS_RO);
- if (glamor_prepare_access_picture(dest, GLAMOR_ACCESS_RW)) {
- if (source_pixmap == dest_pixmap || glamor_prepare_access_picture
- (source, GLAMOR_ACCESS_RO)) {
- if (!mask || glamor_prepare_access_picture(mask, GLAMOR_ACCESS_RO)) {
- fbComposite(op,
- source, mask, dest,
- x_source, y_source,
- x_mask, y_mask, x_dest, y_dest, width, height);
- if (mask)
- glamor_finish_access_picture(mask, GLAMOR_ACCESS_RO);
- }
- if (source_pixmap != dest_pixmap)
- glamor_finish_access_picture(source, GLAMOR_ACCESS_RO);
- }
- glamor_finish_access_picture(dest, GLAMOR_ACCESS_RW);
- }
+ if (glamor_prepare_access_picture(dest, GLAMOR_ACCESS_RW) &&
+ glamor_prepare_access_picture(source, GLAMOR_ACCESS_RO) &&
+ glamor_prepare_access_picture(mask, GLAMOR_ACCESS_RO)) {
+ fbComposite(op,
+ source, mask, dest,
+ x_source, y_source,
+ x_mask, y_mask, x_dest, y_dest, width, height);
+ }
+ glamor_finish_access_picture(mask);
+ glamor_finish_access_picture(source);
+ glamor_finish_access_picture(dest);
#define PUT_SUB_PICTURE(p, access) do { \
if (sub_ ##p ##_pixmap != NULL) { \
diff --git a/xorg-server/glamor/glamor_setspans.c b/xorg-server/glamor/glamor_setspans.c
index 22fe88ce5..a51e4c5be 100644
--- a/xorg-server/glamor/glamor_setspans.c
+++ b/xorg-server/glamor/glamor_setspans.c
@@ -48,7 +48,11 @@ _glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
goto fail;
}
- /* XXX Shall we set alu here? */
+ if (gc->alu != GXcopy) {
+ glamor_fallback("SetSpans with non-copy ALU.\n");
+ goto fail;
+ }
+
if (!glamor_set_planemask(dest_pixmap, gc->planemask))
goto fail;
@@ -86,10 +90,12 @@ _glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
glamor_fallback("to %p (%c)\n",
drawable, glamor_get_drawable_location(drawable));
- if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
+ if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) &&
+ glamor_prepare_access_gc(gc)) {
fbSetSpans(drawable, gc, src, points, widths, numPoints, sorted);
- glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
}
+ glamor_finish_access_gc(gc);
+ glamor_finish_access(drawable);
ret = TRUE;
done:
diff --git a/xorg-server/glamor/glamor_tile.c b/xorg-server/glamor/glamor_tile.c
index 7288af30e..9e115cad1 100644
--- a/xorg-server/glamor/glamor_tile.c
+++ b/xorg-server/glamor/glamor_tile.c
@@ -73,7 +73,7 @@ glamor_init_tile_shader(ScreenPtr screen)
GLAMOR_VERTEX_POS, "v_position");
glBindAttribLocation(glamor_priv->tile_prog,
GLAMOR_VERTEX_SOURCE, "v_texcoord0");
- glamor_link_glsl_prog(glamor_priv->tile_prog);
+ glamor_link_glsl_prog(screen, glamor_priv->tile_prog, "tile");
sampler_uniform_location =
glGetUniformLocation(glamor_priv->tile_prog, "sampler");
@@ -82,7 +82,6 @@ glamor_init_tile_shader(ScreenPtr screen)
glamor_priv->tile_wh =
glGetUniformLocation(glamor_priv->tile_prog, "wh");
- glUseProgram(0);
glamor_put_context(glamor_priv);
}
@@ -156,7 +155,6 @@ _glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
- glUseProgram(0);
glamor_put_context(glamor_priv);
glamor_priv->state = RENDER_STATE;
diff --git a/xorg-server/glamor/glamor_trapezoid.c b/xorg-server/glamor/glamor_trapezoid.c
index 0064f2a24..969ab68bc 100644
--- a/xorg-server/glamor/glamor_trapezoid.c
+++ b/xorg-server/glamor/glamor_trapezoid.c
@@ -982,7 +982,6 @@ _glamor_trapezoids_with_shader(CARD8 op,
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
glDisableVertexAttribArray(GLAMOR_VERTEX_MASK);
glDisable(GL_BLEND);
- glUseProgram(0);
glamor_put_context(glamor_priv);
TRAPEZOID_OUT:
@@ -1357,9 +1356,7 @@ glamor_init_trapezoid_shader(ScreenPtr screen)
glBindAttribLocation(glamor_priv->trapezoid_prog,
GLAMOR_VERTEX_RIGHT_PARAM, "v_right_param");
- glamor_link_glsl_prog(glamor_priv->trapezoid_prog);
-
- glUseProgram(0);
+ glamor_link_glsl_prog(screen, glamor_priv->trapezoid_prog, "trapezoid");
glamor_put_context(glamor_priv);
}
@@ -1573,7 +1570,6 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture,
glDisableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM);
glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM);
glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM);
- glUseProgram(0);
glamor_put_context(glamor_priv);
return TRUE;
}
diff --git a/xorg-server/glamor/glamor_triangles.c b/xorg-server/glamor/glamor_triangles.c
index 693eef10f..b89cb2de7 100644
--- a/xorg-server/glamor/glamor_triangles.c
+++ b/xorg-server/glamor/glamor_triangles.c
@@ -41,16 +41,13 @@ _glamor_triangles(CARD8 op,
|| glamor_ddx_fallback_check_pixmap(pSrc->pDrawable)))
return FALSE;
- if (glamor_prepare_access_picture(pDst, GLAMOR_ACCESS_RW)) {
- if (glamor_prepare_access_picture(pSrc, GLAMOR_ACCESS_RO)) {
-
- fbTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntris, tris);
-
- glamor_finish_access_picture(pSrc, GLAMOR_ACCESS_RO);
- }
-
- glamor_finish_access_picture(pDst, GLAMOR_ACCESS_RW);
+ if (glamor_prepare_access_picture(pDst, GLAMOR_ACCESS_RW) &&
+ glamor_prepare_access_picture(pSrc, GLAMOR_ACCESS_RO)) {
+ fbTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntris, tris);
}
+ glamor_finish_access_picture(pSrc);
+ glamor_finish_access_picture(pDst);
+
return TRUE;
}
diff --git a/xorg-server/glamor/glamor_utils.h b/xorg-server/glamor/glamor_utils.h
index f9550b73c..53b7d9bec 100644
--- a/xorg-server/glamor/glamor_utils.h
+++ b/xorg-server/glamor/glamor_utils.h
@@ -1177,7 +1177,7 @@ glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int h)
default:
ErrorF("dump depth %d, not implemented.\n", pixmap->drawable.depth);
}
- glamor_finish_access(&pixmap->drawable, GLAMOR_ACCESS_RO);
+ glamor_finish_access(&pixmap->drawable);
}
static inline void
@@ -1318,13 +1318,12 @@ glamor_compare_pixmaps(PixmapPtr pixmap1, PixmapPtr pixmap2,
{
assert(pixmap1->drawable.depth == pixmap2->drawable.depth);
- glamor_prepare_access(&pixmap1->drawable, GLAMOR_ACCESS_RO);
- glamor_prepare_access(&pixmap2->drawable, GLAMOR_ACCESS_RO);
-
- _glamor_compare_pixmaps(pixmap1, pixmap2, x, y, w, h, -1, all, diffs);
-
- glamor_finish_access(&pixmap1->drawable, GLAMOR_ACCESS_RO);
- glamor_finish_access(&pixmap2->drawable, GLAMOR_ACCESS_RO);
+ if (glamor_prepare_access(&pixmap1->drawable, GLAMOR_ACCESS_RO) &&
+ glamor_prepare_access(&pixmap2->drawable, GLAMOR_ACCESS_RO)) {
+ _glamor_compare_pixmaps(pixmap1, pixmap2, x, y, w, h, -1, all, diffs);
+ }
+ glamor_finish_access(&pixmap1->drawable);
+ glamor_finish_access(&pixmap2->drawable);
}
/* This function is used to compare two pictures.
@@ -1432,9 +1431,6 @@ glamor_compare_pictures(ScreenPtr screen,
return;
}
- glamor_prepare_access(&fst_pixmap->drawable, GLAMOR_ACCESS_RO);
- glamor_prepare_access(&snd_pixmap->drawable, GLAMOR_ACCESS_RO);
-
if ((fst_type == SourcePictTypeLinear) ||
(fst_type == SourcePictTypeRadial) ||
(fst_type == SourcePictTypeConical) ||
@@ -1444,12 +1440,15 @@ glamor_compare_pictures(ScreenPtr screen,
x_source = y_source = 0;
}
- _glamor_compare_pixmaps(fst_pixmap, snd_pixmap,
- x_source, y_source,
- width, height, fst_picture->format, all, diffs);
-
- glamor_finish_access(&fst_pixmap->drawable, GLAMOR_ACCESS_RO);
- glamor_finish_access(&snd_pixmap->drawable, GLAMOR_ACCESS_RO);
+ if (glamor_prepare_access(&fst_pixmap->drawable, GLAMOR_ACCESS_RO) &&
+ glamor_prepare_access(&snd_pixmap->drawable, GLAMOR_ACCESS_RO)) {
+ _glamor_compare_pixmaps(fst_pixmap, snd_pixmap,
+ x_source, y_source,
+ width, height, fst_picture->format,
+ all, diffs);
+ }
+ glamor_finish_access(&fst_pixmap->drawable);
+ glamor_finish_access(&snd_pixmap->drawable);
if (fst_generated)
glamor_destroy_picture(fst_picture);
diff --git a/xorg-server/glamor/glamor_xv.c b/xorg-server/glamor/glamor_xv.c
index fb9045747..17745a4e8 100644
--- a/xorg-server/glamor/glamor_xv.c
+++ b/xorg-server/glamor/glamor_xv.c
@@ -109,7 +109,7 @@ glamor_init_xv_shader(ScreenPtr screen)
GLAMOR_VERTEX_POS, "v_position");
glBindAttribLocation(glamor_priv->xv_prog,
GLAMOR_VERTEX_SOURCE, "v_texcoord0");
- glamor_link_glsl_prog(glamor_priv->xv_prog);
+ glamor_link_glsl_prog(screen, glamor_priv->xv_prog, "xv");
glamor_put_context(glamor_priv);
}
@@ -416,7 +416,6 @@ glamor_display_textured_video(glamor_port_private *port_priv)
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
- glUseProgram(0);
glamor_put_context(glamor_priv);
DamageDamageRegion(port_priv->pDraw, &port_priv->clip);
}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c b/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c
index d56907fe7..9903cc772 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c
@@ -67,6 +67,9 @@ struct ephyr_glamor {
GLuint texture_shader;
GLuint texture_shader_position_loc;
GLuint texture_shader_texcoord_loc;
+
+ /* Size of the window that we're rendering to. */
+ unsigned width, height;
};
static GLint
@@ -205,6 +208,7 @@ ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glUseProgram(glamor->texture_shader);
+ glViewport(0, 0, glamor->width, glamor->height);
glVertexAttribPointer(glamor->texture_shader_position_loc,
2, GL_FLOAT, FALSE, 0, position);
@@ -309,6 +313,7 @@ ephyr_glamor_get_visual(void)
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER, 1,
+ GLX_VISUAL_ID, DefaultVisual(dpy, DefaultScreen(dpy)),
None
};
int event_base = 0, error_base = 0, nelements;
@@ -329,3 +334,14 @@ ephyr_glamor_get_visual(void)
return xcb_aux_find_visual_by_id(xscreen, visual_info->visualid);
}
+
+void
+ephyr_glamor_set_window_size(struct ephyr_glamor *glamor,
+ unsigned width, unsigned height)
+{
+ if (!glamor)
+ return;
+
+ glamor->width = width;
+ glamor->height = height;
+}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.h b/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.h
index 8995e1eca..0c238cf5b 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.h
+++ b/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.h
@@ -51,6 +51,10 @@ ephyr_glamor_glx_screen_fini(struct ephyr_glamor *glamor);
#ifdef GLAMOR
void
+ephyr_glamor_set_window_size(struct ephyr_glamor *glamor,
+ unsigned width, unsigned height);
+
+void
ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
struct pixman_region16 *damage);
@@ -60,6 +64,12 @@ ephyr_glamor_process_event(xcb_generic_event_t *xev);
#else /* !GLAMOR */
static inline void
+ephyr_glamor_set_window_size(struct ephyr_glamor *glamor,
+ unsigned width, unsigned height)
+{
+}
+
+static inline void
ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
struct pixman_region16 *damage)
{
diff --git a/xorg-server/hw/kdrive/ephyr/hostx.c b/xorg-server/hw/kdrive/ephyr/hostx.c
index 1c3b57477..01ea6c756 100755
--- a/xorg-server/hw/kdrive/ephyr/hostx.c
+++ b/xorg-server/hw/kdrive/ephyr/hostx.c
@@ -749,6 +749,8 @@ __asm int 3;
if (ephyr_glamor) {
*bytes_per_line = 0;
*bits_per_pixel = 0;
+ ephyr_glamor_set_window_size(scrpriv->glamor,
+ scrpriv->win_width, scrpriv->win_height);
return NULL;
} else if (host_depth_matches_server(scrpriv)) {
*bytes_per_line = scrpriv->ximg->stride;
@@ -1244,6 +1246,8 @@ ephyr_glamor_init(ScreenPtr screen)
EphyrScrPriv *scrpriv = kd_screen->driver;
scrpriv->glamor = ephyr_glamor_glx_screen_init(scrpriv->win);
+ ephyr_glamor_set_window_size(scrpriv->glamor,
+ scrpriv->win_width, scrpriv->win_height);
glamor_init(screen,
GLAMOR_USE_SCREEN |
@@ -1265,9 +1269,6 @@ ephyr_glamor_create_screen_resources(ScreenPtr pScreen)
if (!ephyr_glamor)
return TRUE;
- if (!glamor_glyphs_init(pScreen))
- return FALSE;
-
/* kdrive's fbSetupScreen() told mi to have
* miCreateScreenResources() (which is called before this) make a
* scratch pixmap wrapping ephyr-glamor's NULL
diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h
index bd947dab3..5b37ad8d8 100644
--- a/xorg-server/include/input.h
+++ b/xorg-server/include/input.h
@@ -385,6 +385,12 @@ extern _X_EXPORT Bool InitKeyboardDeviceStruct(DeviceIntPtr /*device */ ,
KbdCtrlProcPtr /*controlProc */
);
+extern _X_EXPORT Bool InitKeyboardDeviceStructFromString(DeviceIntPtr dev,
+ const char *keymap,
+ int keymap_length,
+ BellProcPtr bell_func,
+ KbdCtrlProcPtr ctrl_func);
+
extern int ApplyPointerMapping(DeviceIntPtr /* pDev */ ,
CARD8 * /* map */ ,
int /* len */ ,
diff --git a/xorg-server/include/xkbsrv.h b/xorg-server/include/xkbsrv.h
index 20d3a9a17..ae43889e7 100644
--- a/xorg-server/include/xkbsrv.h
+++ b/xorg-server/include/xkbsrv.h
@@ -824,8 +824,8 @@ extern _X_EXPORT void XkbSendNewKeyboardNotify(DeviceIntPtr /* kbd */ ,
extern Bool XkbCopyKeymap(XkbDescPtr /* dst */ ,
XkbDescPtr /* src */ );
-extern _X_EXPORT Bool XkbCopyDeviceKeymap(DeviceIntPtr /* dst */ ,
- DeviceIntPtr /* src */ );
+extern _X_EXPORT Bool XkbDeviceApplyKeymap(DeviceIntPtr /* dst */ ,
+ XkbDescPtr /* src */ );
extern void XkbFilterEvents(ClientPtr /* pClient */ ,
int /* nEvents */ ,
@@ -841,6 +841,9 @@ extern void XkbFakeDeviceButton(DeviceIntPtr /* dev */ ,
int /* press */ ,
int /* button */ );
+extern _X_EXPORT void XkbCopyControls(XkbDescPtr /* dst */ ,
+ XkbDescPtr /* src */ );
+
#include "xkbfile.h"
#include "xkbrules.h"
@@ -873,4 +876,8 @@ extern _X_EXPORT XkbDescPtr XkbCompileKeymap(DeviceIntPtr /* dev */ ,
XkbRMLVOSet * /* rmlvo */
);
+extern _X_EXPORT XkbDescPtr XkbCompileKeymapFromString(DeviceIntPtr dev,
+ const char *keymap,
+ int keymap_length);
+
#endif /* _XKBSRV_H_ */
diff --git a/xorg-server/miext/sync/misyncstr.h b/xorg-server/miext/sync/misyncstr.h
index b5bf6fd91..ad69e8eca 100644
--- a/xorg-server/miext/sync/misyncstr.h
+++ b/xorg-server/miext/sync/misyncstr.h
@@ -29,6 +29,7 @@
#define _MISYNCSTR_H_
#include "dix.h"
+#include "misync.h"
#include "scrnintstr.h"
#include <X11/extensions/syncconst.h>
diff --git a/xorg-server/xkb/ddxLoad.c b/xorg-server/xkb/ddxLoad.c
index f458e3bde..1dc0e4eee 100644
--- a/xorg-server/xkb/ddxLoad.c
+++ b/xorg-server/xkb/ddxLoad.c
@@ -68,6 +68,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define PATHSEPARATOR "/"
#endif
+static unsigned
+LoadXKM(unsigned want, unsigned need, const char *keymap, XkbDescPtr *xkbRtrn);
+
static void
OutputDirectory(char *outdir, size_t size)
{
@@ -90,11 +93,17 @@ OutputDirectory(char *outdir, size_t size)
}
}
-static Bool
-XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
- XkbComponentNamesPtr names,
- unsigned want,
- unsigned need, char *nameRtrn, int nameRtrnLen)
+/**
+ * Callback invoked by XkbRunXkbComp. Write to out to talk to xkbcomp.
+ */
+typedef void (*xkbcomp_buffer_callback)(FILE *out, void *userdata);
+
+/**
+ * Start xkbcomp, let the callback write into xkbcomp's stdin. When done,
+ * return a strdup'd copy of the file name we've written to.
+ */
+static char *
+RunXkbComp(xkbcomp_buffer_callback callback, void *userdata)
{
FILE *out;
char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX];
@@ -155,7 +164,7 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
if (!buf) {
LogMessage(X_ERROR,
"XKB: Could not invoke xkbcomp: not enough memory\n");
- return FALSE;
+ return NULL;
}
#ifndef WIN32
@@ -165,13 +174,9 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
#endif
if (out != NULL) {
-#ifdef DEBUG
- if (xkbDebugFlags) {
- ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
- XkbWriteXKBKeymapForNames(stderr, names, xkb, want, need);
- }
-#endif
- XkbWriteXKBKeymapForNames(out, names, xkb, want, need);
+ /* Now write to xkbcomp */
+ (*callback)(out, userdata);
+
#ifndef WIN32
if (Pclose(out) == 0)
#else
@@ -180,14 +185,11 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
{
if (xkbDebugFlags)
DebugF("[xkb] xkb executes: %s\n", buf);
- if (nameRtrn) {
- strlcpy(nameRtrn, keymap, nameRtrnLen);
- }
free(buf);
#ifdef WIN32
unlink(tmpname);
#endif
- return TRUE;
+ return xnfstrdup(keymap);
}
else
LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap);
@@ -203,14 +205,101 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
LogMessage(X_ERROR, "Could not open file %s\n", tmpname);
#endif
}
- if (nameRtrn)
- nameRtrn[0] = '\0';
free(buf);
- return FALSE;
+ return NULL;
+}
+
+typedef struct {
+ XkbDescPtr xkb;
+ XkbComponentNamesPtr names;
+ unsigned int want;
+ unsigned int need;
+} XkbKeymapNamesCtx;
+
+static void
+xkb_write_keymap_for_names_cb(FILE *out, void *userdata)
+{
+ XkbKeymapNamesCtx *ctx = userdata;
+#ifdef DEBUG
+ if (xkbDebugFlags) {
+ ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
+ XkbWriteXKBKeymapForNames(stderr, ctx->names, ctx->xkb, ctx->want, ctx->need);
+ }
+#endif
+ XkbWriteXKBKeymapForNames(out, ctx->names, ctx->xkb, ctx->want, ctx->need);
+}
+
+static Bool
+XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
+ XkbComponentNamesPtr names,
+ unsigned want,
+ unsigned need, char *nameRtrn, int nameRtrnLen)
+{
+ char *keymap;
+ Bool rc = FALSE;
+ XkbKeymapNamesCtx ctx = {
+ .xkb = xkb,
+ .names = names,
+ .want = want,
+ .need = need
+ };
+
+ keymap = RunXkbComp(xkb_write_keymap_for_names_cb, &ctx);
+
+ if (keymap) {
+ if(nameRtrn)
+ strlcpy(nameRtrn, keymap, nameRtrnLen);
+
+ free(keymap);
+ rc = TRUE;
+ } else if (nameRtrn)
+ *nameRtrn = '\0';
+
+ return rc;
+}
+
+typedef struct {
+ const char *keymap;
+ size_t len;
+} XkbKeymapString;
+
+static void
+xkb_write_keymap_string_cb(FILE *out, void *userdata)
+{
+ XkbKeymapString *s = userdata;
+ fwrite(s->keymap, s->len, 1, out);
+}
+
+static unsigned int
+XkbDDXLoadKeymapFromString(DeviceIntPtr keybd,
+ const char *keymap, int keymap_length,
+ unsigned int want,
+ unsigned int need,
+ XkbDescPtr *xkbRtrn)
+{
+ unsigned int have;
+ char *map_name;
+ XkbKeymapString map = {
+ .keymap = keymap,
+ .len = keymap_length
+ };
+
+ *xkbRtrn = NULL;
+
+ map_name = RunXkbComp(xkb_write_keymap_string_cb, &map);
+ if (!map_name) {
+ LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n");
+ return 0;
+ }
+
+ have = LoadXKM(want, need, map_name, xkbRtrn);
+ free(map_name);
+
+ return have;
}
static FILE *
-XkbDDXOpenConfigFile(char *mapName, char *fileNameRtrn, int fileNameRtrnLen)
+XkbDDXOpenConfigFile(const char *mapName, char *fileNameRtrn, int fileNameRtrnLen)
{
char buf[PATH_MAX], xkm_output_dir[PATH_MAX];
FILE *file;
@@ -245,6 +334,35 @@ XkbDDXOpenConfigFile(char *mapName, char *fileNameRtrn, int fileNameRtrnLen)
return file;
}
+static unsigned
+LoadXKM(unsigned want, unsigned need, const char *keymap, XkbDescPtr *xkbRtrn)
+{
+ FILE *file;
+ char fileName[PATH_MAX];
+ unsigned missing;
+
+ file = XkbDDXOpenConfigFile(keymap, fileName, PATH_MAX);
+ if (file == NULL) {
+ LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n",
+ fileName);
+ return 0;
+ }
+ missing = XkmReadFile(file, need, want, xkbRtrn);
+ if (*xkbRtrn == NULL) {
+ LogMessage(X_ERROR, "Error loading keymap %s\n", fileName);
+ fclose(file);
+ (void) unlink(fileName);
+ return 0;
+ }
+ else {
+ DebugF("Loaded XKB keymap %s, defined=0x%x\n", fileName,
+ (*xkbRtrn)->defined);
+ }
+ fclose(file);
+ (void) unlink(fileName);
+ return (need | want) & (~missing);
+}
+
unsigned
XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
XkbComponentNamesPtr names,
@@ -253,9 +371,6 @@ XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
XkbDescPtr *xkbRtrn, char *nameRtrn, int nameRtrnLen)
{
XkbDescPtr xkb;
- FILE *file;
- char fileName[PATH_MAX];
- unsigned missing;
*xkbRtrn = NULL;
if ((keybd == NULL) || (keybd->key == NULL) ||
@@ -275,26 +390,8 @@ XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n");
return 0;
}
- file = XkbDDXOpenConfigFile(nameRtrn, fileName, PATH_MAX);
- if (file == NULL) {
- LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n",
- fileName);
- return 0;
- }
- missing = XkmReadFile(file, need, want, xkbRtrn);
- if (*xkbRtrn == NULL) {
- LogMessage(X_ERROR, "Error loading keymap %s\n", fileName);
- fclose(file);
- (void) unlink(fileName);
- return 0;
- }
- else {
- DebugF("Loaded XKB keymap %s, defined=0x%x\n", fileName,
- (*xkbRtrn)->defined);
- }
- fclose(file);
- (void) unlink(fileName);
- return (need | want) & (~missing);
+
+ return LoadXKM(want, need, nameRtrn, xkbRtrn);
}
Bool
@@ -390,6 +487,29 @@ XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, int need)
return xkb;
}
+static XkbDescPtr
+KeymapOrDefaults(DeviceIntPtr dev, XkbDescPtr xkb)
+{
+ XkbRMLVOSet dflts;
+
+ if (xkb)
+ return xkb;
+
+ /* we didn't get what we really needed. And that will likely leave
+ * us with a keyboard that doesn't work. Use the defaults instead */
+ LogMessage(X_ERROR, "XKB: Failed to load keymap. Loading default "
+ "keymap instead.\n");
+
+ XkbGetRulesDflts(&dflts);
+
+ xkb = XkbCompileKeymapForDevice(dev, &dflts, 0);
+
+ XkbFreeRMLVOSet(&dflts, FALSE);
+
+ return xkb;
+}
+
+
XkbDescPtr
XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet * rmlvo)
{
@@ -407,20 +527,34 @@ XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet * rmlvo)
xkb = XkbCompileKeymapForDevice(dev, rmlvo, need);
- if (!xkb) {
- XkbRMLVOSet dflts;
-
- /* we didn't get what we really needed. And that will likely leave
- * us with a keyboard that doesn't work. Use the defaults instead */
- LogMessage(X_ERROR, "XKB: Failed to load keymap. Loading default "
- "keymap instead.\n");
+ return KeymapOrDefaults(dev, xkb);
+}
- XkbGetRulesDflts(&dflts);
+XkbDescPtr
+XkbCompileKeymapFromString(DeviceIntPtr dev,
+ const char *keymap, int keymap_length)
+{
+ XkbDescPtr xkb;
+ unsigned int need, provided;
- xkb = XkbCompileKeymapForDevice(dev, &dflts, 0);
+ if (!dev || !keymap) {
+ LogMessage(X_ERROR, "XKB: No device or keymap specified\n");
+ return NULL;
+ }
- XkbFreeRMLVOSet(&dflts, FALSE);
+ /* These are the components we really really need */
+ need = XkmSymbolsMask | XkmCompatMapMask | XkmTypesMask |
+ XkmKeyNamesMask | XkmVirtualModsMask;
+
+ provided =
+ XkbDDXLoadKeymapFromString(dev, keymap, keymap_length,
+ XkmAllIndicesMask, need, &xkb);
+ if ((need & provided) != need) {
+ if (xkb) {
+ XkbFreeKeyboard(xkb, 0, TRUE);
+ xkb = NULL;
+ }
}
- return xkb;
+ return KeymapOrDefaults(dev, xkb);
}
diff --git a/xorg-server/xkb/xkb.c b/xorg-server/xkb/xkb.c
index 5d74aab7f..ae2ca90a3 100644
--- a/xorg-server/xkb/xkb.c
+++ b/xorg-server/xkb/xkb.c
@@ -5947,25 +5947,13 @@ ProcXkbGetKbdByName(ClientPtr client)
if (rep.loaded) {
XkbDescPtr old_xkb;
xkbNewKeyboardNotify nkn;
- int i, nG, nTG;
old_xkb = xkb;
xkb = new;
dev->key->xkbInfo->desc = xkb;
new = old_xkb; /* so it'll get freed automatically */
- *xkb->ctrls = *old_xkb->ctrls;
- for (nG = nTG = 0, i = xkb->min_key_code; i <= xkb->max_key_code; i++) {
- nG = XkbKeyNumGroups(xkb, i);
- if (nG >= XkbNumKbdGroups) {
- nTG = XkbNumKbdGroups;
- break;
- }
- if (nG > nTG) {
- nTG = nG;
- }
- }
- xkb->ctrls->num_groups = nTG;
+ XkbCopyControls(xkb, old_xkb);
nkn.deviceID = nkn.oldDeviceID = dev->id;
nkn.minKeyCode = new->min_key_code;
@@ -5988,7 +5976,7 @@ ProcXkbGetKbdByName(ClientPtr client)
continue;
if (tmpd != dev)
- XkbCopyDeviceKeymap(tmpd, dev);
+ XkbDeviceApplyKeymap(tmpd, xkb);
if (tmpd->kbdfeed && tmpd->kbdfeed->xkb_sli) {
old_sli = tmpd->kbdfeed->xkb_sli;
diff --git a/xorg-server/xkb/xkbInit.c b/xorg-server/xkb/xkbInit.c
index acabd8e7b..c221bde45 100644
--- a/xorg-server/xkb/xkbInit.c
+++ b/xorg-server/xkb/xkbInit.c
@@ -505,9 +505,10 @@ XkbInitControls(DeviceIntPtr pXDev, XkbSrvInfoPtr xkbi)
return Success;
}
-_X_EXPORT Bool
-InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
- BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func)
+static Bool
+InitKeyboardDeviceStructInternal(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
+ const char *keymap, int keymap_length,
+ BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func)
{
int i;
unsigned int check;
@@ -521,8 +522,9 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
BUG_RETURN_VAL(dev == NULL, FALSE);
BUG_RETURN_VAL(dev->key != NULL, FALSE);
BUG_RETURN_VAL(dev->kbdfeed != NULL, FALSE);
+ BUG_RETURN_VAL(rmlvo && keymap, FALSE);
- if (!rmlvo) {
+ if (!rmlvo && !keymap) {
rmlvo = &rmlvo_dflts;
XkbGetRulesDflts(rmlvo);
}
@@ -550,7 +552,7 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
}
dev->key->xkbInfo = xkbi;
- if (xkb_cached_map && !XkbCompareUsedRMLVO(rmlvo)) {
+ if (xkb_cached_map && (keymap || (rmlvo && !XkbCompareUsedRMLVO(rmlvo)))) {
XkbFreeKeyboard(xkb_cached_map, XkbAllComponentsMask, TRUE);
xkb_cached_map = NULL;
}
@@ -558,7 +560,11 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
if (xkb_cached_map)
LogMessageVerb(X_INFO, 4, "XKB: Reusing cached keymap\n");
else {
- xkb_cached_map = XkbCompileKeymap(dev, rmlvo);
+ if (rmlvo)
+ xkb_cached_map = XkbCompileKeymap(dev, rmlvo);
+ else
+ xkb_cached_map = XkbCompileKeymapFromString(dev, keymap, keymap_length);
+
if (!xkb_cached_map) {
ErrorF("XKB: Failed to compile keymap\n");
goto unwind_info;
@@ -627,8 +633,10 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
dev->kbdfeed->CtrlProc(dev, &dev->kbdfeed->ctrl);
- XkbSetRulesDflts(rmlvo);
- XkbSetRulesUsed(rmlvo);
+ if (rmlvo) {
+ XkbSetRulesDflts(rmlvo);
+ XkbSetRulesUsed(rmlvo);
+ }
XkbFreeRMLVOSet(&rmlvo_dflts, FALSE);
return TRUE;
@@ -647,6 +655,24 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
return FALSE;
}
+_X_EXPORT Bool
+InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
+ BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func)
+{
+ return InitKeyboardDeviceStructInternal(dev, rmlvo,
+ NULL, 0, bell_func, ctrl_func);
+}
+
+_X_EXPORT Bool
+InitKeyboardDeviceStructFromString(DeviceIntPtr dev,
+ const char *keymap, int keymap_length,
+ BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func)
+{
+ return InitKeyboardDeviceStructInternal(dev, NULL,
+ keymap, keymap_length,
+ bell_func, ctrl_func);
+}
+
/***====================================================================***/
/*
diff --git a/xorg-server/xkb/xkbUtils.c b/xorg-server/xkb/xkbUtils.c
index 6c6af60f0..6cf6e79df 100644
--- a/xorg-server/xkb/xkbUtils.c
+++ b/xorg-server/xkb/xkbUtils.c
@@ -1999,28 +1999,28 @@ XkbCopyKeymap(XkbDescPtr dst, XkbDescPtr src)
}
Bool
-XkbCopyDeviceKeymap(DeviceIntPtr dst, DeviceIntPtr src)
+XkbDeviceApplyKeymap(DeviceIntPtr dst, XkbDescPtr desc)
{
xkbNewKeyboardNotify nkn;
Bool ret;
- if (!dst->key || !src->key)
+ if (!dst->key || !desc)
return FALSE;
memset(&nkn, 0, sizeof(xkbNewKeyboardNotify));
nkn.oldMinKeyCode = dst->key->xkbInfo->desc->min_key_code;
nkn.oldMaxKeyCode = dst->key->xkbInfo->desc->max_key_code;
nkn.deviceID = dst->id;
- nkn.oldDeviceID = dst->id; /* maybe src->id? */
- nkn.minKeyCode = src->key->xkbInfo->desc->min_key_code;
- nkn.maxKeyCode = src->key->xkbInfo->desc->max_key_code;
+ nkn.oldDeviceID = dst->id;
+ nkn.minKeyCode = desc->min_key_code;
+ nkn.maxKeyCode = desc->max_key_code;
nkn.requestMajor = XkbReqCode;
nkn.requestMinor = X_kbSetMap; /* Near enough's good enough. */
nkn.changed = XkbNKN_KeycodesMask;
- if (src->key->xkbInfo->desc->geom)
+ if (desc->geom)
nkn.changed |= XkbNKN_GeometryMask;
- ret = XkbCopyKeymap(dst->key->xkbInfo->desc, src->key->xkbInfo->desc);
+ ret = XkbCopyKeymap(dst->key->xkbInfo->desc, desc);
if (ret)
XkbSendNewKeyboardNotify(dst, &nkn);
@@ -2090,3 +2090,26 @@ XkbMergeLockedPtrBtns(DeviceIntPtr master)
xkbi->lockedPtrButtons |= d->key->xkbInfo->lockedPtrButtons;
}
}
+
+void
+XkbCopyControls(XkbDescPtr dst, XkbDescPtr src)
+{
+ int i, nG, nTG;
+
+ if (!dst || !src)
+ return;
+
+ *dst->ctrls = *src->ctrls;
+
+ for (nG = nTG = 0, i = dst->min_key_code; i <= dst->max_key_code; i++) {
+ nG = XkbKeyNumGroups(dst, i);
+ if (nG >= XkbNumKbdGroups) {
+ nTG = XkbNumKbdGroups;
+ break;
+ }
+ if (nG > nTG) {
+ nTG = nG;
+ }
+ }
+ dst->ctrls->num_groups = nTG;
+}