diff options
author | marha <marha@users.sourceforge.net> | 2013-03-04 08:18:40 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-03-04 08:18:40 +0100 |
commit | d4d629b77742e60caac3d120ff40e9f386380af2 (patch) | |
tree | ed3eacb0fdcf29da0a24e03c4330ce8e3bb66718 | |
parent | c74ef795c7282681616decc36a9a81cd1b1b6ec7 (diff) | |
download | vcxsrv-d4d629b77742e60caac3d120ff40e9f386380af2.tar.gz vcxsrv-d4d629b77742e60caac3d120ff40e9f386380af2.tar.bz2 vcxsrv-d4d629b77742e60caac3d120ff40e9f386380af2.zip |
fontconfig libX11 mesalib pixman xserver xkeyboard-config git update 4 Mar 2013
xserver commit 8f4640bdb9d3988148e09a08d2c7e3bab1d538d6
xkeyboard-config commit fa2f330df22511c3846cb1cb0760551c6e244a81
libX11 commit c23d61d1b84dca3740bf4786978c7908d0065fb9
pixman commit 5feda20fc39407879993ed4a6d861ef7f78d9432
fontconfig commit 612ee2a5c91b8929b2cc5abce4af84d8d7e66bd0
mesa commit e29124717eae4f8d329bb6a9707b802c0ff4bdd9
98 files changed, 1857 insertions, 1002 deletions
diff --git a/fontconfig/conf.d/30-metric-aliases.conf b/fontconfig/conf.d/30-metric-aliases.conf index ccc3e246d..f25052a29 100644 --- a/fontconfig/conf.d/30-metric-aliases.conf +++ b/fontconfig/conf.d/30-metric-aliases.conf @@ -15,10 +15,12 @@ Microsoft fonts: Arial + Arial Narrow Times New Roman Courier New Liberation fonts: Liberation Sans + Liberation Sans Narrow Liberation Serif Liberation Mono StarOffice fonts: @@ -93,6 +95,13 @@ </alias> <alias binding="same"> + <family>Liberation Sans Narrow</family> + <default> + <family>Arial Narrow</family> + </default> + </alias> + + <alias binding="same"> <family>Albany</family> <default> <family>Arial</family> @@ -252,6 +261,13 @@ </alias> <alias binding="same"> + <family>Arial Narrow</family> + <accept> + <family>Liberation Sans Narrow</family> + </accept> + </alias> + + <alias binding="same"> <family>Times New Roman</family> <accept> <family>Tinos</family> diff --git a/fontconfig/src/fcmatch.c b/fontconfig/src/fcmatch.c index fa8800a04..23f985a6c 100644 --- a/fontconfig/src/fcmatch.c +++ b/fontconfig/src/fcmatch.c @@ -269,7 +269,8 @@ FcObjectToMatcher (FcObject object, break; } } - if (!_FcMatchers[object].compare || + if (object > FC_MAX_BASE_OBJECT || + !_FcMatchers[object].compare || _FcMatchers[object].strong == -1 || _FcMatchers[object].weak == -1) return NULL; @@ -910,6 +911,13 @@ FcFontSetSort (FcConfig *config FC_UNUSED, } patternLangSat[i] = FcTrue; satisfies = FcTrue; + /* adjust score to ensure it's not more than 10000.0 + * which would means the lang didn't satisfy the requirements + */ + if (nodeps[f]->score[PRI_LANG_STRONG] > 10000.0) + nodeps[f]->score[PRI_LANG_STRONG] = 10000.0; + if (nodeps[f]->score[PRI_LANG_WEAK] > 10000.0) + nodeps[f]->score[PRI_LANG_WEAK] = 10000.0; break; } } diff --git a/libX11/include/X11/Xlib.h b/libX11/include/X11/Xlib.h index 961808167..65f253cd4 100644 --- a/libX11/include/X11/Xlib.h +++ b/libX11/include/X11/Xlib.h @@ -128,11 +128,7 @@ typedef char *XPointer; #define BitmapBitOrder(dpy) (((_XPrivDisplay)dpy)->bitmap_bit_order) #define BitmapPad(dpy) (((_XPrivDisplay)dpy)->bitmap_pad) #define ImageByteOrder(dpy) (((_XPrivDisplay)dpy)->byte_order) -#ifdef CRAY /* unable to get WORD64 without pulling in other symbols */ -#define NextRequest(dpy) XNextRequest(dpy) -#else #define NextRequest(dpy) (((_XPrivDisplay)dpy)->request + 1) -#endif #define LastKnownRequestProcessed(dpy) (((_XPrivDisplay)dpy)->last_request_read) /* macros for screen oriented applications (toolkit) */ diff --git a/libX11/include/X11/Xlibint.h b/libX11/include/X11/Xlibint.h index c2232de60..40965c449 100644 --- a/libX11/include/X11/Xlibint.h +++ b/libX11/include/X11/Xlibint.h @@ -209,13 +209,6 @@ struct _XDisplay #define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n) -/* - * define the following if you want the Data macro to be a procedure instead - */ -#ifdef CRAY -#define DataRoutineIsProcedure -#endif /* CRAY */ - #ifndef _XEVENT_ /* * _QEvent datatype for use in input queueing. @@ -408,25 +401,8 @@ extern LockInfoPtr _Xglobal_lock; * X Protocol packetizing macros. */ -/* Need to start requests on 64 bit word boundaries - * on a CRAY computer so add a NoOp (127) if needed. - * A character pointer on a CRAY computer will be non-zero - * after shifting right 61 bits of it is not pointing to - * a word boundary. - */ -#ifdef WORD64 -#define WORD64ALIGN if ((long)dpy->bufptr >> 61) {\ - dpy->last_req = dpy->bufptr;\ - *(dpy->bufptr) = X_NoOperation;\ - *(dpy->bufptr+1) = 0;\ - *(dpy->bufptr+2) = 0;\ - *(dpy->bufptr+3) = 1;\ - dpy->request++;\ - dpy->bufptr += 4;\ - } -#else /* else does not require alignment on 64-bit boundaries */ +/* Leftover from CRAY support - was defined empty on all non-Cray systems */ #define WORD64ALIGN -#endif /* WORD64 */ /** * Return a len-sized request buffer for the request type. This function may @@ -510,18 +486,6 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); req = (xReq *) _XGetRequest(dpy, X_/**/name, SIZEOF(xReq)) #endif -#ifdef WORD64 -#define MakeBigReq(req,n) \ - { \ - char _BRdat[4]; \ - unsigned long _BRlen = req->length - 1; \ - req->length = 0; \ - memcpy(_BRdat, ((char *)req) + (_BRlen << 2), 4); \ - memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \ - memcpy(((char *)req) + 4, _BRdat, 4); \ - Data32(dpy, (long *)&_BRdat, 4); \ - } -#else #ifdef LONG64 #define MakeBigReq(req,n) \ { \ @@ -545,7 +509,6 @@ extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); Data32(dpy, &_BRdat, 4); \ } #endif -#endif #ifndef __clang_analyzer__ #define SetReqLen(req,n,badlen) \ @@ -609,10 +572,6 @@ extern void _XFlushGCCache(Display *dpy, GC gc); memset(ptr, '\0', n); \ dpy->bufptr += (n); -#ifdef WORD64 -#define Data16(dpy, data, len) _XData16(dpy, (_Xconst short *)data, len) -#define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)data, len) -#else #define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) #define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) #define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len)) @@ -632,7 +591,6 @@ extern void _XRead32( #define Data32(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) #define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) #endif -#endif /* not WORD64 */ #define PackData16(dpy,data,len) Data16 (dpy, data, len) #define PackData32(dpy,data,len) Data32 (dpy, data, len) @@ -701,19 +659,10 @@ extern void _XRead32( } -#ifdef MUSTCOPY - -/* for when 32-bit alignment is not good enough */ -#define OneDataCard32(dpy,dstaddr,srcvar) \ - { dpy->bufptr -= 4; Data32 (dpy, (char *) &(srcvar), 4); } - -#else - /* srcvar must be a variable for large architecture version */ #define OneDataCard32(dpy,dstaddr,srcvar) \ { *(CARD32 *)(dstaddr) = (srcvar); } -#endif /* MUSTCOPY */ typedef struct _XInternalAsync { struct _XInternalAsync *next; diff --git a/libX11/modules/om/generic/omXChar.c b/libX11/modules/om/generic/omXChar.c index ff517d5e5..c9bbb8e88 100644 --- a/libX11/modules/om/generic/omXChar.c +++ b/libX11/modules/om/generic/omXChar.c @@ -262,47 +262,6 @@ _XomGetFontSetFromCharSet( return (FontSet) NULL; } -#ifdef MUSTCOPY -static void -cs_to_xchar2b( - register char *from, - register XChar2b *to, - register length) -{ - while (length-- > 0) { - to->byte1 = *from++; - to->byte2 = *from++; - to++; - } -} - -static void -cs_to_xchar2b_gl( - register char *from, - register XChar2b *to, - register length) -{ - while (length-- > 0) { - to->byte1 = *from++ & 0x7f; - to->byte2 = *from++ & 0x7f; - to++; - } -} - -static void -cs_to_xchar2b_gr( - register char *from, - register XChar2b *to, - register length) -{ - while (length-- > 0) { - to->byte1 = *from++ | 0x80; - to->byte2 = *from++ | 0x80; - to++; - } -} -#endif - static void shift_to_gl( register char *text, @@ -358,10 +317,6 @@ _XomConvert( XlcCharSet charset; int length, cs_left, ret; FontSet font_set; -#ifdef MUSTCOPY - XChar2b *xchar2b; - char *buf, buf_local[BUFSIZ]; -#endif cs = *to; cs_left = *to_left; @@ -380,46 +335,18 @@ _XomConvert( length = *to_left - cs_left; -#ifdef MUSTCOPY - if (font_set->is_xchar2b) { - buf = (length > BUFSIZ) ? Xmalloc(length) : buf_local; - if (buf == NULL) - return -1; - memcpy(buf, (char *) *to, length); - - xchar2b = (XChar2b *) *to; - length >>= 1; - - if (font_set->side == charset->side) - cs_to_xchar2b(buf, xchar2b, length); - else if (font_set->side == XlcGL) - cs_to_xchar2b_gl(buf, xchar2b, length); + if (font_set->side != charset->side) { + if (font_set->side == XlcGL) + shift_to_gl(*to, length); else if (font_set->side == XlcGR) - cs_to_xchar2b_gr(buf, xchar2b, length); - else - cs_to_xchar2b(buf, xchar2b, length); - - if (buf != buf_local) - Xfree(buf); - - *to = (XPointer) (xchar2b + length); - *to_left -= length; - } else -#endif - { - if (font_set->side != charset->side) { - if (font_set->side == XlcGL) - shift_to_gl(*to, length); - else if (font_set->side == XlcGR) - shift_to_gr(*to, length); - } - - if (font_set->is_xchar2b) - length >>= 1; - *to = cs; - *to_left -= length; + shift_to_gr(*to, length); } + if (font_set->is_xchar2b) + length >>= 1; + *to = cs; + *to_left -= length; + *((XFontStruct **) args[0]) = font_set->font; *((Bool *) args[1]) = font_set->is_xchar2b; if(num_args >= 3){ diff --git a/libX11/src/ChWindow.c b/libX11/src/ChWindow.c index fbd6e8846..89a81e12a 100644 --- a/libX11/src/ChWindow.c +++ b/libX11/src/ChWindow.c @@ -43,20 +43,11 @@ XResizeWindow( req->window = w; req->mask = CWWidth | CWHeight; -#ifdef MUSTCOPY - { - unsigned long lwidth = width, lheight = height; - dpy->bufptr -= 8; - Data32 (dpy, (long *) &lwidth, 4); /* order dictated by values of */ - Data32 (dpy, (long *) &lheight, 4); /* CWWidth and CWHeight */ - } -#else { CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xConfigureWindowReq); *valuePtr++ = width; *valuePtr = height; } -#endif /* MUSTCOPY */ UnlockDisplay(dpy); SyncHandle(); return 1; diff --git a/libX11/src/ConfWind.c b/libX11/src/ConfWind.c index dd55b4422..eefce4dd5 100644 --- a/libX11/src/ConfWind.c +++ b/libX11/src/ConfWind.c @@ -44,18 +44,6 @@ XMoveResizeWindow( GetReqExtra(ConfigureWindow, 16, req); req->window = w; req->mask = CWX | CWY | CWWidth | CWHeight; -#ifdef MUSTCOPY - { - long lx = x, ly = y; - unsigned long lwidth = width, lheight = height; - - dpy->bufptr -= 16; - Data32 (dpy, (long *) &lx, 4); /* order must match values of */ - Data32 (dpy, (long *) &ly, 4); /* CWX, CWY, CWWidth, and CWHeight */ - Data32 (dpy, (long *) &lwidth, 4); - Data32 (dpy, (long *) &lheight, 4); - } -#else { register CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xConfigureWindowReq); @@ -64,7 +52,6 @@ XMoveResizeWindow( *valuePtr++ = width; *valuePtr = height; } -#endif /* MUSTCOPY */ UnlockDisplay(dpy); SyncHandle(); return 1; diff --git a/libX11/src/CrWindow.c b/libX11/src/CrWindow.c index 23f7ddce0..7b5460186 100644 --- a/libX11/src/CrWindow.c +++ b/libX11/src/CrWindow.c @@ -57,20 +57,11 @@ Window XCreateSimpleWindow( wid = req->wid = XAllocID(dpy); req->mask = CWBackPixel | CWBorderPixel; -#ifdef MUSTCOPY - { - unsigned long lbackground = background, lborder = border; - dpy->bufptr -= 8; - Data32 (dpy, (long *) &lbackground, 4); - Data32 (dpy, (long *) &lborder, 4); - } -#else { register CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xCreateWindowReq); *valuePtr++ = background; *valuePtr = border; } -#endif /* MUSTCOPY */ UnlockDisplay(dpy); SyncHandle(); diff --git a/libX11/src/DrArc.c b/libX11/src/DrArc.c index 1dc4a07b2..d72fac9d7 100644 --- a/libX11/src/DrArc.c +++ b/libX11/src/DrArc.c @@ -49,12 +49,6 @@ XDrawArc( { register xPolyArcReq *req; register xArc *arc; -#ifdef MUSTCOPY - xArc arcdata; - long len = SIZEOF(xArc); - - arc = &arcdata; -#endif /* MUSTCOPY */ LockDisplay(dpy); FlushGC(dpy, gc); @@ -63,9 +57,7 @@ XDrawArc( req->drawable = d; req->gc = gc->gid; -#ifndef MUSTCOPY arc = (xArc *) NEXTPTR(req,xPolyArcReq); -#endif /* MUSTCOPY */ arc->x = x; arc->y = y; @@ -74,10 +66,6 @@ XDrawArc( arc->angle1 = angle1; arc->angle2 = angle2; -#ifdef MUSTCOPY - dpy->bufptr -= SIZEOF(xArc); - Data (dpy, (char *) arc, len); -#endif /* MUSTCOPY */ UnlockDisplay(dpy); SyncHandle(); diff --git a/libX11/src/DrLine.c b/libX11/src/DrLine.c index 3786f5933..dc82d5a15 100644 --- a/libX11/src/DrLine.c +++ b/libX11/src/DrLine.c @@ -45,12 +45,6 @@ XDrawLine ( int y2) { register xSegment *segment; -#ifdef MUSTCOPY - xSegment segmentdata; - long len = SIZEOF(xSegment); - - segment = &segmentdata; -#endif /* not MUSTCOPY */ LockDisplay(dpy); FlushGC(dpy, gc); @@ -67,21 +61,15 @@ XDrawLine ( && (((char *)dpy->bufptr - (char *)req) < (gc->values.line_width ? wsize : zsize)) ) { req->length += SIZEOF(xSegment) >> 2; -#ifndef MUSTCOPY segment = (xSegment *) dpy->bufptr; dpy->bufptr += SIZEOF(xSegment); -#endif /* not MUSTCOPY */ } else { GetReqExtra (PolySegment, SIZEOF(xSegment), req); req->drawable = d; req->gc = gc->gid; -#ifdef MUSTCOPY - dpy->bufptr -= SIZEOF(xSegment); -#else segment = (xSegment *) NEXTPTR(req,xPolySegmentReq); -#endif /* MUSTCOPY */ } segment->x1 = x1; @@ -89,10 +77,6 @@ XDrawLine ( segment->x2 = x2; segment->y2 = y2; -#ifdef MUSTCOPY - Data (dpy, (char *) &segmentdata, len); -#endif /* MUSTCOPY */ - UnlockDisplay(dpy); SyncHandle(); } diff --git a/libX11/src/DrPoint.c b/libX11/src/DrPoint.c index 5c89b5c63..f0332e853 100644 --- a/libX11/src/DrPoint.c +++ b/libX11/src/DrPoint.c @@ -42,12 +42,6 @@ XDrawPoint( int y) /* INT16 */ { xPoint *point; -#ifdef MUSTCOPY - xPoint pointdata; - long len = SIZEOF(xPoint); - - point = &pointdata; -#endif /* MUSTCOPY */ LockDisplay(dpy); FlushGC(dpy, gc); @@ -65,10 +59,8 @@ XDrawPoint( && ((dpy->bufptr + SIZEOF(xPoint)) <= dpy->bufmax) && (((char *)dpy->bufptr - (char *)req) < size) ) { req->length += SIZEOF(xPoint) >> 2; -#ifndef MUSTCOPY point = (xPoint *) dpy->bufptr; dpy->bufptr += SIZEOF(xPoint); -#endif /* not MUSTCOPY */ } else { @@ -76,19 +68,12 @@ XDrawPoint( req->drawable = d; req->gc = gc->gid; req->coordMode = CoordModeOrigin; -#ifdef MUSTCOPY - dpy->bufptr -= SIZEOF(xPoint); -#else point = (xPoint *) NEXTPTR(req,xPolyPointReq); -#endif /* MUSTCOPY */ } point->x = x; point->y = y; -#ifdef MUSTCOPY - Data (dpy, (char *) point, len); -#endif /* MUSTCOPY */ } UnlockDisplay(dpy); SyncHandle(); diff --git a/libX11/src/DrRect.c b/libX11/src/DrRect.c index dadd55ea2..d9141eef9 100644 --- a/libX11/src/DrRect.c +++ b/libX11/src/DrRect.c @@ -45,12 +45,6 @@ XDrawRectangle( unsigned int height) /* CARD16 */ { xRectangle *rect; -#ifdef MUSTCOPY - xRectangle rectdata; - long len = SIZEOF(xRectangle); - - rect = &rectdata; -#endif /* MUSTCOPY */ LockDisplay(dpy); FlushGC(dpy, gc); @@ -67,21 +61,15 @@ XDrawRectangle( && (((char *)dpy->bufptr - (char *)req) < (gc->values.line_width ? wsize : zsize)) ) { req->length += SIZEOF(xRectangle) >> 2; -#ifndef MUSTCOPY rect = (xRectangle *) dpy->bufptr; dpy->bufptr += SIZEOF(xRectangle); -#endif /* not MUSTCOPY */ } else { GetReqExtra(PolyRectangle, SIZEOF(xRectangle), req); req->drawable = d; req->gc = gc->gid; -#ifdef MUSTCOPY - dpy->bufptr -= SIZEOF(xRectangle); -#else rect = (xRectangle *) NEXTPTR(req,xPolyRectangleReq); -#endif /* MUSTCOPY */ } rect->x = x; @@ -89,10 +77,6 @@ XDrawRectangle( rect->width = width; rect->height = height; -#ifdef MUSTCOPY - Data (dpy, (char *) rect, len); /* subtracted bufptr up above */ -#endif /* MUSTCOPY */ - } UnlockDisplay(dpy); SyncHandle(); diff --git a/libX11/src/FillArc.c b/libX11/src/FillArc.c index 0f1ad02d1..c67f977b7 100644 --- a/libX11/src/FillArc.c +++ b/libX11/src/FillArc.c @@ -46,12 +46,6 @@ XFillArc( int angle2) /* INT16 */ { xArc *arc; -#ifdef MUSTCOPY - xArc arcdata; - long len = SIZEOF(xArc); - - arc = &arcdata; -#endif /* MUSTCOPY */ LockDisplay(dpy); FlushGC(dpy, gc); @@ -67,10 +61,8 @@ XFillArc( && ((dpy->bufptr + SIZEOF(xArc)) <= dpy->bufmax) && (((char *)dpy->bufptr - (char *)req) < size) ) { req->length += SIZEOF(xArc) >> 2; -#ifndef MUSTCOPY arc = (xArc *) dpy->bufptr; dpy->bufptr += SIZEOF(xArc); -#endif /* not MUSTCOPY */ } else { @@ -78,11 +70,7 @@ XFillArc( req->drawable = d; req->gc = gc->gid; -#ifdef MUSTCOPY - dpy->bufptr -= SIZEOF(xArc); -#else arc = (xArc *) NEXTPTR(req,xPolyFillArcReq); -#endif /* MUSTCOPY */ } arc->x = x; arc->y = y; @@ -91,10 +79,6 @@ XFillArc( arc->angle1 = angle1; arc->angle2 = angle2; -#ifdef MUSTCOPY - Data (dpy, (char *) arc, len); -#endif /* MUSTCOPY */ - } UnlockDisplay(dpy); SyncHandle(); diff --git a/libX11/src/FillRct.c b/libX11/src/FillRct.c index 4cd104cb1..3ca9afe9e 100644 --- a/libX11/src/FillRct.c +++ b/libX11/src/FillRct.c @@ -44,12 +44,6 @@ XFillRectangle( unsigned int height) /* CARD16 */ { xRectangle *rect; -#ifdef MUSTCOPY - xRectangle rectdata; - long len = SIZEOF(xRectangle); - - rect = &rectdata; -#endif /* MUSTCOPY */ LockDisplay(dpy); FlushGC(dpy, gc); @@ -66,30 +60,21 @@ XFillRectangle( && ((dpy->bufptr + SIZEOF(xRectangle)) <= dpy->bufmax) && (((char *)dpy->bufptr - (char *)req) < size) ) { req->length += SIZEOF(xRectangle) >> 2; -#ifndef MUSTCOPY rect = (xRectangle *) dpy->bufptr; dpy->bufptr += SIZEOF(xRectangle); -#endif /* not MUSTCOPY */ } else { GetReqExtra(PolyFillRectangle, SIZEOF(xRectangle), req); req->drawable = d; req->gc = gc->gid; -#ifdef MUSTCOPY - dpy->bufptr -= SIZEOF(xRectangle); -#else rect = (xRectangle *) NEXTPTR(req,xPolyFillRectangleReq); -#endif /* MUSTCOPY */ } rect->x = x; rect->y = y; rect->width = width; rect->height = height; -#ifdef MUSTCOPY - Data (dpy, (char *) rect, len); -#endif /* MUSTCOPY */ } UnlockDisplay(dpy); SyncHandle(); diff --git a/libX11/src/Font.c b/libX11/src/Font.c index 7f56f686b..25e1790c8 100644 --- a/libX11/src/Font.c +++ b/libX11/src/Font.c @@ -32,7 +32,7 @@ authorization from the X Consortium and the XFree86 Project. #endif #include "Xlibint.h" -#if defined(XF86BIGFONT) && !defined(MUSTCOPY) +#if defined(XF86BIGFONT) #define USE_XF86BIGFONT #endif #ifdef USE_XF86BIGFONT @@ -228,31 +228,9 @@ _XQueryFont ( fs->ascent = cvtINT16toInt (reply.fontAscent); fs->descent = cvtINT16toInt (reply.fontDescent); -#ifdef MUSTCOPY - { - xCharInfo *xcip; - - xcip = (xCharInfo *) &reply.minBounds; - fs->min_bounds.lbearing = cvtINT16toShort(xcip->leftSideBearing); - fs->min_bounds.rbearing = cvtINT16toShort(xcip->rightSideBearing); - fs->min_bounds.width = cvtINT16toShort(xcip->characterWidth); - fs->min_bounds.ascent = cvtINT16toShort(xcip->ascent); - fs->min_bounds.descent = cvtINT16toShort(xcip->descent); - fs->min_bounds.attributes = xcip->attributes; - - xcip = (xCharInfo *) &reply.maxBounds; - fs->max_bounds.lbearing = cvtINT16toShort(xcip->leftSideBearing); - fs->max_bounds.rbearing = cvtINT16toShort(xcip->rightSideBearing); - fs->max_bounds.width = cvtINT16toShort(xcip->characterWidth); - fs->max_bounds.ascent = cvtINT16toShort(xcip->ascent); - fs->max_bounds.descent = cvtINT16toShort(xcip->descent); - fs->max_bounds.attributes = xcip->attributes; - } -#else /* XXX the next two statements won't work if short isn't 16 bits */ fs->min_bounds = * (XCharStruct *) &reply.minBounds; fs->max_bounds = * (XCharStruct *) &reply.maxBounds; -#endif /* MUSTCOPY */ fs->n_properties = reply.nFontProps; /* @@ -276,7 +254,6 @@ _XQueryFont ( * If no characters in font, then it is a bad font, but * shouldn't try to read nothing. */ - /* have to unpack charinfos on some machines (CRAY) */ fs->per_char = NULL; if (reply.nCharInfos > 0){ nbytes = reply.nCharInfos * sizeof(XCharStruct); @@ -288,27 +265,8 @@ _XQueryFont ( return (XFontStruct *)NULL; } -#ifdef MUSTCOPY - { - register XCharStruct *cs = fs->per_char; - register int i; - - for (i = 0; i < reply.nCharInfos; i++, cs++) { - xCharInfo xcip; - - _XRead(dpy, (char *)&xcip, SIZEOF(xCharInfo)); - cs->lbearing = cvtINT16toShort(xcip.leftSideBearing); - cs->rbearing = cvtINT16toShort(xcip.rightSideBearing); - cs->width = cvtINT16toShort(xcip.characterWidth); - cs->ascent = cvtINT16toShort(xcip.ascent); - cs->descent = cvtINT16toShort(xcip.descent); - cs->attributes = xcip.attributes; - } - } -#else nbytes = reply.nCharInfos * SIZEOF(xCharInfo); _XRead16 (dpy, (char *)fs->per_char, nbytes); -#endif } /* call out to any extensions interested */ diff --git a/libX11/src/FontInfo.c b/libX11/src/FontInfo.c index 97de40e0e..fb296b8a8 100644 --- a/libX11/src/FontInfo.c +++ b/libX11/src/FontInfo.c @@ -29,7 +29,7 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -#if defined(XF86BIGFONT) && !defined(MUSTCOPY) +#if defined(XF86BIGFONT) #define USE_XF86BIGFONT #endif #ifdef USE_XF86BIGFONT @@ -133,31 +133,9 @@ XFontStruct **info) /* RETURN */ fs->ascent = cvtINT16toInt (reply.fontAscent); fs->descent = cvtINT16toInt (reply.fontDescent); -#ifdef MUSTCOPY - { - xCharInfo *xcip; - - xcip = (xCharInfo *) &reply.minBounds; - fs->min_bounds.lbearing = xcip->leftSideBearing; - fs->min_bounds.rbearing = xcip->rightSideBearing; - fs->min_bounds.width = xcip->characterWidth; - fs->min_bounds.ascent = xcip->ascent; - fs->min_bounds.descent = xcip->descent; - fs->min_bounds.attributes = xcip->attributes; - - xcip = (xCharInfo *) &reply.maxBounds; - fs->max_bounds.lbearing = xcip->leftSideBearing; - fs->max_bounds.rbearing = xcip->rightSideBearing; - fs->max_bounds.width = xcip->characterWidth; - fs->max_bounds.ascent = xcip->ascent; - fs->max_bounds.descent = xcip->descent; - fs->max_bounds.attributes = xcip->attributes; - } -#else /* XXX the next two statements won't work if short isn't 16 bits */ fs->min_bounds = * (XCharStruct *) &reply.minBounds; fs->max_bounds = * (XCharStruct *) &reply.maxBounds; -#endif /* MUSTCOPY */ fs->n_properties = reply.nFontProps; if (fs->n_properties > 0) { diff --git a/libX11/src/ImUtil.c b/libX11/src/ImUtil.c index 3164d43b7..fa8d464aa 100644 --- a/libX11/src/ImUtil.c +++ b/libX11/src/ImUtil.c @@ -528,9 +528,7 @@ static unsigned long _XGetPixel ( return (pixel & low_bits_table[ximage->depth]); } -#ifndef WORD64 static CARD32 const byteorderpixel = MSBFirst << 24; -#endif static unsigned long _XGetPixel32 ( register XImage *ximage, @@ -543,12 +541,9 @@ static unsigned long _XGetPixel32 ( if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 32)) { addr = &((unsigned char *)ximage->data) [y * ximage->bytes_per_line + (x << 2)]; -#ifndef WORD64 if (*((const char *)&byteorderpixel) == ximage->byte_order) pixel = *((CARD32 *)addr); - else -#endif - if (ximage->byte_order == MSBFirst) + else if (ximage->byte_order == MSBFirst) pixel = ((unsigned long)addr[0] << 24 | (unsigned long)addr[1] << 16 | (unsigned long)addr[2] << 8 | @@ -734,12 +729,9 @@ static int _XPutPixel32 ( if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 32)) { addr = &((unsigned char *)ximage->data) [y * ximage->bytes_per_line + (x << 2)]; -#ifndef WORD64 if (*((const char *)&byteorderpixel) == ximage->byte_order) *((CARD32 *)addr) = pixel; - else -#endif - if (ximage->byte_order == MSBFirst) { + else if (ximage->byte_order == MSBFirst) { addr[0] = pixel >> 24; addr[1] = pixel >> 16; addr[2] = pixel >> 8; @@ -997,7 +989,6 @@ _XAddPixel ( x = ximage->bytes_per_line * ximage->height; while (--x >= 0) *dp++ += value; -#ifndef WORD64 } else if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 16) && (*((const char *)&byteorderpixel) == ximage->byte_order)) { @@ -1012,7 +1003,6 @@ _XAddPixel ( x = (ximage->bytes_per_line >> 2) * ximage->height; while (--x >= 0) *dp++ += value; -#endif } else { for (y = ximage->height; --y >= 0; ) { for (x = ximage->width; --x >= 0; ) { diff --git a/libX11/src/LiHosts.c b/libX11/src/LiHosts.c index 5ae70d5b2..0f5e837d1 100644 --- a/libX11/src/LiHosts.c +++ b/libX11/src/LiHosts.c @@ -111,15 +111,8 @@ XHostAddress *XListHosts ( _XRead (dpy, (char *) buf, nbytes); for (i = 0; i < reply.nHosts; i++) { -#ifdef WORD64 - xHostEntry xhe; - memcpy((char *)&xhe, bp, SIZEOF(xHostEntry)); - op->family = xhe.family; - op->length = xhe.length; -#else op->family = ((xHostEntry *) bp)->family; op->length =((xHostEntry *) bp)->length; -#endif if (op->family == FamilyServerInterpreted) { char *tp = (char *) (bp + SIZEOF(xHostEntry)); char *vp = memchr(tp, 0, op->length); diff --git a/libX11/src/Macros.c b/libX11/src/Macros.c index 42d4cf1c5..cfc083a01 100644 --- a/libX11/src/Macros.c +++ b/libX11/src/Macros.c @@ -137,12 +137,7 @@ int XImageByteOrder(Display *dpy) { return (ImageByteOrder(dpy)); } unsigned long XNextRequest(Display *dpy) { -#ifdef WORD64 - WORD64ALIGN - return dpy->request + 1; -#else return (NextRequest(dpy)); -#endif } unsigned long XLastKnownRequestProcessed(Display *dpy) diff --git a/libX11/src/MoveWin.c b/libX11/src/MoveWin.c index 3cd75e106..2eb2283be 100644 --- a/libX11/src/MoveWin.c +++ b/libX11/src/MoveWin.c @@ -44,20 +44,11 @@ XMoveWindow ( req->window = w; req->mask = CWX | CWY; -#ifdef MUSTCOPY - { - long lx = (long) x, ly = (long) y; - dpy->bufptr -= 8; - Data32 (dpy, (long *) &lx, 4); /* order dictated by CWX and CWY */ - Data32 (dpy, (long *) &ly, 4); - } -#else { CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xConfigureWindowReq); *valuePtr++ = x; *valuePtr = y; } -#endif /* MUSTCOPY */ UnlockDisplay(dpy); SyncHandle(); return 1; diff --git a/libX11/src/PolyTxt16.c b/libX11/src/PolyTxt16.c index dd6581827..2e4be1673 100644 --- a/libX11/src/PolyTxt16.c +++ b/libX11/src/PolyTxt16.c @@ -168,18 +168,7 @@ XDrawText16( } elt->len = 254; -#if defined(MUSTCOPY) || defined(MUSTCOPY2B) - { - register int i; - register unsigned char *cp; - for (i = 0, cp = ((unsigned char *)elt) + 2; i < 254; i++) { - *cp++ = CharacterOffset[i].byte1; - *cp++ = CharacterOffset[i].byte2; - } - } -#else memcpy ((char *) (elt + 1), (char *)CharacterOffset, 254 * 2); -#endif PartialNChars = PartialNChars - 254; CharacterOffset += 254; @@ -213,21 +202,9 @@ XDrawText16( } elt->len = PartialNChars; -#if defined(MUSTCOPY) || defined(MUSTCOPY2B) - { - register int i; - register unsigned char *cp; - for (i = 0, cp = ((unsigned char *)elt) + 2; i < PartialNChars; - i++) { - *cp++ = CharacterOffset[i].byte1; - *cp++ = CharacterOffset[i].byte2; - } - } -#else memcpy ((char *) (elt + 1), (char *)CharacterOffset, PartialNChars * 2); -#endif } } item++; diff --git a/libX11/src/Quarks.c b/libX11/src/Quarks.c index 7a704b101..4eb90c51d 100644 --- a/libX11/src/Quarks.c +++ b/libX11/src/Quarks.c @@ -131,10 +131,8 @@ static char *permalloc(unsigned int length) return(ret); } -#ifndef WORD64 typedef struct {char a; double b;} TestType1; typedef struct {char a; unsigned long b;} TestType2; -#endif #ifdef XTHREADS static char *_Xpermalloc(unsigned int length); @@ -157,7 +155,6 @@ char *Xpermalloc(unsigned int length) int i; if (neverFreeTableSize && length < NEVERFREETABLESIZE) { -#ifndef WORD64 if ((sizeof(TestType1) != (sizeof(TestType2) - sizeof(unsigned long) + sizeof(double))) && !(length & (DALIGN-1)) && @@ -165,7 +162,6 @@ char *Xpermalloc(unsigned int length) neverFreeTableSize -= DALIGN - i; neverFreeTable += DALIGN - i; } else -#endif if ((i = (NEVERFREETABLESIZE - neverFreeTableSize) & (WALIGN-1))) { neverFreeTableSize -= WALIGN - i; neverFreeTable += WALIGN - i; diff --git a/libX11/src/RestackWs.c b/libX11/src/RestackWs.c index 1dba3c89f..52391ecd2 100644 --- a/libX11/src/RestackWs.c +++ b/libX11/src/RestackWs.c @@ -36,9 +36,6 @@ XRestackWindows ( int n) { int i = 0; -#ifdef MUSTCOPY - unsigned long val = Below; /* needed for macro below */ -#endif LockDisplay(dpy); while (windows++, ++i < n) { @@ -47,18 +44,12 @@ XRestackWindows ( GetReqExtra (ConfigureWindow, 8, req); req->window = *windows; req->mask = CWSibling | CWStackMode; -#ifdef MUSTCOPY - dpy->bufptr -= 8; - Data32 (dpy, (long *)(windows-1), 4); - Data32 (dpy, (long *)&val, 4); -#else { register CARD32 *values = (CARD32 *) NEXTPTR(req,xConfigureWindowReq); *values++ = *(windows-1); *values = Below; } -#endif /* MUSTCOPY */ } UnlockDisplay(dpy); SyncHandle(); diff --git a/libX11/src/SendEvent.c b/libX11/src/SendEvent.c index cc8bd5ace..1de986007 100644 --- a/libX11/src/SendEvent.c +++ b/libX11/src/SendEvent.c @@ -67,12 +67,7 @@ XSendEvent( req->destination = w; req->propagate = propagate; req->eventMask = event_mask; -#ifdef WORD64 - /* avoid quad-alignment problems */ - memcpy ((char *) req->eventdata, (char *) &ev, SIZEOF(xEvent)); -#else req->event = ev; -#endif /* WORD64 */ } UnlockDisplay(dpy); diff --git a/libX11/src/StColor.c b/libX11/src/StColor.c index 19f2a4b1a..d5a217fb0 100644 --- a/libX11/src/StColor.c +++ b/libX11/src/StColor.c @@ -37,21 +37,13 @@ XStoreColor( { xColorItem *citem; register xStoreColorsReq *req; -#ifdef MUSTCOPY - xColorItem citemdata; - long len = SIZEOF(xColorItem); - - citem = &citemdata; -#endif /* MUSTCOPY */ LockDisplay(dpy); GetReqExtra(StoreColors, SIZEOF(xColorItem), req); /* assume size is 4*n */ req->cmap = cmap; -#ifndef MUSTCOPY citem = (xColorItem *) NEXTPTR(req,xStoreColorsReq); -#endif /* not MUSTCOPY */ citem->pixel = def->pixel; citem->red = def->red; @@ -59,10 +51,6 @@ XStoreColor( citem->blue = def->blue; citem->flags = def->flags; /* do_red, do_green, do_blue */ -#ifdef MUSTCOPY - dpy->bufptr -= SIZEOF(xColorItem); /* adjust for GetReqExtra */ - Data (dpy, (char *) citem, len); -#endif /* MUSTCOPY */ UnlockDisplay(dpy); SyncHandle(); diff --git a/libX11/src/Text16.c b/libX11/src/Text16.c index 5a66a2bf6..008a3f7a5 100644 --- a/libX11/src/Text16.c +++ b/libX11/src/Text16.c @@ -82,18 +82,7 @@ XDrawString16( BufAlloc (xTextElt *, elt, nbytes); elt->delta = 0; elt->len = 254; -#if defined(MUSTCOPY) || defined(MUSTCOPY2B) - { - register int i; - register unsigned char *cp; - for (i = 0, cp = ((unsigned char *)elt) + 2; i < 254; i++) { - *cp++ = CharacterOffset[i].byte1; - *cp++ = CharacterOffset[i].byte2; - } - } -#else memcpy (((char *) elt) + 2, (char *)CharacterOffset, 254 * 2); -#endif PartialNChars = PartialNChars - 254; CharacterOffset += 254; } @@ -104,19 +93,7 @@ XDrawString16( BufAlloc (xTextElt *, elt, nbytes); elt->delta = 0; elt->len = PartialNChars; -#if defined(MUSTCOPY) || defined(MUSTCOPY2B) - { - register int i; - register unsigned char *cp; - for (i = 0, cp = ((unsigned char *)elt) + 2; i < PartialNChars; - i++) { - *cp++ = CharacterOffset[i].byte1; - *cp++ = CharacterOffset[i].byte2; - } - } -#else memcpy(((char *)elt) + 2, (char *)CharacterOffset, PartialNChars * 2); -#endif } } diff --git a/libX11/src/XlibAsync.c b/libX11/src/XlibAsync.c index b17135c06..eb2b81963 100644 --- a/libX11/src/XlibAsync.c +++ b/libX11/src/XlibAsync.c @@ -100,11 +100,6 @@ _XGetAsyncReply( _XRead(dpy, replbuf + len, size - len); buf = replbuf; len = size; -#ifdef MUSTCOPY - } else { - memcpy(replbuf, buf, size); - buf = replbuf; -#endif } if (discard && rep->generic.length > extra && diff --git a/libX11/src/XlibInt.c b/libX11/src/XlibInt.c index c43684269..1c964fdea 100644 --- a/libX11/src/XlibInt.c +++ b/libX11/src/XlibInt.c @@ -293,124 +293,6 @@ void _XRead32( } #endif /* LONG64 */ -#ifdef WORD64 - -/* - * XXX This is a *really* stupid way of doing this.... - * PACKBUFFERSIZE must be a multiple of 4. - */ - -#define PACKBUFFERSIZE 4096 - - -/* - * _XRead32 - Read bytes from the socket unpacking each 32 bits - * into a long (64 bits on a CRAY computer). - * - */ -static void _doXRead32( - register Display *dpy, - register long *data - register long size, - register char *packbuffer) -{ - long *lpack,*lp; - long mask32 = 0x00000000ffffffff; - long maskw, nwords, i, bits; - - _XReadPad (dpy, packbuffer, size); - - lp = data; - lpack = (long *) packbuffer; - nwords = size >> 2; - bits = 32; - - for(i=0;i<nwords;i++){ - maskw = mask32 << bits; - *lp++ = ( *lpack & maskw ) >> bits; - bits = bits ^32; - if(bits){ - lpack++; - } - } -} - -void _XRead32( - Display *dpy, - long *data, - long len) -{ - char packbuffer[PACKBUFFERSIZE]; - unsigned nunits = PACKBUFFERSIZE >> 2; - - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { - _doXRead32 (dpy, data, PACKBUFFERSIZE, packbuffer); - } - if (len) _doXRead32 (dpy, data, len, packbuffer); -} - - - -/* - * _XRead16 - Read bytes from the socket unpacking each 16 bits - * into a long (64 bits on a CRAY computer). - * - */ -static _doXRead16( - register Display *dpy, - register short *data, - register long size, - char *packbuffer) -{ - long *lpack,*lp; - long mask16 = 0x000000000000ffff; - long maskw, nwords, i, bits; - - (void) _XRead(dpy,packbuffer,size); /* don't do a padded read... */ - - lp = (long *) data; - lpack = (long *) packbuffer; - nwords = size >> 1; /* number of 16 bit words to be unpacked */ - bits = 48; - for(i=0;i<nwords;i++){ - maskw = mask16 << bits; - *lp++ = ( *lpack & maskw ) >> bits; - bits -= 16; - if(bits < 0){ - lpack++; - bits = 48; - } - } -} - -void _XRead16( - Display *dpy, - short *data, - long len) -{ - char packbuffer[PACKBUFFERSIZE]; - unsigned nunits = PACKBUFFERSIZE >> 1; - - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { - _doXRead16 (dpy, data, PACKBUFFERSIZE, packbuffer); - } - if (len) _doXRead16 (dpy, data, len, packbuffer); -} - -void _XRead16Pad( - Display *dpy, - short *data, - long size) -{ - int slop = (size & 3); - short slopbuf[3]; - - _XRead16 (dpy, data, size); - if (slop > 0) { - _XRead16 (dpy, slopbuf, 4 - slop); - } -} -#endif /* WORD64 */ /* * The hard part about this is that we only get 16 bits from a reply. @@ -1764,122 +1646,6 @@ _XData32( } #endif /* LONG64 */ -#ifdef WORD64 - -/* - * XXX This is a *really* stupid way of doing this. It should just use - * dpy->bufptr directly, taking into account where in the word it is. - */ - -/* - * Data16 - Place 16 bit data in the buffer. - * - * "dpy" is a pointer to a Display. - * "data" is a pointer to the data. - * "len" is the length in bytes of the data. - */ - -static doData16( - register Display *dpy, - _Xconst short *data, - unsigned len, - char *packbuffer) -{ - long *lp,*lpack; - long i, nwords,bits; - long mask16 = 0x000000000000ffff; - - lp = (long *)data; - lpack = (long *)packbuffer; - -/* nwords is the number of 16 bit values to be packed, - * the low order 16 bits of each word will be packed - * into 64 bit words - */ - nwords = len >> 1; - bits = 48; - - for(i=0;i<nwords;i++){ - if (bits == 48) *lpack = 0; - *lpack ^= (*lp & mask16) << bits; - bits -= 16 ; - lp++; - if(bits < 0){ - lpack++; - bits = 48; - } - } - Data(dpy, packbuffer, len); -} - -_XData16 ( - Display *dpy, - _Xconst short *data, - unsigned len) -{ - char packbuffer[PACKBUFFERSIZE]; - unsigned nunits = PACKBUFFERSIZE >> 1; - - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { - doData16 (dpy, data, PACKBUFFERSIZE, packbuffer); - } - if (len) doData16 (dpy, data, len, packbuffer); -} - -/* - * Data32 - Place 32 bit data in the buffer. - * - * "dpy" is a pointer to a Display. - * "data" is a pointer to the data. - * "len" is the length in bytes of the data. - */ - -static doData32( - register Display *dpy - _Xconst long *data, - unsigned len, - char *packbuffer) -{ - long *lp,*lpack; - long i,bits,nwords; - long mask32 = 0x00000000ffffffff; - - lpack = (long *) packbuffer; - lp = data; - -/* nwords is the number of 32 bit values to be packed - * the low order 32 bits of each word will be packed - * into 64 bit words - */ - nwords = len >> 2; - bits = 32; - - for(i=0;i<nwords;i++){ - if (bits == 32) *lpack = 0; - *lpack ^= (*lp & mask32) << bits; - bits = bits ^32; - lp++; - if(bits) - lpack++; - } - Data(dpy, packbuffer, len); -} - -void _XData32( - Display *dpy, - _Xconst long *data, - unsigned len) -{ - char packbuffer[PACKBUFFERSIZE]; - unsigned nunits = PACKBUFFERSIZE >> 2; - - for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) { - doData32 (dpy, data, PACKBUFFERSIZE, packbuffer); - } - if (len) doData32 (dpy, data, len, packbuffer); -} - -#endif /* WORD64 */ /* Make sure this produces the same string as DefineLocal/DefineSelf in xdm. @@ -1967,8 +1733,6 @@ void *_XGetRequest(Display *dpy, CARD8 type, size_t len) { xReq *req; - WORD64ALIGN - if (dpy->bufptr + len > dpy->bufmax) _XFlush(dpy); diff --git a/libX11/src/xcms/cmsTrig.c b/libX11/src/xcms/cmsTrig.c index 5a01a56c8..a917b78db 100644 --- a/libX11/src/xcms/cmsTrig.c +++ b/libX11/src/xcms/cmsTrig.c @@ -80,12 +80,8 @@ _XcmsModuloF( #define XCMS_FABS(x) ((x) < 0.0 ? -(x) : (x)) /* XCMS_DMAXPOWTWO - largest power of two exactly representable as a double */ -#ifdef _CRAY -#define XCMS_DMAXPOWTWO ((double)(1 < 47)) -#else #define XCMS_DMAXPOWTWO ((double)(XCMS_LONG_MAX) * \ (1L << ((XCMS_NBITS(double)-XCMS_DEXPLEN) - XCMS_NBITS(int) + 1))) -#endif /* * LOCAL VARIABLES diff --git a/libX11/src/xkb/XKBAlloc.c b/libX11/src/xkb/XKBAlloc.c index 05e9f7315..034539b67 100644 --- a/libX11/src/xkb/XKBAlloc.c +++ b/libX11/src/xkb/XKBAlloc.c @@ -30,7 +30,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <config.h> #endif -#ifndef XKB_IN_SERVER #include <stdio.h> #include "Xlibint.h" @@ -39,17 +38,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/extensions/XKBproto.h> #include "XKBlibint.h" -#else - -#include <stdio.h> -#include <X11/X.h> -#include <X11/Xproto.h> -#include "misc.h" -#include "inputstr.h" -#include <X11/extensions/XKBsrv.h> -#include <X11/extensions/XKBgeom.h> - -#endif /* XKB_IN_SERVER */ /***===================================================================***/ diff --git a/libX11/src/xkb/XKBGAlloc.c b/libX11/src/xkb/XKBGAlloc.c index 7679496e3..6d4c67645 100644 --- a/libX11/src/xkb/XKBGAlloc.c +++ b/libX11/src/xkb/XKBGAlloc.c @@ -30,7 +30,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <config.h> #endif -#ifndef XKB_IN_SERVER #include <stdio.h> #include "Xlibint.h" @@ -38,24 +37,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/extensions/XKBgeom.h> #include <X11/extensions/XKBproto.h> -#else - -#include <stdio.h> -#include <X11/X.h> -#include <X11/Xproto.h> -#include "misc.h" -#include "inputstr.h" -#include <X11/extensions/XKBsrv.h> -#include <X11/extensions/XKBgeom.h> - -#endif /* XKB_IN_SERVER */ - -#ifdef X_NOT_POSIX -#define Size_t unsigned int -#else -#define Size_t size_t -#endif - /***====================================================================***/ static void @@ -476,7 +457,7 @@ _XkbGeomAlloc( XPointer * old, unsigned short * num, unsigned short * total, int num_new, - Size_t sz_elem) + size_t sz_elem) { if (num_new<1) return Success; diff --git a/libX11/src/xkb/XKBMAlloc.c b/libX11/src/xkb/XKBMAlloc.c index a6b392168..fd75f0c8a 100644 --- a/libX11/src/xkb/XKBMAlloc.c +++ b/libX11/src/xkb/XKBMAlloc.c @@ -30,7 +30,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <config.h> #endif -#ifndef XKB_IN_SERVER #include <stdio.h> #include "Xlibint.h" @@ -38,18 +37,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/keysym.h> #include "XKBlibint.h" -#else - -#include <stdio.h> -#include <X11/X.h> -#include <X11/Xproto.h> -#include "misc.h" -#include "inputstr.h" -#include <X11/keysym.h> -#define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> - -#endif /* XKB_IN_SERVER */ /***====================================================================***/ diff --git a/libX11/src/xkb/XKBMisc.c b/libX11/src/xkb/XKBMisc.c index 4aa1f733a..cd90da7e4 100644 --- a/libX11/src/xkb/XKBMisc.c +++ b/libX11/src/xkb/XKBMisc.c @@ -30,7 +30,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <config.h> #endif -#ifndef XKB_IN_SERVER #include <stdio.h> #include "Xlibint.h" @@ -38,18 +37,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/keysym.h> #include "XKBlibint.h" -#else - -#include <stdio.h> -#include <X11/X.h> -#include <X11/Xproto.h> -#include "misc.h" -#include "inputstr.h" -#include <X11/keysym.h> -#define XKBSRV_NEED_FILE_FUNCS -#include <X11/extensions/XKBsrv.h> - -#endif /* XKB_IN_SERVER */ /***====================================================================***/ diff --git a/libX11/src/xkb/XKBNames.c b/libX11/src/xkb/XKBNames.c index cf2382cca..0276c05b3 100644 --- a/libX11/src/xkb/XKBNames.c +++ b/libX11/src/xkb/XKBNames.c @@ -494,38 +494,10 @@ XkbSetNames( Display * dpy, if (which&XkbGroupNamesMask) _XkbCopyAtoms(dpy,names->groups,groups,XkbNumKbdGroups); if (which&XkbKeyNamesMask) { -#ifdef WORD64 - char *tmp; - register int i; - BufAlloc(char *,tmp,nKeys*XkbKeyNameLength); - for (i=0;i<nKeys;i++,tmp+= XkbKeyNameLength) { - tmp[0]= names->keys[firstKey+i].name[0]; - tmp[1]= names->keys[firstKey+i].name[1]; - tmp[2]= names->keys[firstKey+i].name[2]; - tmp[3]= names->keys[firstKey+i].name[3]; - } -#else Data(dpy,(char *)&names->keys[firstKey],nKeys*XkbKeyNameLength); -#endif } if (which&XkbKeyAliasesMask) { -#ifdef WORD64 - char *tmp; - register int i; - BufAlloc(char *,tmp,nKA*XkbKeyNameLength*2); - for (i=0;i<nKeys;i++,tmp+= 2*XkbKeyNameLength) { - tmp[0]= names->key_aliases[i].real[0]; - tmp[1]= names->key_aliases[i].real[1]; - tmp[2]= names->key_aliases[i].real[2]; - tmp[3]= names->key_aliases[i].real[3]; - tmp[4]= names->key_aliases[i].alias[0]; - tmp[5]= names->key_aliases[i].alias[1]; - tmp[6]= names->key_aliases[i].alias[2]; - tmp[7]= names->key_aliases[i].alias[3]; - } -#else Data(dpy,(char *)names->key_aliases,nKA*XkbKeyNameLength*2); -#endif } if (which&XkbRGNamesMask) { Data32(dpy,(long *)names->radio_groups,nRG*4); @@ -750,38 +722,10 @@ XkbChangeNames(Display *dpy,XkbDescPtr xkb,XkbNameChangesPtr changes) if (which&XkbGroupNamesMask) _XkbCopyAtoms(dpy,names->groups,groups,XkbNumKbdGroups); if (which&XkbKeyNamesMask) { -#ifdef WORD64 - char *tmp; - register int i; - BufAlloc(char *,tmp,nKeys*4); - for (i=0;i<nKeys;i++,tmp+= 4) { - tmp[0]= names->keys[firstKey+i].name[0]; - tmp[1]= names->keys[firstKey+i].name[1]; - tmp[2]= names->keys[firstKey+i].name[2]; - tmp[3]= names->keys[firstKey+i].name[3]; - } -#else Data(dpy,(char *)&names->keys[firstKey],nKeys*XkbKeyNameLength); -#endif } if (which&XkbKeyAliasesMask) { -#ifdef WORD64 - char *tmp; - register int i; - BufAlloc(char *,tmp,nKA*XkbKeyNameLength*2); - for (i=0;i<nKeys;i++,tmp+= 2*XkbKeyNameLength) { - tmp[0]= names->key_aliases[i].real[0]; - tmp[1]= names->key_aliases[i].real[1]; - tmp[2]= names->key_aliases[i].real[2]; - tmp[3]= names->key_aliases[i].real[3]; - tmp[4]= names->key_aliases[i].alias[0]; - tmp[5]= names->key_aliases[i].alias[1]; - tmp[6]= names->key_aliases[i].alias[2]; - tmp[7]= names->key_aliases[i].alias[3]; - } -#else Data(dpy,(char *)names->key_aliases,nKA*XkbKeyNameLength*2); -#endif } if (which&XkbRGNamesMask) { Data32(dpy,(long *)names->radio_groups,nRG*4); diff --git a/libX11/src/xkb/XKBRdBuf.c b/libX11/src/xkb/XKBRdBuf.c index 3023a32ed..bf2883a39 100644 --- a/libX11/src/xkb/XKBRdBuf.c +++ b/libX11/src/xkb/XKBRdBuf.c @@ -116,30 +116,7 @@ _XkbReadCopyData32(int *wire,long *to,int num_words) } return 1; } -#endif -#ifdef WORD64 -int -_XkbReadCopyData32(int *from,long *lp,int num_words) -{ -long *lpack; -long mask32 = 0x00000000ffffffff; -long maskw, i, bits; - - lpack = (long *)from; - bits = 32; - - for (i=0;i<num_words;i++) { - maskw = mask32 << bits; - *lp++ = (*lpack & maskw) >> bits; - bits = bits ^ 32; - if (bits) - lpack++; - } - return 1; -} -#endif -#if defined(LONG64) || defined(WORD64) int _XkbReadBufferCopy32(XkbReadBufferPtr from,long *to,int num_words) { @@ -149,9 +126,7 @@ _XkbReadBufferCopy32(XkbReadBufferPtr from,long *to,int num_words) from->data+= (4*num_words); return True; } -#endif -#ifdef LONG64 int _XkbWriteCopyData32 (register unsigned long *from,CARD32 *to,int len) { @@ -163,9 +138,6 @@ _XkbWriteCopyData32 (register unsigned long *from,CARD32 *to,int len) } #endif /* LONG64 */ -#ifdef WORD64 -_XkbWriteCopyData32 Not Implemented Yet for sizeof(int)==8 -#endif char * _XkbPeekAtReadBuffer(XkbReadBufferPtr from,int size) diff --git a/libX11/src/xkb/XKBlibint.h b/libX11/src/xkb/XKBlibint.h index ce145276c..7b41c3bbf 100644 --- a/libX11/src/xkb/XKBlibint.h +++ b/libX11/src/xkb/XKBlibint.h @@ -213,7 +213,7 @@ extern int _XkbCopyFromReadBuffer( ); -#if defined(WORD64) || defined(LONG64) +#ifdef LONG64 extern int _XkbReadCopyData32( int * /* from */, long * /* to */, diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 3efef04ae..5f95a78d2 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -1688,6 +1688,9 @@ if test "x$enable_gallium_llvm" = xyes; then if $LLVM_CONFIG --components | grep -q '\<mcjit\>'; then LLVM_COMPONENTS="${LLVM_COMPONENTS} mcjit" fi + if $LLVM_CONFIG --components | grep -q '\<oprofilejit\>'; then + LLVM_COMPONENTS="${LLVM_COMPONENTS} oprofilejit" + fi if test "x$enable_opencl" = xyes; then LLVM_COMPONENTS="${LLVM_COMPONENTS} ipo linker instrumentation" @@ -1747,7 +1750,7 @@ AC_SUBST([VDPAU_LIB_INSTALL_DIR]) dnl Directory for OpenCL libs AC_ARG_WITH([opencl-libdir], [AS_HELP_STRING([--with-opencl-libdir=DIR], - [directory for the OpenCL libraries @<:@default=${libdir}/opencl@:>@])], + [directory for auxiliary libraries used by the OpenCL implementation @<:@default=${libdir}/opencl@:>@])], [OPENCL_LIB_INSTALL_DIR="$withval"], [OPENCL_LIB_INSTALL_DIR='${libdir}/opencl']) AC_SUBST([OPENCL_LIB_INSTALL_DIR]) diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt index 025bef951..de5169373 100644 --- a/mesalib/docs/GL3.txt +++ b/mesalib/docs/GL3.txt @@ -63,7 +63,7 @@ Base vertex offset(GL_ARB_draw_elements_base_vertex) DONE (i965, r300, r600, sw Frag shader coord (GL_ARB_fragment_coord_conventions) DONE (i965, r300, r600, swrast) Provoking vertex (GL_ARB_provoking_vertex) DONE (i965, r300, r600, swrast) Seamless cubemaps (GL_ARB_seamless_cube_map) DONE (i965, r600) -Multisample textures (GL_ARB_texture_multisample) not started +Multisample textures (GL_ARB_texture_multisample) DONE (i965) Frag depth clamp (GL_ARB_depth_clamp) DONE (i965, r600, swrast) Fence objects (GL_ARB_sync) DONE (i965, r300, r600, swrast) GLX_ARB_create_context_profile DONE @@ -119,7 +119,7 @@ GLSL 4.2 not started GL_ARB_texture_compression_bptc not started GL_ARB_compressed_texture_pixel_storage not started GL_ARB_shader_atomic_counters not started -GL_ARB_texture_storage DONE (r300, r600, swrast, gallium) +GL_ARB_texture_storage DONE (i965, r300, r600, swrast, gallium) GL_ARB_transform_feedback_instanced DONE GL_ARB_base_instance DONE (i965, nv50, nvc0, r600, radeonsi) GL_ARB_shader_image_load_store not started diff --git a/mesalib/scons/llvm.py b/mesalib/scons/llvm.py index e1ed76022..7f00c6ce1 100644 --- a/mesalib/scons/llvm.py +++ b/mesalib/scons/llvm.py @@ -92,7 +92,19 @@ def generate(env): 'HAVE_STDINT_H', ]) env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')]) - if llvm_version >= distutils.version.LooseVersion('3.0'): + if llvm_version >= distutils.version.LooseVersion('3.2'): + # 3.2 + env.Prepend(LIBS = [ + 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser', + 'LLVMX86CodeGen', 'LLVMX86Desc', 'LLVMSelectionDAG', + 'LLVMAsmPrinter', 'LLVMMCParser', 'LLVMX86AsmPrinter', + 'LLVMX86Utils', 'LLVMX86Info', 'LLVMJIT', + 'LLVMExecutionEngine', 'LLVMCodeGen', 'LLVMScalarOpts', + 'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa', + 'LLVMAnalysis', 'LLVMTarget', 'LLVMMC', 'LLVMCore', + 'LLVMSupport', 'LLVMRuntimeDyld', 'LLVMObject' + ]) + elif llvm_version >= distutils.version.LooseVersion('3.0'): # 3.0 env.Prepend(LIBS = [ 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser', diff --git a/mesalib/src/gallium/auxiliary/util/u_range.h b/mesalib/src/gallium/auxiliary/util/u_range.h new file mode 100644 index 000000000..4b1d0d1be --- /dev/null +++ b/mesalib/src/gallium/auxiliary/util/u_range.h @@ -0,0 +1,89 @@ +/* + * Copyright 2013 Marek Olšák <maraeo@gmail.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) AND/OR THEIR SUPPLIERS 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. */ + +/** + * @file + * 1D integer range, capable of the union and intersection operations. + * + * It only maintains a single interval which is extended when the union is + * done. This implementation is partially thread-safe (readers are not + * protected by a lock). + * + * @author Marek Olšák + */ + +#ifndef U_RANGE_H +#define U_RANGE_H + +#include "os/os_thread.h" + +struct util_range { + unsigned start; /* inclusive */ + unsigned end; /* exclusive */ + + /* for the range to be consistent with multiple contexts: */ + pipe_mutex write_mutex; +}; + + +static INLINE void +util_range_set_empty(struct util_range *range) +{ + range->start = ~0; + range->end = 0; +} + +/* This is like a union of two sets. */ +static INLINE void +util_range_add(struct util_range *range, unsigned start, unsigned end) +{ + if (start < range->start || end > range->end) { + pipe_mutex_lock(range->write_mutex); + range->start = MIN2(start, range->start); + range->end = MAX2(end, range->end); + pipe_mutex_unlock(range->write_mutex); + } +} + +static INLINE boolean +util_ranges_intersect(struct util_range *range, unsigned start, unsigned end) +{ + return MAX2(start, range->start) < MIN2(end, range->end); +} + + +/* Init/deinit */ + +static INLINE void +util_range_init(struct util_range *range) +{ + pipe_mutex_init(range->write_mutex); + util_range_set_empty(range); +} + +static INLINE void +util_range_destroy(struct util_range *range) +{ + pipe_mutex_destroy(range->write_mutex); +} + +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_surface.c b/mesalib/src/gallium/auxiliary/util/u_surface.c index b948b46d2..5c3a655d6 100644 --- a/mesalib/src/gallium/auxiliary/util/u_surface.c +++ b/mesalib/src/gallium/auxiliary/util/u_surface.c @@ -322,21 +322,58 @@ util_clear_render_target(struct pipe_context *pipe, assert(dst->texture); if (!dst->texture) return; - /* XXX: should handle multiple layers */ - dst_map = pipe_transfer_map(pipe, - dst->texture, - dst->u.tex.level, - dst->u.tex.first_layer, - PIPE_TRANSFER_WRITE, - dstx, dsty, width, height, &dst_trans); + + if (dst->texture->target == PIPE_BUFFER) { + /* + * The fill naturally works on the surface format, however + * the transfer uses resource format which is just bytes for buffers. + */ + unsigned dx, w; + unsigned pixstride = util_format_get_blocksize(dst->format); + dx = (dst->u.buf.first_element + dstx) * pixstride; + w = width * pixstride; + dst_map = pipe_transfer_map(pipe, + dst->texture, + 0, 0, + PIPE_TRANSFER_WRITE, + dx, 0, w, 1, + &dst_trans); + } + else { + /* XXX: should handle multiple layers */ + dst_map = pipe_transfer_map(pipe, + dst->texture, + dst->u.tex.level, + dst->u.tex.first_layer, + PIPE_TRANSFER_WRITE, + dstx, dsty, width, height, &dst_trans); + + } assert(dst_map); if (dst_map) { + enum pipe_format format = dst->format; assert(dst_trans->stride > 0); - util_pack_color(color->f, dst->texture->format, &uc); - util_fill_rect(dst_map, dst->texture->format, + if (util_format_is_pure_integer(format)) { + /* + * We expect int/uint clear values here, though some APIs + * might disagree (but in any case util_pack_color() + * couldn't handle it)... + */ + if (util_format_is_pure_sint(format)) { + util_format_write_4i(format, color->i, 0, &uc, 0, 0, 0, 1, 1); + } + else { + assert(util_format_is_pure_uint(format)); + util_format_write_4ui(format, color->ui, 0, &uc, 0, 0, 0, 1, 1); + } + } + else { + util_pack_color(color->f, dst->format, &uc); + } + util_fill_rect(dst_map, dst->format, dst_trans->stride, 0, 0, width, height, &uc); diff --git a/mesalib/src/glsl/builtin_types.h b/mesalib/src/glsl/builtin_types.h index c78c2d270..acd2d76d5 100644 --- a/mesalib/src/glsl/builtin_types.h +++ b/mesalib/src/glsl/builtin_types.h @@ -347,3 +347,22 @@ const glsl_type glsl_type::builtin_ARB_texture_cube_map_array_types[] = { GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_UINT, "usamplerCubeArray"), }; /*@}*/ + +/** \name Sampler types added by GL_ARB_texture_multisample + */ +/*@{*/ +const glsl_type glsl_type::builtin_ARB_texture_multisample_types[] = { + glsl_type(GL_SAMPLER_2D_MULTISAMPLE, + GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_FLOAT, "sampler2DMS"), + glsl_type(GL_INT_SAMPLER_2D_MULTISAMPLE, + GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_INT, "isampler2DMS"), + glsl_type(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE, + GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_UINT, "usampler2DMS"), + glsl_type(GL_SAMPLER_2D_MULTISAMPLE_ARRAY, + GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_FLOAT, "sampler2DMSArray"), + glsl_type(GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, + GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_INT, "isampler2DMSArray"), + glsl_type(GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, + GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_UINT, "usampler2DMSArray"), +}; +/*@}*/ diff --git a/mesalib/src/glsl/builtin_variables.cpp b/mesalib/src/glsl/builtin_variables.cpp index ccee7746e..53c4c51cd 100644 --- a/mesalib/src/glsl/builtin_variables.cpp +++ b/mesalib/src/glsl/builtin_variables.cpp @@ -849,6 +849,7 @@ initialize_vs_variables(exec_list *instructions, generate_130_vs_variables(instructions, state, true); break; case 140: + case 150: generate_130_vs_variables(instructions, state, false); break; default: @@ -1140,6 +1141,7 @@ initialize_fs_variables(exec_list *instructions, generate_130_fs_variables(instructions, state); break; case 140: + case 150: generate_140_fs_variables(instructions, state); break; default: diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y index e927c7cb7..d6afe8814 100644 --- a/mesalib/src/glsl/glcpp/glcpp-parse.y +++ b/mesalib/src/glsl/glcpp/glcpp-parse.y @@ -1230,6 +1230,9 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api) if (extensions->ARB_shading_language_packing) add_builtin_define(parser, "GL_ARB_shading_language_packing", 1); + + if (extensions->ARB_texture_multisample) + add_builtin_define(parser, "GL_ARB_texture_multisample", 1); } } diff --git a/mesalib/src/glsl/glsl_lexer.ll b/mesalib/src/glsl/glsl_lexer.ll index ddc9f8073..008ef303d 100644 --- a/mesalib/src/glsl/glsl_lexer.ll +++ b/mesalib/src/glsl/glsl_lexer.ll @@ -315,6 +315,15 @@ usamplerCube KEYWORD(130, 300, 130, 300, USAMPLERCUBE); usampler1DArray KEYWORD(130, 300, 130, 0, USAMPLER1DARRAY); usampler2DArray KEYWORD(130, 300, 130, 300, USAMPLER2DARRAY); + /* additional keywords in ARB_texture_multisample, included in GLSL 1.50 */ + /* these are reserved but not defined in GLSL 3.00 */ +sampler2DMS KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, SAMPLER2DMS); +isampler2DMS KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, ISAMPLER2DMS); +usampler2DMS KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, USAMPLER2DMS); +sampler2DMSArray KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, SAMPLER2DMSARRAY); +isampler2DMSArray KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, ISAMPLER2DMSARRAY); +usampler2DMSArray KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, USAMPLER2DMSARRAY); + samplerCubeArray { if (yyextra->ARB_texture_cube_map_array_enable) return SAMPLERCUBEARRAY; @@ -531,12 +540,6 @@ atomic_uint KEYWORD(0, 300, 0, 0, ATOMIC_UINT); patch KEYWORD(0, 300, 0, 0, PATCH); sample KEYWORD(0, 300, 0, 0, SAMPLE); subroutine KEYWORD(0, 300, 0, 0, SUBROUTINE); -sampler2DMS KEYWORD(0, 300, 0, 0, SAMPLER2DMS); -isampler2DMS KEYWORD(0, 300, 0, 0, ISAMPLER2DMS); -usampler2DMS KEYWORD(0, 300, 0, 0, USAMPLER2DMS); -sampler2DMSArray KEYWORD(0, 300, 0, 0, SAMPLER2DMSARRAY); -isampler2DMSArray KEYWORD(0, 300, 0, 0, ISAMPLER2DMSARRAY); -usampler2DMSArray KEYWORD(0, 300, 0, 0, USAMPLER2DMSARRAY); [_a-zA-Z][_a-zA-Z0-9]* { diff --git a/mesalib/src/glsl/glsl_parser.yy b/mesalib/src/glsl/glsl_parser.yy index 154ce2d09..f52ed9b0a 100644 --- a/mesalib/src/glsl/glsl_parser.yy +++ b/mesalib/src/glsl/glsl_parser.yy @@ -109,6 +109,8 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg) %token USAMPLER2DARRAY USAMPLERCUBEARRAY %token SAMPLER2DRECT ISAMPLER2DRECT USAMPLER2DRECT SAMPLER2DRECTSHADOW %token SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER +%token SAMPLER2DMS ISAMPLER2DMS USAMPLER2DMS +%token SAMPLER2DMSARRAY ISAMPLER2DMSARRAY USAMPLER2DMSARRAY %token SAMPLEREXTERNALOES %token STRUCT VOID_TOK WHILE %token <identifier> IDENTIFIER TYPE_IDENTIFIER NEW_IDENTIFIER @@ -140,8 +142,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg) %token SAMPLER3DRECT %token SIZEOF CAST NAMESPACE USING %token COHERENT RESTRICT READONLY WRITEONLY RESOURCE ATOMIC_UINT PATCH SAMPLE -%token SUBROUTINE SAMPLER2DMS ISAMPLER2DMS USAMPLER2DMS SAMPLER2DMSARRAY -%token ISAMPLER2DMSARRAY USAMPLER2DMSARRAY +%token SUBROUTINE %token ERROR_TOK @@ -1462,6 +1463,12 @@ basic_type_specifier_nonarray: | USAMPLER2DARRAY { $$ = "usampler2DArray"; } | USAMPLERBUFFER { $$ = "usamplerBuffer"; } | USAMPLERCUBEARRAY { $$ = "usamplerCubeArray"; } + | SAMPLER2DMS { $$ = "sampler2DMS"; } + | ISAMPLER2DMS { $$ = "isampler2DMS"; } + | USAMPLER2DMS { $$ = "usampler2DMS"; } + | SAMPLER2DMSARRAY { $$ = "sampler2DMSArray"; } + | ISAMPLER2DMSARRAY { $$ = "isampler2DMSArray"; } + | USAMPLER2DMSARRAY { $$ = "usampler2DMSArray"; } ; precision_qualifier: diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index df1714850..9d7de3381 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -467,6 +467,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { EXT(OES_standard_derivatives, false, false, true, false, true, OES_standard_derivatives), EXT(ARB_texture_cube_map_array, true, false, true, true, false, ARB_texture_cube_map_array), EXT(ARB_shading_language_packing, true, false, true, true, false, ARB_shading_language_packing), + EXT(ARB_texture_multisample, true, false, true, true, false, ARB_texture_multisample), }; #undef EXT diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h index 3ebc27e1a..1765cdf16 100644 --- a/mesalib/src/glsl/glsl_parser_extras.h +++ b/mesalib/src/glsl/glsl_parser_extras.h @@ -280,6 +280,8 @@ struct _mesa_glsl_parse_state { bool ARB_texture_cube_map_array_warn; bool ARB_shading_language_packing_enable; bool ARB_shading_language_packing_warn; + bool ARB_texture_multisample_enable; + bool ARB_texture_multisample_warn; /*@}*/ /** Extensions supported by the OpenGL implementation. */ diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp index 82aeb84ed..a783dcc3b 100644 --- a/mesalib/src/glsl/glsl_types.cpp +++ b/mesalib/src/glsl/glsl_types.cpp @@ -198,6 +198,8 @@ glsl_type::sampler_index() const return TEXTURE_BUFFER_INDEX; case GLSL_SAMPLER_DIM_EXTERNAL: return TEXTURE_EXTERNAL_INDEX; + case GLSL_SAMPLER_DIM_MS: + return (t->sampler_array) ? TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX : TEXTURE_2D_MULTISAMPLE_INDEX; default: assert(!"Should not get here."); return TEXTURE_BUFFER_INDEX; @@ -345,6 +347,16 @@ glsl_type::generate_ARB_texture_cube_map_array_types(glsl_symbol_table *symtab, } void +glsl_type::generate_ARB_texture_multisample_types(glsl_symbol_table *symtab, + bool warn) +{ + bool skip_1d = false; + add_types_to_symbol_table(symtab, builtin_ARB_texture_multisample_types, + Elements(builtin_ARB_texture_multisample_types), + warn, skip_1d); +} + +void _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state) { if (state->es_shader) { @@ -373,6 +385,7 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state) glsl_type::generate_130_types(state->symbols, true, skip_1d); break; case 140: + case 150: glsl_type::generate_140_types(state->symbols); break; default: @@ -412,6 +425,11 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state) glsl_type::generate_ARB_texture_cube_map_array_types(state->symbols, state->ARB_texture_cube_map_array_warn); } + + if (state->ARB_texture_multisample_enable) { + glsl_type::generate_ARB_texture_multisample_types(state->symbols, + state->ARB_texture_multisample_warn); + } } diff --git a/mesalib/src/glsl/glsl_types.h b/mesalib/src/glsl/glsl_types.h index 8cfd8dd02..79304269d 100644 --- a/mesalib/src/glsl/glsl_types.h +++ b/mesalib/src/glsl/glsl_types.h @@ -67,7 +67,8 @@ enum glsl_sampler_dim { GLSL_SAMPLER_DIM_CUBE, GLSL_SAMPLER_DIM_RECT, GLSL_SAMPLER_DIM_BUF, - GLSL_SAMPLER_DIM_EXTERNAL + GLSL_SAMPLER_DIM_EXTERNAL, + GLSL_SAMPLER_DIM_MS }; enum glsl_interface_packing { @@ -561,6 +562,7 @@ private: static const glsl_type builtin_EXT_texture_buffer_object_types[]; static const glsl_type builtin_OES_EGL_image_external_types[]; static const glsl_type builtin_ARB_texture_cube_map_array_types[]; + static const glsl_type builtin_ARB_texture_multisample_types[]; /*@}*/ /** @@ -586,6 +588,7 @@ private: static void generate_OES_texture_3D_types(glsl_symbol_table *, bool); static void generate_OES_EGL_image_external_types(glsl_symbol_table *, bool); static void generate_ARB_texture_cube_map_array_types(glsl_symbol_table *, bool); + static void generate_ARB_texture_multisample_types(glsl_symbol_table *, bool); /*@}*/ /** diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp index 954995db3..2eb3af695 100644 --- a/mesalib/src/glsl/ir.cpp +++ b/mesalib/src/glsl/ir.cpp @@ -195,34 +195,6 @@ ir_assignment::ir_assignment(ir_rvalue *lhs, ir_rvalue *rhs, this->set_lhs(lhs); } - -ir_expression::ir_expression(int op, const struct glsl_type *type, - ir_rvalue *op0) -{ - assert(get_num_operands(ir_expression_operation(op)) == 1); - this->ir_type = ir_type_expression; - this->type = type; - this->operation = ir_expression_operation(op); - this->operands[0] = op0; - this->operands[1] = NULL; - this->operands[2] = NULL; - this->operands[3] = NULL; -} - -ir_expression::ir_expression(int op, const struct glsl_type *type, - ir_rvalue *op0, ir_rvalue *op1) -{ - assert(((op1 == NULL) && (get_num_operands(ir_expression_operation(op)) == 1)) - || (get_num_operands(ir_expression_operation(op)) == 2)); - this->ir_type = ir_type_expression; - this->type = type; - this->operation = ir_expression_operation(op); - this->operands[0] = op0; - this->operands[1] = op1; - this->operands[2] = NULL; - this->operands[3] = NULL; -} - ir_expression::ir_expression(int op, const struct glsl_type *type, ir_rvalue *op0, ir_rvalue *op1, ir_rvalue *op2, ir_rvalue *op3) @@ -234,6 +206,12 @@ ir_expression::ir_expression(int op, const struct glsl_type *type, this->operands[1] = op1; this->operands[2] = op2; this->operands[3] = op3; +#ifndef NDEBUG + int num_operands = get_num_operands(this->operation); + for (int i = num_operands; i < 4; i++) { + assert(this->operands[i] == NULL); + } +#endif } ir_expression::ir_expression(int op, ir_rvalue *op0) @@ -438,6 +416,9 @@ ir_expression::get_num_operands(ir_expression_operation op) if (op <= ir_last_binop) return 2; + if (op <= ir_last_triop) + return 3; + if (op == ir_quadop_vector) return 4; @@ -524,6 +505,7 @@ static const char *const operator_strs[] = { "pow", "packHalf2x16_split", "ubo_load", + "lrp", "vector", }; @@ -1325,7 +1307,7 @@ ir_dereference::is_lvalue() const } -static const char *tex_opcode_strs[] = { "tex", "txb", "txl", "txd", "txf", "txs" }; +static const char *tex_opcode_strs[] = { "tex", "txb", "txl", "txd", "txf", "txf_ms", "txs" }; const char *ir_texture::opcode_string() { diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h index 1e09988e5..393b48673 100644 --- a/mesalib/src/glsl/ir.h +++ b/mesalib/src/glsl/ir.h @@ -1118,6 +1118,13 @@ enum ir_expression_operation { */ ir_last_binop = ir_binop_ubo_load, + ir_triop_lrp, + + /** + * A sentinel marking the last of the ternary operations. + */ + ir_last_triop = ir_triop_lrp, + ir_quadop_vector, /** @@ -1128,25 +1135,20 @@ enum ir_expression_operation { class ir_expression : public ir_rvalue { public: + ir_expression(int op, const struct glsl_type *type, + ir_rvalue *op0, ir_rvalue *op1 = NULL, + ir_rvalue *op2 = NULL, ir_rvalue *op3 = NULL); + /** * Constructor for unary operation expressions */ - ir_expression(int op, const struct glsl_type *type, ir_rvalue *); ir_expression(int op, ir_rvalue *); /** * Constructor for binary operation expressions */ - ir_expression(int op, const struct glsl_type *type, - ir_rvalue *, ir_rvalue *); ir_expression(int op, ir_rvalue *op0, ir_rvalue *op1); - /** - * Constructor for quad operator expressions - */ - ir_expression(int op, const struct glsl_type *type, - ir_rvalue *, ir_rvalue *, ir_rvalue *, ir_rvalue *); - virtual ir_expression *as_expression() { return this; @@ -1422,6 +1424,7 @@ enum ir_texture_opcode { ir_txl, /**< Texture look-up with explicit LOD */ ir_txd, /**< Texture look-up with partial derivatvies */ ir_txf, /**< Texel fetch with explicit LOD */ + ir_txf_ms, /**< Multisample texture fetch */ ir_txs /**< Texture size */ }; @@ -1443,6 +1446,8 @@ enum ir_texture_opcode { * (txl <type> <sampler> <coordinate> 0 1 ( ) <lod>) * (txd <type> <sampler> <coordinate> 0 1 ( ) (dPdx dPdy)) * (txf <type> <sampler> <coordinate> 0 <lod>) + * (txf_ms + * <type> <sampler> <coordinate> <sample_index>) * (txs <type> <sampler> <lod>) */ class ir_texture : public ir_rvalue { @@ -1509,6 +1514,7 @@ public: union { ir_rvalue *lod; /**< Floating point LOD */ ir_rvalue *bias; /**< Floating point LOD bias */ + ir_rvalue *sample_index; /**< MSAA sample index */ struct { ir_rvalue *dPdx; /**< Partial derivative of coordinate wrt X */ ir_rvalue *dPdy; /**< Partial derivative of coordinate wrt Y */ diff --git a/mesalib/src/glsl/ir_clone.cpp b/mesalib/src/glsl/ir_clone.cpp index b94ff05df..4797451d7 100644 --- a/mesalib/src/glsl/ir_clone.cpp +++ b/mesalib/src/glsl/ir_clone.cpp @@ -252,6 +252,9 @@ ir_texture::clone(void *mem_ctx, struct hash_table *ht) const case ir_txs: new_tex->lod_info.lod = this->lod_info.lod->clone(mem_ctx, ht); break; + case ir_txf_ms: + new_tex->lod_info.sample_index = this->lod_info.sample_index->clone(mem_ctx, ht); + break; case ir_txd: new_tex->lod_info.grad.dPdx = this->lod_info.grad.dPdx->clone(mem_ctx, ht); new_tex->lod_info.grad.dPdy = this->lod_info.grad.dPdy->clone(mem_ctx, ht); diff --git a/mesalib/src/glsl/ir_constant_expression.cpp b/mesalib/src/glsl/ir_constant_expression.cpp index 86b863f31..c2d0dc46c 100644 --- a/mesalib/src/glsl/ir_constant_expression.cpp +++ b/mesalib/src/glsl/ir_constant_expression.cpp @@ -1248,6 +1248,19 @@ ir_expression::constant_expression_value(struct hash_table *variable_context) } break; + case ir_triop_lrp: { + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(op[1]->type->base_type == GLSL_TYPE_FLOAT); + assert(op[2]->type->base_type == GLSL_TYPE_FLOAT); + + unsigned c2_inc = op[2]->type->is_scalar() ? 0 : 1; + for (unsigned c = 0, c2 = 0; c < components; c2 += c2_inc, c++) { + data.f[c] = op[0]->value.f[c] * (1.0f - op[2]->value.f[c2]) + + (op[1]->value.f[c] * op[2]->value.f[c2]); + } + break; + } + case ir_quadop_vector: for (unsigned c = 0; c < this->type->vector_elements; c++) { switch (this->type->base_type) { diff --git a/mesalib/src/glsl/ir_hv_accept.cpp b/mesalib/src/glsl/ir_hv_accept.cpp index 3ce895924..5fa75011e 100644 --- a/mesalib/src/glsl/ir_hv_accept.cpp +++ b/mesalib/src/glsl/ir_hv_accept.cpp @@ -226,6 +226,11 @@ ir_texture::accept(ir_hierarchical_visitor *v) if (s != visit_continue) return (s == visit_continue_with_parent) ? visit_continue : s; break; + case ir_txf_ms: + s = this->lod_info.sample_index->accept(v); + if (s != visit_continue) + return (s == visit_continue_with_parent) ? visit_continue : s; + break; case ir_txd: s = this->lod_info.grad.dPdx->accept(v); if (s != visit_continue) diff --git a/mesalib/src/glsl/ir_optimization.h b/mesalib/src/glsl/ir_optimization.h index 8f3301840..2454bbe6f 100644 --- a/mesalib/src/glsl/ir_optimization.h +++ b/mesalib/src/glsl/ir_optimization.h @@ -36,6 +36,7 @@ #define LOG_TO_LOG2 0x10 #define MOD_TO_FRACT 0x20 #define INT_DIV_TO_MUL_RCP 0x40 +#define LRP_TO_ARITH 0x80 /** * \see class lower_packing_builtins_visitor diff --git a/mesalib/src/glsl/ir_print_visitor.cpp b/mesalib/src/glsl/ir_print_visitor.cpp index acc92dbf1..3bdea9bbc 100644 --- a/mesalib/src/glsl/ir_print_visitor.cpp +++ b/mesalib/src/glsl/ir_print_visitor.cpp @@ -260,7 +260,7 @@ void ir_print_visitor::visit(ir_texture *ir) printf(" "); } - if (ir->op != ir_txf && ir->op != ir_txs) { + if (ir->op != ir_txf && ir->op != ir_txf_ms && ir->op != ir_txs) { if (ir->projector) ir->projector->accept(this); else @@ -287,6 +287,9 @@ void ir_print_visitor::visit(ir_texture *ir) case ir_txs: ir->lod_info.lod->accept(this); break; + case ir_txf_ms: + ir->lod_info.sample_index->accept(this); + break; case ir_txd: printf("("); ir->lod_info.grad.dPdx->accept(this); diff --git a/mesalib/src/glsl/ir_reader.cpp b/mesalib/src/glsl/ir_reader.cpp index 405e75b64..22ce03b0d 100644 --- a/mesalib/src/glsl/ir_reader.cpp +++ b/mesalib/src/glsl/ir_reader.cpp @@ -676,15 +676,16 @@ ir_reader::read_expression(s_expression *expr) { s_expression *s_type; s_symbol *s_op; - s_expression *s_arg1; + s_expression *s_arg[3]; - s_pattern pat[] = { "expression", s_type, s_op, s_arg1 }; + s_pattern pat[] = { "expression", s_type, s_op, s_arg[0] }; if (!PARTIAL_MATCH(expr, pat)) { ir_read_error(expr, "expected (expression <type> <operator> " "<operand> [<operand>])"); return NULL; } - s_expression *s_arg2 = (s_expression *) s_arg1->next; // may be tail sentinel + s_arg[1] = (s_expression *) s_arg[0]->next; // may be tail sentinel + s_arg[2] = (s_expression *) s_arg[1]->next; // may be tail sentinel or NULL const glsl_type *type = read_type(s_type); if (type == NULL) @@ -697,35 +698,27 @@ ir_reader::read_expression(s_expression *expr) return NULL; } - unsigned num_operands = ir_expression::get_num_operands(op); - if (num_operands == 1 && !s_arg1->next->is_tail_sentinel()) { - ir_read_error(expr, "expected (expression <type> %s <operand>)", - s_op->value()); + int num_operands = -3; /* skip "expression" <type> <operation> */ + foreach_list(n, &((s_list *) expr)->subexpressions) + ++num_operands; + + int expected_operands = ir_expression::get_num_operands(op); + if (num_operands != expected_operands) { + ir_read_error(expr, "found %d expression operands, expected %d", + num_operands, expected_operands); return NULL; } - ir_rvalue *arg1 = read_rvalue(s_arg1); - ir_rvalue *arg2 = NULL; - if (arg1 == NULL) { - ir_read_error(NULL, "when reading first operand of %s", s_op->value()); - return NULL; - } - - if (num_operands == 2) { - if (s_arg2->is_tail_sentinel() || !s_arg2->next->is_tail_sentinel()) { - ir_read_error(expr, "expected (expression <type> %s <operand> " - "<operand>)", s_op->value()); - return NULL; - } - arg2 = read_rvalue(s_arg2); - if (arg2 == NULL) { - ir_read_error(NULL, "when reading second operand of %s", - s_op->value()); - return NULL; + ir_rvalue *arg[3] = {NULL, NULL, NULL}; + for (int i = 0; i < num_operands; i++) { + arg[i] = read_rvalue(s_arg[i]); + if (arg[i] == NULL) { + ir_read_error(NULL, "when reading operand #%d of %s", i, s_op->value()); + return NULL; } } - return new(mem_ctx) ir_expression(op, type, arg1, arg2); + return new(mem_ctx) ir_expression(op, type, arg[0], arg[1], arg[2]); } ir_swizzle * @@ -918,6 +911,7 @@ ir_reader::read_texture(s_expression *expr) s_expression *s_proj = NULL; s_list *s_shadow = NULL; s_expression *s_lod = NULL; + s_expression *s_sample_index = NULL; ir_texture_opcode op = ir_tex; /* silence warning */ @@ -925,6 +919,8 @@ ir_reader::read_texture(s_expression *expr) { "tex", s_type, s_sampler, s_coord, s_offset, s_proj, s_shadow }; s_pattern txf_pattern[] = { "txf", s_type, s_sampler, s_coord, s_offset, s_lod }; + s_pattern txf_ms_pattern[] = + { "txf_ms", s_type, s_sampler, s_coord, s_sample_index }; s_pattern txs_pattern[] = { "txs", s_type, s_sampler, s_lod }; s_pattern other_pattern[] = @@ -934,6 +930,8 @@ ir_reader::read_texture(s_expression *expr) op = ir_tex; } else if (MATCH(expr, txf_pattern)) { op = ir_txf; + } else if (MATCH(expr, txf_ms_pattern)) { + op = ir_txf_ms; } else if (MATCH(expr, txs_pattern)) { op = ir_txs; } else if (MATCH(expr, other_pattern)) { @@ -973,18 +971,20 @@ ir_reader::read_texture(s_expression *expr) return NULL; } - // Read texel offset - either 0 or an rvalue. - s_int *si_offset = SX_AS_INT(s_offset); - if (si_offset == NULL || si_offset->value() != 0) { - tex->offset = read_rvalue(s_offset); - if (tex->offset == NULL) { - ir_read_error(s_offset, "expected 0 or an expression"); - return NULL; - } + if (op != ir_txf_ms) { + // Read texel offset - either 0 or an rvalue. + s_int *si_offset = SX_AS_INT(s_offset); + if (si_offset == NULL || si_offset->value() != 0) { + tex->offset = read_rvalue(s_offset); + if (tex->offset == NULL) { + ir_read_error(s_offset, "expected 0 or an expression"); + return NULL; + } + } } } - if (op != ir_txf && op != ir_txs) { + if (op != ir_txf && op != ir_txf_ms && op != ir_txs) { s_int *proj_as_int = SX_AS_INT(s_proj); if (proj_as_int && proj_as_int->value() == 1) { tex->projector = NULL; @@ -1027,6 +1027,13 @@ ir_reader::read_texture(s_expression *expr) return NULL; } break; + case ir_txf_ms: + tex->lod_info.sample_index = read_rvalue(s_sample_index); + if (tex->lod_info.sample_index == NULL) { + ir_read_error(NULL, "when reading sample_index in (txf_ms ...)"); + return NULL; + } + break; case ir_txd: { s_expression *s_dx, *s_dy; s_pattern dxdy_pat[] = { s_dx, s_dy }; diff --git a/mesalib/src/glsl/ir_rvalue_visitor.cpp b/mesalib/src/glsl/ir_rvalue_visitor.cpp index b34a419e8..543c54496 100644 --- a/mesalib/src/glsl/ir_rvalue_visitor.cpp +++ b/mesalib/src/glsl/ir_rvalue_visitor.cpp @@ -66,6 +66,9 @@ ir_rvalue_base_visitor::rvalue_visit(ir_texture *ir) case ir_txs: handle_rvalue(&ir->lod_info.lod); break; + case ir_txf_ms: + handle_rvalue(&ir->lod_info.sample_index); + break; case ir_txd: handle_rvalue(&ir->lod_info.grad.dPdx); handle_rvalue(&ir->lod_info.grad.dPdy); diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp index d8cafd55f..24ea506dc 100644 --- a/mesalib/src/glsl/ir_validate.cpp +++ b/mesalib/src/glsl/ir_validate.cpp @@ -468,6 +468,12 @@ ir_validate::visit_leave(ir_expression *ir) assert(ir->operands[1]->type == glsl_type::uint_type); break; + case ir_triop_lrp: + assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->operands[0]->type == ir->operands[1]->type); + assert(ir->operands[2]->type == ir->operands[0]->type || ir->operands[2]->type == glsl_type::float_type); + break; + case ir_quadop_vector: /* The vector operator collects some number of scalars and generates a * vector from them. diff --git a/mesalib/src/glsl/lower_instructions.cpp b/mesalib/src/glsl/lower_instructions.cpp index a8ef7654e..1ce7b7c9d 100644 --- a/mesalib/src/glsl/lower_instructions.cpp +++ b/mesalib/src/glsl/lower_instructions.cpp @@ -37,6 +37,7 @@ * - POW_TO_EXP2 * - LOG_TO_LOG2 * - MOD_TO_FRACT + * - LRP_TO_ARITH * * SUB_TO_ADD_NEG: * --------------- @@ -79,13 +80,20 @@ * Many GPUs don't have a MOD instruction (945 and 965 included), and * if we have to break it down like this anyway, it gives an * opportunity to do things like constant fold the (1.0 / op1) easily. + * + * LRP_TO_ARITH: + * ------------- + * Converts ir_triop_lrp to (op0 * (1.0f - op2)) + (op1 * op2). */ #include "main/core.h" /* for M_LOG2E */ #include "glsl_types.h" #include "ir.h" +#include "ir_builder.h" #include "ir_optimization.h" +using namespace ir_builder; + class lower_instructions_visitor : public ir_hierarchical_visitor { public: lower_instructions_visitor(unsigned lower) @@ -105,6 +113,7 @@ private: void exp_to_exp2(ir_expression *); void pow_to_exp2(ir_expression *); void log_to_log2(ir_expression *); + void lrp_to_arith(ir_expression *); }; /** @@ -268,6 +277,27 @@ lower_instructions_visitor::mod_to_fract(ir_expression *ir) this->progress = true; } +void +lower_instructions_visitor::lrp_to_arith(ir_expression *ir) +{ + /* (lrp x y a) -> x*(1-a) + y*a */ + + /* Save op2 */ + ir_variable *temp = new(ir) ir_variable(ir->operands[2]->type, "lrp_factor", + ir_var_temporary); + this->base_ir->insert_before(temp); + this->base_ir->insert_before(assign(temp, ir->operands[2])); + + ir_constant *one = new(ir) ir_constant(1.0f); + + ir->operation = ir_binop_add; + ir->operands[0] = mul(ir->operands[0], sub(one, temp)); + ir->operands[1] = mul(ir->operands[1], temp); + ir->operands[2] = NULL; + + this->progress = true; +} + ir_visitor_status lower_instructions_visitor::visit_leave(ir_expression *ir) { @@ -304,6 +334,11 @@ lower_instructions_visitor::visit_leave(ir_expression *ir) pow_to_exp2(ir); break; + case ir_triop_lrp: + if (lowering(LRP_TO_ARITH)) + lrp_to_arith(ir); + break; + default: return visit_continue; } diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp index 75948db16..70e016d22 100644 --- a/mesalib/src/glsl/opt_algebraic.cpp +++ b/mesalib/src/glsl/opt_algebraic.cpp @@ -186,12 +186,12 @@ ir_algebraic_visitor::swizzle_if_required(ir_expression *expr, ir_rvalue * ir_algebraic_visitor::handle_expression(ir_expression *ir) { - ir_constant *op_const[2] = {NULL, NULL}; - ir_expression *op_expr[2] = {NULL, NULL}; + ir_constant *op_const[3] = {NULL, NULL, NULL}; + ir_expression *op_expr[3] = {NULL, NULL, NULL}; ir_expression *temp; unsigned int i; - assert(ir->get_num_operands() <= 2); + assert(ir->get_num_operands() <= 3); for (i = 0; i < ir->get_num_operands(); i++) { if (ir->operands[i]->type->is_matrix()) return ir; @@ -415,6 +415,17 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) break; + case ir_triop_lrp: + /* Operands are (x, y, a). */ + if (is_vec_zero(op_const[2])) { + this->progress = true; + return swizzle_if_required(ir, ir->operands[0]); + } else if (is_vec_one(op_const[2])) { + this->progress = true; + return swizzle_if_required(ir, ir->operands[1]); + } + break; + default: break; } diff --git a/mesalib/src/glsl/opt_tree_grafting.cpp b/mesalib/src/glsl/opt_tree_grafting.cpp index 113abb7b0..985540196 100644 --- a/mesalib/src/glsl/opt_tree_grafting.cpp +++ b/mesalib/src/glsl/opt_tree_grafting.cpp @@ -285,6 +285,10 @@ ir_tree_grafting_visitor::visit_enter(ir_texture *ir) if (do_graft(&ir->lod_info.lod)) return visit_stop; break; + case ir_txf_ms: + if (do_graft(&ir->lod_info.sample_index)) + return visit_stop; + break; case ir_txd: if (do_graft(&ir->lod_info.grad.dPdx) || do_graft(&ir->lod_info.grad.dPdy)) diff --git a/mesalib/src/glsl/standalone_scaffolding.cpp b/mesalib/src/glsl/standalone_scaffolding.cpp index 0fb4f5b16..8c0091e84 100644 --- a/mesalib/src/glsl/standalone_scaffolding.cpp +++ b/mesalib/src/glsl/standalone_scaffolding.cpp @@ -102,6 +102,7 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api) ctx->Extensions.ARB_shading_language_packing = true; ctx->Extensions.OES_standard_derivatives = true; ctx->Extensions.ARB_texture_cube_map_array = true; + ctx->Extensions.ARB_texture_multisample = true; ctx->Const.GLSLVersion = 120; diff --git a/mesalib/src/mapi/glapi/gen/ARB_texture_multisample.xml b/mesalib/src/mapi/glapi/gen/ARB_texture_multisample.xml new file mode 100644 index 000000000..f0dd4f5f7 --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/ARB_texture_multisample.xml @@ -0,0 +1,69 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<!-- Note: no GLX protocol info yet. --> + +<OpenGLAPI> + +<category name="GL_ARB_texture_multisample" number="67"> + + <enum name="SAMPLE_POSITION" value="0x8E50"/> + <enum name="SAMPLE_MASK" value="0x8E51"/> + <enum name="SAMPLE_MASK_VALUE" value="0x8E52"/> + + <enum name="TEXTURE_2D_MULTISAMPLE" value="0x9100"/> + <enum name="PROXY_TEXTURE_2D_MULTISAMPLE" value="0x9101"/> + <enum name="TEXTURE_2D_MULTISAMPLE_ARRAY" value="0x9102"/> + <enum name="PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY" value="0x9103"/> + + <enum name="MAX_SAMPLE_MASK_WORDS" value="0x8E59"/> + <enum name="MAX_COLOR_TEXTURE_SAMPLES" value="0x910E"/> + <enum name="MAX_DEPTH_TEXTURE_SAMPLES" value="0x910F"/> + <enum name="MAX_INTEGER_SAMPLES" value="0x9110"/> + + <enum name="TEXTURE_BINDING_2D_MULTISAMPLE" value="0x9104"/> + <enum name="TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY" value="0x9105"/> + + <enum name="TEXTURE_SAMPLES" value="0x9106"/> + <enum name="TEXTURE_FIXED_SAMPLE_LOCATIONS" value="0x9107"/> + + <enum name="SAMPLER_2D_MULTISAMPLE" value="0x9108"/> + <enum name="INT_SAMPLER_2D_MULTISAMPLE" value="0x9109"/> + <enum name="UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE" value="0x910A"/> + <enum name="SAMPLER_2D_MULTISAMPLE_ARRAY" value="0x910B"/> + <enum name="INT_SAMPLER_2D_MULTISAMPLE_ARRAY" value="0x910C"/> + <enum name="UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY" value="0x910D"/> + + <function name="TexImage2DMultisample" offset="assign"> + <param name="target" type="GLenum"/> + <param name="samples" type="GLsizei"/> + <param name="internalformat" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="fixedsamplelocations" type="GLboolean"/> + </function> + + <function name="TexImage3DMultisample" offset="assign"> + <param name="target" type="GLenum"/> + <param name="samples" type="GLsizei"/> + <param name="internalformat" type="GLint"/> + <param name="width" type="GLsizei"/> + <param name="height" type="GLsizei"/> + <param name="depth" type="GLsizei"/> + <param name="fixedsamplelocations" type="GLboolean"/> + </function> + + <function name="GetMultisamplefv" offset="assign"> + <param name="pname" type="GLenum"/> + <param name="index" type="GLuint"/> + <param name="val" type="GLfloat *"/> + </function> + + <function name="SampleMaski" offset="assign"> + <param name="index" type="GLuint"/> + <param name="mask" type="GLbitfield"/> + </function> + +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml index 4cbd72462..75957dc7d 100644 --- a/mesalib/src/mapi/glapi/gen/gl_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_API.xml @@ -8179,7 +8179,8 @@ <xi:include href="ARB_sync.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> -<!-- 67. GL_ARB_texture_multisample --> +<xi:include href="ARB_texture_multisample.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> + <!-- 68. GL_ARB_vertex_array_bgra --> <xi:include href="ARB_draw_buffers_blend.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c index 43c9de97f..731d46658 100644 --- a/mesalib/src/mesa/drivers/common/driverfuncs.c +++ b/mesalib/src/mesa/drivers/common/driverfuncs.c @@ -209,6 +209,9 @@ _mesa_init_driver_functions(struct dd_function_table *driver) /* GL_ARB_texture_storage */ driver->AllocTextureStorage = _swrast_AllocTextureStorage; + + /* GL_ARB_texture_multisample */ + driver->GetSamplePosition = NULL; } diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c index a95128328..3b991bcac 100644 --- a/mesalib/src/mesa/main/attrib.c +++ b/mesalib/src/mesa/main/attrib.c @@ -130,6 +130,9 @@ struct gl_enable_attrib GLboolean VertexProgramPointSize; GLboolean VertexProgramTwoSide; + /* GL_ARB_fragment_program */ + GLboolean FragmentProgram; + /* GL_ARB_point_sprite / GL_NV_point_sprite */ GLboolean PointSprite; GLboolean FragmentShaderATI; @@ -316,6 +319,10 @@ _mesa_PushAttrib(GLbitfield mask) attr->VertexProgram = ctx->VertexProgram.Enabled; attr->VertexProgramPointSize = ctx->VertexProgram.PointSizeEnabled; attr->VertexProgramTwoSide = ctx->VertexProgram.TwoSideEnabled; + + /* GL_ARB_fragment_program */ + attr->FragmentProgram = ctx->FragmentProgram.Enabled; + save_attrib_data(&head, GL_ENABLE_BIT, attr); /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */ @@ -607,6 +614,11 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable) enable->VertexProgramTwoSide, GL_VERTEX_PROGRAM_TWO_SIDE_ARB); + /* GL_ARB_fragment_program */ + TEST_AND_UPDATE(ctx->FragmentProgram.Enabled, + enable->FragmentProgram, + GL_FRAGMENT_PROGRAM_ARB); + /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */ TEST_AND_UPDATE(ctx->Color.sRGBEnabled, enable->sRGBEnabled, GL_FRAMEBUFFER_SRGB); @@ -767,6 +779,9 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate) continue; else if (obj->Target == GL_TEXTURE_EXTERNAL_OES) continue; + else if (obj->Target == GL_TEXTURE_2D_MULTISAMPLE || + obj->Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) + continue; target = obj->Target; diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index 02acfc2aa..cdcf7adfa 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -661,6 +661,11 @@ _mesa_init_constants(struct gl_context *ctx) /* ES 3.0 or ARB_ES3_compatibility */ ctx->Const.MaxElementIndex = 0xffffffffu; + + /* GL_ARB_texture_multisample */ + ctx->Const.MaxColorTextureSamples = 1; + ctx->Const.MaxDepthTextureSamples = 1; + ctx->Const.MaxIntegerSamples = 1; } diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h index 9c818ccd8..4860d4d12 100644 --- a/mesalib/src/mesa/main/dd.h +++ b/mesalib/src/mesa/main/dd.h @@ -638,6 +638,7 @@ struct dd_function_table { struct gl_query_object * (*NewQueryObject)(struct gl_context *ctx, GLuint id); void (*DeleteQuery)(struct gl_context *ctx, struct gl_query_object *q); void (*BeginQuery)(struct gl_context *ctx, struct gl_query_object *q); + void (*QueryCounter)(struct gl_context *ctx, struct gl_query_object *q); void (*EndQuery)(struct gl_context *ctx, struct gl_query_object *q); void (*CheckQuery)(struct gl_context *ctx, struct gl_query_object *q); void (*WaitQuery)(struct gl_context *ctx, struct gl_query_object *q); @@ -833,6 +834,14 @@ struct dd_function_table { * This should be equivalent to glGetInteger64v(GL_TIMESTAMP); */ uint64_t (*GetTimestamp)(struct gl_context *ctx); + + /** + * \name GL_ARB_texture_multisample + */ + void (*GetSamplePosition)(struct gl_context *ctx, + struct gl_framebuffer *fb, + GLuint index, + GLfloat *outValue); }; diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c index 7e85fdfb3..b688f050b 100644 --- a/mesalib/src/mesa/main/enable.c +++ b/mesalib/src/mesa/main/enable.c @@ -1013,6 +1013,17 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) } break; + /* ARB_texture_multisample */ + case GL_SAMPLE_MASK: + if (!_mesa_is_desktop_gl(ctx)) + goto invalid_enum_error; + CHECK_EXTENSION(ARB_texture_multisample, cap); + if (ctx->Multisample.SampleMask == state) + return; + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.SampleMask = state; + break; + default: goto invalid_enum_error; } @@ -1583,6 +1594,13 @@ _mesa_IsEnabled( GLenum cap ) CHECK_EXTENSION(OES_EGL_image_external); return is_texture_enabled(ctx, TEXTURE_EXTERNAL_BIT); + /* ARB_texture_multisample */ + case GL_SAMPLE_MASK: + if (!_mesa_is_desktop_gl(ctx)) + goto invalid_enum_error; + CHECK_EXTENSION(ARB_texture_multisample); + return ctx->Multisample.SampleMask; + default: goto invalid_enum_error; } diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index 89bc57509..d6acc5896 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -745,6 +745,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, GLenum intFormat = GL_NONE; /* color buffers' internal format */ GLuint minWidth = ~0, minHeight = ~0, maxWidth = 0, maxHeight = 0; GLint numSamples = -1; + GLint fixedSampleLocations = -1; GLint i; GLuint j; @@ -814,12 +815,29 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, f = texImg->_BaseFormat; attFormat = texImg->TexFormat; numImages++; + if (!is_format_color_renderable(ctx, attFormat, texImg->InternalFormat) && !is_legal_depth_format(ctx, f)) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT; fbo_incomplete("texture attachment incomplete", -1); return; } + + if (numSamples < 0) + numSamples = texImg->NumSamples; + else if (numSamples != texImg->NumSamples) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE; + fbo_incomplete("inconsistent sample count", -1); + return; + } + + if (fixedSampleLocations < 0) + fixedSampleLocations = texImg->FixedSampleLocations; + else if (fixedSampleLocations != texImg->FixedSampleLocations) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE; + fbo_incomplete("inconsistent fixed sample locations", -1); + return; + } } else if (att->Type == GL_RENDERBUFFER_EXT) { minWidth = MIN2(minWidth, att->Renderbuffer->Width); @@ -829,24 +847,35 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, f = att->Renderbuffer->InternalFormat; attFormat = att->Renderbuffer->Format; numImages++; + + if (numSamples < 0) + numSamples = att->Renderbuffer->NumSamples; + else if (numSamples != att->Renderbuffer->NumSamples) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE; + fbo_incomplete("inconsistent sample count", -1); + return; + } + + /* RENDERBUFFER has fixedSampleLocations implicitly true */ + if (fixedSampleLocations < 0) + fixedSampleLocations = GL_TRUE; + else if (fixedSampleLocations != GL_TRUE) { + fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE; + fbo_incomplete("inconsistent fixed sample locations", -1); + return; + } } else { assert(att->Type == GL_NONE); continue; } - if (att->Renderbuffer && numSamples < 0) { - /* first buffer */ - numSamples = att->Renderbuffer->NumSamples; - } - /* check if integer color */ fb->_IntegerColor = _mesa_is_format_integer_color(attFormat); - /* Error-check width, height, format, samples - */ + /* Error-check width, height, format */ if (numImages == 1) { - /* save format, num samples */ + /* save format */ if (i >= 0) { intFormat = f; } @@ -866,12 +895,6 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, return; } } - if (att->Renderbuffer && - att->Renderbuffer->NumSamples != numSamples) { - fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE; - fbo_incomplete("inconsistant number of samples", i); - return; - } } /* Check that the format is valid. (MESA_FORMAT_NONE means unsupported) @@ -2069,7 +2092,8 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, err = (texObj->Target != GL_TEXTURE_3D) && (texObj->Target != GL_TEXTURE_1D_ARRAY_EXT) && (texObj->Target != GL_TEXTURE_2D_ARRAY_EXT) && - (texObj->Target != GL_TEXTURE_CUBE_MAP_ARRAY); + (texObj->Target != GL_TEXTURE_CUBE_MAP_ARRAY) && + (texObj->Target != GL_TEXTURE_2D_MULTISAMPLE_ARRAY); } else { /* Make sure textarget is consistent with the texture's type */ @@ -2103,7 +2127,8 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, } else if ((texObj->Target == GL_TEXTURE_1D_ARRAY_EXT) || (texObj->Target == GL_TEXTURE_2D_ARRAY_EXT) || - (texObj->Target == GL_TEXTURE_CUBE_MAP_ARRAY)) { + (texObj->Target == GL_TEXTURE_CUBE_MAP_ARRAY) || + (texObj->Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)) { if (zoffset < 0 || zoffset >= (GLint) ctx->Const.MaxArrayTextureLayers) { _mesa_error(ctx, GL_INVALID_VALUE, @@ -2255,6 +2280,11 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum attachment, error = (_mesa_is_gles(ctx) && ctx->Version < 30) || !ctx->Extensions.EXT_texture_array; break; + case GL_TEXTURE_2D_MULTISAMPLE: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + error = _mesa_is_gles(ctx) + || !ctx->Extensions.ARB_texture_multisample; + break; default: error = GL_TRUE; } diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index da1e01cb5..2399f9c9d 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -354,6 +354,7 @@ EXTRA_EXT(ARB_timer_query); EXTRA_EXT(ARB_map_buffer_alignment); EXTRA_EXT(ARB_texture_cube_map_array); EXTRA_EXT(ARB_texture_buffer_range); +EXTRA_EXT(ARB_texture_multisample); static const int extra_NV_primitive_restart[] = { @@ -693,6 +694,8 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu case GL_TEXTURE_BINDING_RECTANGLE_NV: case GL_TEXTURE_BINDING_EXTERNAL_OES: case GL_TEXTURE_BINDING_CUBE_MAP_ARRAY: + case GL_TEXTURE_BINDING_2D_MULTISAMPLE: + case GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY: unit = ctx->Texture.CurrentUnit; v->value_int = ctx->Texture.Unit[unit].CurrentTex[d->offset]->Name; @@ -1632,6 +1635,15 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v) goto invalid_enum; v->value_int = ctx->UniformBufferBindings[index].Size; return TYPE_INT; + + /* ARB_texture_multisample / GL3.2 */ + case GL_SAMPLE_MASK_VALUE: + if (index != 0) + goto invalid_value; + if (!ctx->Extensions.ARB_texture_multisample) + goto invalid_enum; + v->value_int = ctx->Multisample.SampleMaskValue; + return TYPE_INT; } invalid_enum: diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py index 1b7d6ad8e..5022ddc40 100644 --- a/mesalib/src/mesa/main/get_hash_params.py +++ b/mesalib/src/mesa/main/get_hash_params.py @@ -658,6 +658,16 @@ descriptor=[ [ "TEXTURE_BUFFER_FORMAT_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ], [ "TEXTURE_BUFFER_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_texture_buffer_object" ], +# GL_ARB_texture_multisample / GL 3.2 + [ "TEXTURE_BINDING_2D_MULTISAMPLE", "LOC_CUSTOM, TYPE_INT, TEXTURE_2D_MULTISAMPLE_INDEX, extra_ARB_texture_multisample" ], + [ "TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY", "LOC_CUSTOM, TYPE_INT, TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX, extra_ARB_texture_multisample" ], + [ "MAX_COLOR_TEXTURE_SAMPLES", "CONTEXT_INT(Const.MaxColorTextureSamples), extra_ARB_texture_multisample" ], + [ "MAX_DEPTH_TEXTURE_SAMPLES", "CONTEXT_INT(Const.MaxDepthTextureSamples), extra_ARB_texture_multisample" ], + [ "MAX_INTEGER_SAMPLES", "CONTEXT_INT(Const.MaxIntegerSamples), extra_ARB_texture_multisample" ], + [ "SAMPLE_MASK", "CONTEXT_BOOL(Multisample.SampleMask), extra_ARB_texture_multisample" ], + [ "MAX_SAMPLE_MASK_WORDS", "CONST(1), extra_ARB_texture_multisample" ], + + # GL_ARB_sampler_objects / GL 3.3 [ "SAMPLER_BINDING", "LOC_CUSTOM, TYPE_INT, GL_SAMPLER_BINDING, NO_EXTRA" ], diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index b92f98e7d..a80944c81 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -993,6 +993,12 @@ struct gl_multisample_attrib GLboolean SampleCoverage; GLfloat SampleCoverageValue; GLboolean SampleCoverageInvert; + + /* ARB_texture_multisample / GL3.2 additions */ + GLboolean SampleMask; + GLbitfield SampleMaskValue; /* GL spec defines this as an array but >32x MSAA is + * madness + */ }; @@ -1148,6 +1154,8 @@ struct gl_stencil_attrib */ typedef enum { + TEXTURE_2D_MULTISAMPLE_INDEX, + TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX, TEXTURE_CUBE_ARRAY_INDEX, TEXTURE_BUFFER_INDEX, TEXTURE_2D_ARRAY_INDEX, @@ -1167,6 +1175,8 @@ typedef enum * Used for Texture.Unit[]._ReallyEnabled flags. */ /*@{*/ +#define TEXTURE_2D_MULTISAMPLE_BIT (1 << TEXTURE_2D_MULTISAMPLE_INDEX) +#define TEXTURE_2D_MULTISAMPLE_ARRAY_BIT (1 << TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX) #define TEXTURE_CUBE_ARRAY_BIT (1 << TEXTURE_CUBE_ARRAY_INDEX) #define TEXTURE_BUFFER_BIT (1 << TEXTURE_BUFFER_INDEX) #define TEXTURE_2D_ARRAY_BIT (1 << TEXTURE_2D_ARRAY_INDEX) @@ -1212,6 +1222,10 @@ struct gl_texture_image GLuint Level; /**< Which mipmap level am I? */ /** Cube map face: index into gl_texture_object::Image[] array */ GLuint Face; + + /** GL_ARB_texture_multisample */ + GLuint NumSamples; /**< Sample count, or 0 for non-multisample */ + GLboolean FixedSampleLocations; /**< Same sample locations for all pixels? */ }; @@ -3027,6 +3041,11 @@ struct gl_constants * backslash character ('\') in GLSL source. */ GLboolean DisableGLSLLineContinuations; + + /** GL_ARB_texture_multisample */ + GLint MaxColorTextureSamples; + GLint MaxDepthTextureSamples; + GLint MaxIntegerSamples; }; diff --git a/mesalib/src/mesa/main/multisample.c b/mesalib/src/mesa/main/multisample.c index f792ad01e..248494615 100644 --- a/mesalib/src/mesa/main/multisample.c +++ b/mesalib/src/mesa/main/multisample.c @@ -28,6 +28,7 @@ #include "main/macros.h" #include "main/multisample.h" #include "main/mtypes.h" +#include "main/fbobject.h" /** @@ -59,4 +60,55 @@ _mesa_init_multisample(struct gl_context *ctx) ctx->Multisample.SampleCoverage = GL_FALSE; ctx->Multisample.SampleCoverageValue = 1.0; ctx->Multisample.SampleCoverageInvert = GL_FALSE; + + /* ARB_texture_multisample / GL3.2 additions */ + ctx->Multisample.SampleMask = GL_FALSE; + ctx->Multisample.SampleMaskValue = ~(GLbitfield)0; +} + + +void GLAPIENTRY +_mesa_GetMultisamplefv(GLenum pname, GLuint index, GLfloat * val) +{ + GET_CURRENT_CONTEXT(ctx); + + switch (pname) { + case GL_SAMPLE_POSITION: { + if (index >= ctx->DrawBuffer->Visual.samples) { + _mesa_error( ctx, GL_INVALID_VALUE, "glGetMultisamplefv(index)" ); + return; + } + + ctx->Driver.GetSamplePosition(ctx, ctx->DrawBuffer, index, val); + + /* winsys FBOs are upside down */ + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) + val[1] = 1 - val[1]; + + return; + } + + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glGetMultisamplefv(pname)" ); + return; + } +} + +void GLAPIENTRY +_mesa_SampleMaski(GLuint index, GLbitfield mask) +{ + GET_CURRENT_CONTEXT(ctx); + + if (!ctx->Extensions.ARB_texture_multisample) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleMaski"); + return; + } + + if (index != 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glSampleMaski(index)"); + return; + } + + FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); + ctx->Multisample.SampleMaskValue = mask; } diff --git a/mesalib/src/mesa/main/multisample.h b/mesalib/src/mesa/main/multisample.h index 30726c34c..9e6b8e0d3 100644 --- a/mesalib/src/mesa/main/multisample.h +++ b/mesalib/src/mesa/main/multisample.h @@ -38,4 +38,10 @@ extern void _mesa_init_multisample(struct gl_context *ctx); +extern void GLAPIENTRY +_mesa_GetMultisamplefv(GLenum pname, GLuint index, GLfloat* val); + +extern void GLAPIENTRY +_mesa_SampleMaski(GLuint index, GLbitfield mask); + #endif diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c index d0c5a2543..f0db740fd 100644 --- a/mesalib/src/mesa/main/queryobj.c +++ b/mesalib/src/mesa/main/queryobj.c @@ -486,9 +486,14 @@ _mesa_QueryCounter(GLuint id, GLenum target) q->Result = 0; q->Ready = GL_FALSE; - /* QueryCounter is implemented using EndQuery without BeginQuery - * in drivers. This is actually Direct3D and Gallium convention. */ - ctx->Driver.EndQuery(ctx, q); + if (ctx->Driver.QueryCounter) { + ctx->Driver.QueryCounter(ctx, q); + } else { + /* QueryCounter is implemented using EndQuery without BeginQuery + * in drivers. This is actually Direct3D and Gallium convention. + */ + ctx->Driver.EndQuery(ctx, q); + } } diff --git a/mesalib/src/mesa/main/shared.c b/mesalib/src/mesa/main/shared.c index a98a45c75..408125998 100644 --- a/mesalib/src/mesa/main/shared.c +++ b/mesalib/src/mesa/main/shared.c @@ -92,6 +92,8 @@ _mesa_alloc_shared_state(struct gl_context *ctx) for (i = 0; i < NUM_TEXTURE_TARGETS; i++) { /* NOTE: the order of these enums matches the TEXTURE_x_INDEX values */ static const GLenum targets[] = { + GL_TEXTURE_2D_MULTISAMPLE, + GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_BUFFER, GL_TEXTURE_2D_ARRAY_EXT, diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index f0de0fb49..0dcf88ae4 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -661,7 +661,7 @@ _mesa_is_proxy_texture(GLenum target) * NUM_TEXTURE_TARGETS should match number of terms below, except there's no * proxy for GL_TEXTURE_BUFFER and GL_TEXTURE_EXTERNAL_OES. */ - assert(NUM_TEXTURE_TARGETS == 8 + 2); + assert(NUM_TEXTURE_TARGETS == 10 + 2); return (target == GL_PROXY_TEXTURE_1D || target == GL_PROXY_TEXTURE_2D || @@ -670,7 +670,9 @@ _mesa_is_proxy_texture(GLenum target) target == GL_PROXY_TEXTURE_RECTANGLE_NV || target == GL_PROXY_TEXTURE_1D_ARRAY_EXT || target == GL_PROXY_TEXTURE_2D_ARRAY_EXT || - target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY); + target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY || + target == GL_PROXY_TEXTURE_2D_MULTISAMPLE || + target == GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY); } @@ -711,6 +713,12 @@ _mesa_get_proxy_target(GLenum target) case GL_TEXTURE_CUBE_MAP_ARRAY: case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: return GL_PROXY_TEXTURE_CUBE_MAP_ARRAY; + case GL_TEXTURE_2D_MULTISAMPLE: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE: + return GL_PROXY_TEXTURE_2D_MULTISAMPLE; + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: + return GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY; default: _mesa_problem(NULL, "unexpected target in _mesa_get_proxy_target()"); return 0; @@ -788,6 +796,18 @@ _mesa_select_tex_object(struct gl_context *ctx, case GL_TEXTURE_EXTERNAL_OES: return ctx->Extensions.OES_EGL_image_external ? texUnit->CurrentTex[TEXTURE_EXTERNAL_INDEX] : NULL; + case GL_TEXTURE_2D_MULTISAMPLE: + return ctx->Extensions.ARB_texture_multisample + ? texUnit->CurrentTex[TEXTURE_2D_MULTISAMPLE_INDEX] : NULL; + case GL_PROXY_TEXTURE_2D_MULTISAMPLE: + return ctx->Extensions.ARB_texture_multisample + ? ctx->Texture.ProxyTex[TEXTURE_2D_MULTISAMPLE_INDEX] : NULL; + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + return ctx->Extensions.ARB_texture_multisample + ? texUnit->CurrentTex[TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX] : NULL; + case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: + return ctx->Extensions.ARB_texture_multisample + ? ctx->Texture.ProxyTex[TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX] : NULL; default: _mesa_problem(NULL, "bad target in _mesa_select_tex_object()"); return NULL; @@ -918,6 +938,16 @@ get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level) return NULL; texIndex = TEXTURE_CUBE_ARRAY_INDEX; break; + case GL_PROXY_TEXTURE_2D_MULTISAMPLE: + if (level > 0) + return 0; + texIndex = TEXTURE_2D_MULTISAMPLE_INDEX; + break; + case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: + if (level > 0) + return 0; + texIndex = TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX; + break; default: return NULL; } @@ -987,6 +1017,13 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target) case GL_TEXTURE_BUFFER: return ctx->API == API_OPENGL_CORE && ctx->Extensions.ARB_texture_buffer_object ? 1 : 0; + case GL_TEXTURE_2D_MULTISAMPLE: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: + return _mesa_is_desktop_gl(ctx) + && ctx->Extensions.ARB_texture_multisample + ? 1 : 0; case GL_TEXTURE_EXTERNAL_OES: /* fall-through */ default: @@ -1020,6 +1057,8 @@ _mesa_get_texture_dimensions(GLenum target) case GL_TEXTURE_1D_ARRAY: case GL_PROXY_TEXTURE_1D_ARRAY: case GL_TEXTURE_EXTERNAL_OES: + case GL_TEXTURE_2D_MULTISAMPLE: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE: return 2; case GL_TEXTURE_3D: case GL_PROXY_TEXTURE_3D: @@ -1027,6 +1066,8 @@ _mesa_get_texture_dimensions(GLenum target) case GL_PROXY_TEXTURE_2D_ARRAY: case GL_TEXTURE_CUBE_MAP_ARRAY: case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: return 3; case GL_TEXTURE_BUFFER: /* fall-through */ @@ -1068,6 +1109,8 @@ _mesa_get_tex_max_num_levels(GLenum target, GLsizei width, GLsizei height, break; case GL_TEXTURE_RECTANGLE: case GL_TEXTURE_EXTERNAL_OES: + case GL_TEXTURE_2D_MULTISAMPLE: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: return 1; default: assert(0); @@ -1153,6 +1196,8 @@ clear_teximage_fields(struct gl_texture_image *img) img->HeightLog2 = 0; img->DepthLog2 = 0; img->TexFormat = MESA_FORMAT_NONE; + img->NumSamples = 0; + img->FixedSampleLocations = GL_TRUE; } @@ -1196,6 +1241,9 @@ _mesa_init_teximage_fields(struct gl_context *ctx, img->Width2 = width - 2 * border; /* == 1 << img->WidthLog2; */ img->WidthLog2 = _mesa_logbase2(img->Width2); + img->NumSamples = 0; + img->FixedSampleLocations = GL_TRUE; + switch(target) { case GL_TEXTURE_1D: case GL_TEXTURE_BUFFER: @@ -1234,6 +1282,8 @@ _mesa_init_teximage_fields(struct gl_context *ctx, case GL_PROXY_TEXTURE_2D: case GL_PROXY_TEXTURE_RECTANGLE: case GL_PROXY_TEXTURE_CUBE_MAP: + case GL_TEXTURE_2D_MULTISAMPLE: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE: img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */ img->HeightLog2 = _mesa_logbase2(img->Height2); if (depth == 0) @@ -1246,6 +1296,8 @@ _mesa_init_teximage_fields(struct gl_context *ctx, case GL_PROXY_TEXTURE_2D_ARRAY: case GL_TEXTURE_CUBE_MAP_ARRAY: case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */ img->HeightLog2 = _mesa_logbase2(img->Height2); img->Depth2 = depth; /* no border */ @@ -1317,6 +1369,8 @@ _mesa_legal_texture_dimensions(struct gl_context *ctx, GLenum target, case GL_TEXTURE_2D: case GL_PROXY_TEXTURE_2D: + case GL_TEXTURE_2D_MULTISAMPLE: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE: maxSize = 1 << (ctx->Const.MaxTextureLevels - 1); maxSize >>= level; if (width < 2 * border || width > 2 * border + maxSize) @@ -1399,6 +1453,8 @@ _mesa_legal_texture_dimensions(struct gl_context *ctx, GLenum target, case GL_TEXTURE_2D_ARRAY_EXT: case GL_PROXY_TEXTURE_2D_ARRAY_EXT: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: maxSize = 1 << (ctx->Const.MaxTextureLevels - 1); maxSize >>= level; if (width < 2 * border || width > 2 * border + maxSize) @@ -4102,3 +4158,183 @@ _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer, texbufferrange(ctx, target, internalFormat, bufObj, offset, size); } + +static GLboolean +is_renderable_texture_format(struct gl_context *ctx, GLenum internalformat) +{ + /* Everything that is allowed for renderbuffers, + * except for a base format of GL_STENCIL_INDEX. + */ + GLenum baseFormat = _mesa_base_fbo_format(ctx, internalformat); + return baseFormat != 0 && baseFormat != GL_STENCIL_INDEX; +} + +/** GL_ARB_texture_multisample */ +static GLboolean +check_multisample_target(GLuint dims, GLenum target) +{ + switch(target) { + case GL_TEXTURE_2D_MULTISAMPLE: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE: + return dims == 2; + + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: + return dims == 3; + + default: + return GL_FALSE; + } +} + +static void +teximagemultisample(GLuint dims, GLenum target, GLsizei samples, + GLint internalformat, GLsizei width, GLsizei height, + GLsizei depth, GLboolean fixedsamplelocations) +{ + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLboolean sizeOK, dimensionsOK; + gl_format texFormat; + + GET_CURRENT_CONTEXT(ctx); + + if (!(ctx->Extensions.ARB_texture_multisample + && _mesa_is_desktop_gl(ctx))) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glTexImage%uDMultisample", dims); + return; + } + + if (!check_multisample_target(dims, target)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage%uDMultisample(target)", dims); + return; + } + + /* check that the specified internalformat is color/depth/stencil-renderable; + * refer GL3.1 spec 4.4.4 + */ + + if (!is_renderable_texture_format(ctx, internalformat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexImage%uDMultisample(internalformat=%s)", + dims, + _mesa_lookup_enum_by_nr(internalformat)); + return; + } + + if (_mesa_is_enum_format_integer(internalformat)) { + if (samples > ctx->Const.MaxIntegerSamples) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexImage%uDMultisample(samples>GL_MAX_INTEGER_SAMPLES)", + dims); + return; + } + } + else if (_mesa_is_depth_or_stencil_format(internalformat)) { + if (samples > ctx->Const.MaxDepthTextureSamples) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexImage%uDMultisample(samples>GL_MAX_DEPTH_TEXTURE_SAMPLES)", + dims); + return; + } + } + else { + if (samples > ctx->Const.MaxColorTextureSamples) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTexImage%uDMultisample(samples>GL_MAX_COLOR_TEXTURE_SAMPLES)", + dims); + return; + } + } + + /* TODO: should ask the driver for the exact limit for this internalformat + * once IDR's internalformat_query bits land + */ + + texObj = _mesa_get_current_tex_object(ctx, target); + texImage = _mesa_get_tex_image(ctx, texObj, 0, 0); + + if (texImage == NULL) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uDMultisample()", dims); + return; + } + + texFormat = _mesa_choose_texture_format(ctx, texObj, target, 0, + internalformat, GL_NONE, GL_NONE); + assert(texFormat != MESA_FORMAT_NONE); + + dimensionsOK = _mesa_legal_texture_dimensions(ctx, target, 0, + width, height, depth, 0); + + sizeOK = ctx->Driver.TestProxyTexImage(ctx, target, 0, texFormat, + width, height, depth, 0); + + if (_mesa_is_proxy_texture(target)) { + if (dimensionsOK && sizeOK) { + _mesa_init_teximage_fields(ctx, texImage, + width, height, depth, 0, internalformat, texFormat); + texImage->NumSamples = samples; + texImage->FixedSampleLocations = fixedsamplelocations; + } + else { + /* clear all image fields */ + _mesa_init_teximage_fields(ctx, texImage, + 0, 0, 0, 0, GL_NONE, MESA_FORMAT_NONE); + } + } + else { + if (!dimensionsOK) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage%uDMultisample(invalid width or height)", dims); + return; + } + + if (!sizeOK) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, + "glTexImage%uDMultisample(texture too large)", dims); + return; + } + + ctx->Driver.FreeTextureImageBuffer(ctx, texImage); + + _mesa_init_teximage_fields(ctx, texImage, + width, height, depth, 0, internalformat, texFormat); + + texImage->NumSamples = samples; + texImage->FixedSampleLocations = fixedsamplelocations; + + if (width > 0 && height > 0 && depth > 0) { + + if (!ctx->Driver.AllocTextureStorage(ctx, texObj, 1, + width, height, depth)) { + /* tidy up the texture image state. strictly speaking, + * we're allowed to just leave this in whatever state we + * like, but being tidy is good. + */ + _mesa_init_teximage_fields(ctx, texImage, + 0, 0, 0, 0, GL_NONE, MESA_FORMAT_NONE); + } + } + + _mesa_update_fbo_texture(ctx, texObj, 0, 0); + } +} + +void GLAPIENTRY +_mesa_TexImage2DMultisample(GLenum target, GLsizei samples, + GLint internalformat, GLsizei width, + GLsizei height, GLboolean fixedsamplelocations) +{ + teximagemultisample(2, target, samples, internalformat, + width, height, 1, fixedsamplelocations); +} + +void GLAPIENTRY +_mesa_TexImage3DMultisample(GLenum target, GLsizei samples, + GLint internalformat, GLsizei width, + GLsizei height, GLsizei depth, + GLboolean fixedsamplelocations) +{ + teximagemultisample(3, target, samples, internalformat, + width, height, depth, fixedsamplelocations); +} diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h index 7124cac52..744c47a8a 100644 --- a/mesalib/src/mesa/main/teximage.h +++ b/mesalib/src/mesa/main/teximage.h @@ -294,6 +294,17 @@ _mesa_TexBufferRange(GLenum target, GLenum internalFormat, GLuint buffer, GLintptr offset, GLsizeiptr size); +extern void GLAPIENTRY +_mesa_TexImage2DMultisample(GLenum target, GLsizei samples, + GLint internalformat, GLsizei width, + GLsizei height, GLboolean fixedsamplelocations); + +extern void GLAPIENTRY +_mesa_TexImage3DMultisample(GLenum target, GLsizei samples, + GLint internalformat, GLsizei width, + GLsizei height, GLsizei depth, + GLboolean fixedsamplelocations); + /*@}*/ #ifdef __cplusplus diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index e99b0dc38..66377c8c0 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -109,7 +109,9 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, target == GL_TEXTURE_2D_ARRAY_EXT || target == GL_TEXTURE_EXTERNAL_OES || target == GL_TEXTURE_CUBE_MAP_ARRAY || - target == GL_TEXTURE_BUFFER); + target == GL_TEXTURE_BUFFER || + target == GL_TEXTURE_2D_MULTISAMPLE || + target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY); memset(obj, 0, sizeof(*obj)); /* init the non-zero fields */ @@ -166,23 +168,39 @@ static void finish_texture_init(struct gl_context *ctx, GLenum target, struct gl_texture_object *obj) { + GLenum filter = GL_LINEAR; assert(obj->Target == 0); - if (target == GL_TEXTURE_RECTANGLE_NV || - target == GL_TEXTURE_EXTERNAL_OES) { - /* have to init wrap and filter state here - kind of klunky */ - obj->Sampler.WrapS = GL_CLAMP_TO_EDGE; - obj->Sampler.WrapT = GL_CLAMP_TO_EDGE; - obj->Sampler.WrapR = GL_CLAMP_TO_EDGE; - obj->Sampler.MinFilter = GL_LINEAR; - if (ctx->Driver.TexParameter) { - static const GLfloat fparam_wrap[1] = {(GLfloat) GL_CLAMP_TO_EDGE}; - static const GLfloat fparam_filter[1] = {(GLfloat) GL_LINEAR}; - ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_WRAP_S, fparam_wrap); - ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_WRAP_T, fparam_wrap); - ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_WRAP_R, fparam_wrap); - ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_MIN_FILTER, fparam_filter); - } + switch (target) { + case GL_TEXTURE_2D_MULTISAMPLE: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + filter = GL_NEAREST; + /* fallthrough */ + + case GL_TEXTURE_RECTANGLE_NV: + case GL_TEXTURE_EXTERNAL_OES: + /* have to init wrap and filter state here - kind of klunky */ + obj->Sampler.WrapS = GL_CLAMP_TO_EDGE; + obj->Sampler.WrapT = GL_CLAMP_TO_EDGE; + obj->Sampler.WrapR = GL_CLAMP_TO_EDGE; + obj->Sampler.MinFilter = filter; + obj->Sampler.MagFilter = filter; + if (ctx->Driver.TexParameter) { + static const GLfloat fparam_wrap[1] = {(GLfloat) GL_CLAMP_TO_EDGE}; + const GLfloat fparam_filter[1] = {(GLfloat) filter}; + ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_WRAP_S, fparam_wrap); + ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_WRAP_T, fparam_wrap); + ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_WRAP_R, fparam_wrap); + ctx->Driver.TexParameter(ctx, target, obj, + GL_TEXTURE_MIN_FILTER, fparam_filter); + ctx->Driver.TexParameter(ctx, target, obj, + GL_TEXTURE_MAG_FILTER, fparam_filter); + } + break; + + default: + /* nothing needs done */ + break; } } @@ -318,6 +336,8 @@ valid_texture_object(const struct gl_texture_object *tex) case GL_TEXTURE_BUFFER: case GL_TEXTURE_EXTERNAL_OES: case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_TEXTURE_2D_MULTISAMPLE: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: return GL_TRUE; case 0x99: _mesa_problem(NULL, "invalid reference to a deleted texture object"); @@ -517,6 +537,8 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, case GL_TEXTURE_RECTANGLE_NV: case GL_TEXTURE_BUFFER: case GL_TEXTURE_EXTERNAL_OES: + case GL_TEXTURE_2D_MULTISAMPLE: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: maxLevels = 1; /* no mipmapping */ break; default: @@ -585,7 +607,9 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, height = baseImage->Height2; depth = baseImage->Depth2; - /* Note: this loop will be a no-op for RECT, BUFFER, EXTERNAL textures */ + /* Note: this loop will be a no-op for RECT, BUFFER, EXTERNAL, + * MULTISAMPLE and MULTISAMPLE_ARRAY textures + */ for (i = baseLevel + 1; i < maxLevels; i++) { /* Compute the expected size of image at level[i] */ if (width > 1) { @@ -763,7 +787,7 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex) dims = 0; target = GL_TEXTURE_BUFFER; break; - case TEXTURE_CUBE_ARRAY_INDEX: + case TEXTURE_CUBE_ARRAY_INDEX: dims = 3; target = GL_TEXTURE_CUBE_MAP_ARRAY; break; @@ -771,6 +795,14 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex) dims = 2; target = GL_TEXTURE_EXTERNAL_OES; break; + case TEXTURE_2D_MULTISAMPLE_INDEX: + dims = 2; + target = GL_TEXTURE_2D_MULTISAMPLE; + break; + case TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX: + dims = 3; + target = GL_TEXTURE_2D_MULTISAMPLE_ARRAY; + break; default: /* no-op */ return NULL; @@ -960,6 +992,9 @@ _mesa_GenTextures( GLsizei n, GLuint *textures ) GLuint first; GLint i; + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glGenTextures %d\n", n); + if (n < 0) { _mesa_error( ctx, GL_INVALID_VALUE, "glGenTextures" ); return; @@ -1069,6 +1104,9 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) GET_CURRENT_CONTEXT(ctx); GLint i; + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glDeleteTextures %d\n", n); + FLUSH_VERTICES(ctx, 0); /* too complex */ if (!textures) @@ -1156,6 +1194,12 @@ target_enum_to_index(struct gl_context *ctx, GLenum target) ? TEXTURE_EXTERNAL_INDEX : -1; case GL_TEXTURE_CUBE_MAP_ARRAY: return TEXTURE_CUBE_ARRAY_INDEX; + case GL_TEXTURE_2D_MULTISAMPLE: + return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_multisample + ? TEXTURE_2D_MULTISAMPLE_INDEX: -1; + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_multisample + ? TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX: -1; default: return -1; } @@ -1290,6 +1334,9 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, GET_CURRENT_CONTEXT(ctx); GLint i; + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glPrioritizeTextures %d\n", n); + FLUSH_VERTICES(ctx, 0); if (n < 0) { @@ -1334,6 +1381,9 @@ _mesa_AreTexturesResident(GLsizei n, const GLuint *texName, GLint i; ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glAreTexturesResident %d\n", n); + if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glAreTexturesResident(n)"); return GL_FALSE; @@ -1379,6 +1429,9 @@ _mesa_IsTexture( GLuint texture ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glIsTexture %d\n", texture); + if (!texture) return GL_FALSE; @@ -1428,6 +1481,9 @@ _mesa_InvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, struct gl_texture_image *image; GET_CURRENT_CONTEXT(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glInvalidateTexSubImage %d\n", texture); + t = invalidate_tex_image_error_check(ctx, texture, level, "glInvalidateTexSubImage"); @@ -1494,6 +1550,7 @@ _mesa_InvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset, break; case GL_TEXTURE_2D_ARRAY: case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: xBorder = image->Border; yBorder = image->Border; zBorder = 0; @@ -1566,6 +1623,9 @@ _mesa_InvalidateTexImage(GLuint texture, GLint level) { GET_CURRENT_CONTEXT(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glInvalidateTexImage(%d, %d)\n", texture, level); + invalidate_tex_image_error_check(ctx, texture, level, "glInvalidateTexImage"); diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c index bc66bb36d..120845b4a 100644 --- a/mesalib/src/mesa/main/texparam.c +++ b/mesalib/src/mesa/main/texparam.c @@ -966,6 +966,9 @@ legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target) * "target may also be TEXTURE_BUFFER, indicating the texture buffer." */ return ctx->API == API_OPENGL_CORE && ctx->Version >= 31; + case GL_TEXTURE_2D_MULTISAMPLE: + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: + return ctx->Extensions.ARB_texture_multisample; default: return GL_FALSE; } @@ -1105,6 +1108,19 @@ get_tex_level_parameter_image(struct gl_context *ctx, *params = GL_NONE; break; + /* GL_ARB_texture_multisample */ + case GL_TEXTURE_SAMPLES: + if (!ctx->Extensions.ARB_texture_multisample) + goto invalid_pname; + *params = img->NumSamples; + break; + + case GL_TEXTURE_FIXED_SAMPLE_LOCATIONS: + if (!ctx->Extensions.ARB_texture_multisample) + goto invalid_pname; + *params = img->FixedSampleLocations; + break; + default: goto invalid_pname; } diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c index 9e591d3b9..1bd9f911f 100644 --- a/mesalib/src/mesa/main/texstate.c +++ b/mesalib/src/mesa/main/texstate.c @@ -707,6 +707,8 @@ alloc_proxy_textures( struct gl_context *ctx ) * values! */ static const GLenum targets[] = { + GL_TEXTURE_2D_MULTISAMPLE, + GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_BUFFER, GL_TEXTURE_2D_ARRAY_EXT, diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c index e944a5518..c90318981 100644 --- a/mesalib/src/mesa/main/version.c +++ b/mesalib/src/mesa/main/version.c @@ -50,6 +50,45 @@ check_for_ending(const char *string, const char *ending) } /** + * Returns the gl override data + * + * version > 0 indicates there is an override requested + * fwd_context is only valid if version > 0 + */ +static void +get_gl_override(int *version, GLboolean *fwd_context) +{ + const char *env_var = "MESA_GL_VERSION_OVERRIDE"; + const char *version_str; + int major, minor, n; + static int override_version = -1; + static GLboolean fc_suffix = GL_FALSE; + + if (override_version < 0) { + override_version = 0; + + version_str = getenv(env_var); + if (version_str) { + fc_suffix = check_for_ending(version_str, "FC"); + + n = sscanf(version_str, "%u.%u", &major, &minor); + if (n != 2) { + fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version_str); + override_version = 0; + } else { + override_version = major * 10 + minor; + if (override_version < 30 && fc_suffix) { + fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version_str); + } + } + } + } + + *version = override_version; + *fwd_context = fc_suffix; +} + +/** * Builds the MESA version string. */ static void @@ -87,41 +126,42 @@ create_version_string(struct gl_context *ctx, const char *prefix) void _mesa_override_gl_version(struct gl_context *ctx) { - const char *env_var = "MESA_GL_VERSION_OVERRIDE"; - const char *version; - int n; - int major, minor; - GLboolean fc_suffix; + int version; + GLboolean fwd_context; - version = getenv(env_var); - if (!version) { - return; - } + get_gl_override(&version, &fwd_context); - fc_suffix = check_for_ending(version, "FC"); - - n = sscanf(version, "%u.%u", &major, &minor); - if (n != 2) { - fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version); - } else { - ctx->Version = major * 10 + minor; - if (ctx->Version < 30 && fc_suffix) { - fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version); + if (version > 0) { + ctx->Version = version; + if (version >= 30 && fwd_context) { + ctx->API = API_OPENGL_CORE; + ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT; + } else if (version >= 31) { + ctx->API = API_OPENGL_CORE; } else { - if (ctx->Version >= 30 && fc_suffix) { - ctx->API = API_OPENGL_CORE; - ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT; - } else if (ctx->Version >= 31) { - ctx->API = API_OPENGL_CORE; - } else { - ctx->API = API_OPENGL_COMPAT; - } - create_version_string(ctx, ""); + ctx->API = API_OPENGL_COMPAT; } + create_version_string(ctx, ""); } } /** + * Returns the gl override value + * + * version > 0 indicates there is an override requested + */ +int +_mesa_get_gl_version_override(void) +{ + int version; + GLboolean fwd_context; + + get_gl_override(&version, &fwd_context); + + return version; +} + +/** * Override the context's GLSL version if the environment variable * MESA_GLSL_VERSION_OVERRIDE is set. Valid values for * MESA_GLSL_VERSION_OVERRIDE are integers, such as "130". diff --git a/mesalib/src/mesa/main/version.h b/mesalib/src/mesa/main/version.h index 8167ed051..c1cb3177d 100644 --- a/mesalib/src/mesa/main/version.h +++ b/mesalib/src/mesa/main/version.h @@ -51,4 +51,7 @@ _mesa_override_gl_version(struct gl_context *ctx); extern void _mesa_override_glsl_version(struct gl_context *ctx); +extern int +_mesa_get_gl_version_override(void); + #endif /* VERSION_H */ diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index ce409eca9..486cf4639 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -1478,6 +1478,13 @@ ir_to_mesa_visitor::visit(ir_expression *ir) assert(!"not supported"); break; + case ir_triop_lrp: + /* ir_triop_lrp operands are (x, y, a) while + * OPCODE_LRP operands are (a, y, x) to match ARB_fragment_program. + */ + emit(ir, OPCODE_LRP, result_dst, op[2], op[1], op[0]); + break; + case ir_quadop_vector: /* This operation should have already been handled. */ @@ -2038,6 +2045,9 @@ ir_to_mesa_visitor::visit(ir_texture *ir) ir->lod_info.grad.dPdy->accept(this); dy = this->result; break; + case ir_txf_ms: + assert(!"Unexpected ir_txf_ms opcode"); + break; } const glsl_type *sampler_type = ir->sampler->type; diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 63b74285a..c41b5833e 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -1942,6 +1942,10 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir) } break; } + case ir_triop_lrp: + /* note: we have to reorder the three args here */ + emit(ir, TGSI_OPCODE_LRP, result_dst, op[2], op[1], op[0]); + break; case ir_unop_pack_snorm_2x16: case ir_unop_pack_unorm_2x16: case ir_unop_pack_half_2x16: @@ -2742,6 +2746,9 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) offset = this->result; } break; + case ir_txf_ms: + assert(!"Unexpected ir_txf_ms opcode"); + break; } if (ir->projector) { diff --git a/pixman/pixman/pixman-mips-dspr2-asm.S b/pixman/pixman/pixman-mips-dspr2-asm.S index ddfacef62..3adbb2afe 100644 --- a/pixman/pixman/pixman-mips-dspr2-asm.S +++ b/pixman/pixman/pixman-mips-dspr2-asm.S @@ -310,6 +310,395 @@ LEAF_MIPS_DSPR2(pixman_composite_src_x888_8888_asm_mips) END(pixman_composite_src_x888_8888_asm_mips) +#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) +LEAF_MIPS_DSPR2(pixman_composite_src_0888_8888_rev_asm_mips) +/* + * a0 - dst (a8r8g8b8) + * a1 - src (b8g8r8) + * a2 - w + */ + + beqz a2, 6f + nop + + lui t8, 0xff00; + srl t9, a2, 2 /* t9 = how many multiples of 4 src pixels */ + beqz t9, 4f /* branch if less than 4 src pixels */ + nop + + li t0, 0x1 + li t1, 0x2 + li t2, 0x3 + andi t3, a1, 0x3 + beq t3, t0, 1f + nop + beq t3, t1, 2f + nop + beq t3, t2, 3f + nop + +0: + beqz t9, 4f + addiu t9, t9, -1 + lw t0, 0(a1) /* t0 = R2 | B1 | G1 | R1 */ + lw t1, 4(a1) /* t1 = G3 | R3 | B2 | G2 */ + lw t2, 8(a1) /* t2 = B4 | G4 | R4 | B3 */ + + addiu a1, a1, 12 + addiu a2, a2, -4 + + wsbh t0, t0 /* t0 = B1 | R2 | R1 | G1 */ + wsbh t1, t1 /* t1 = R3 | G3 | G2 | B2 */ + wsbh t2, t2 /* t2 = G4 | B4 | B3 | R4 */ + + packrl.ph t3, t1, t0 /* t3 = G2 | B2 | B1 | R2 */ + packrl.ph t4, t0, t0 /* t4 = R1 | G1 | B1 | R2 */ + rotr t3, t3, 16 /* t3 = B1 | R2 | G2 | B2 */ + or t3, t3, t8 /* t3 = FF | R2 | G2 | B2 */ + srl t4, t4, 8 /* t4 = 0 | R1 | G1 | B1 */ + or t4, t4, t8 /* t4 = FF | R1 | G1 | B1 */ + packrl.ph t5, t2, t1 /* t5 = B3 | R4 | R3 | G3 */ + rotr t5, t5, 24 /* t5 = R4 | R3 | G3 | B3 */ + or t5, t5, t8 /* t5 = FF | R3 | G3 | B3 */ + rotr t2, t2, 16 /* t2 = B3 | R4 | G4 | B4 */ + or t2, t2, t8 /* t5 = FF | R3 | G3 | B3 */ + + sw t4, 0(a0) + sw t3, 4(a0) + sw t5, 8(a0) + sw t2, 12(a0) + b 0b + addiu a0, a0, 16 + +1: + lbu t6, 0(a1) /* t6 = 0 | 0 | 0 | R1 */ + lhu t7, 1(a1) /* t7 = 0 | 0 | B1 | G1 */ + sll t6, t6, 16 /* t6 = 0 | R1 | 0 | 0 */ + wsbh t7, t7 /* t7 = 0 | 0 | G1 | B1 */ + or t7, t6, t7 /* t7 = 0 | R1 | G1 | B1 */ +11: + beqz t9, 4f + addiu t9, t9, -1 + lw t0, 3(a1) /* t0 = R3 | B2 | G2 | R2 */ + lw t1, 7(a1) /* t1 = G4 | R4 | B3 | G3 */ + lw t2, 11(a1) /* t2 = B5 | G5 | R5 | B4 */ + + addiu a1, a1, 12 + addiu a2, a2, -4 + + wsbh t0, t0 /* t0 = B2 | R3 | R2 | G2 */ + wsbh t1, t1 /* t1 = R4 | G4 | G3 | B3 */ + wsbh t2, t2 /* t2 = G5 | B5 | B4 | R5 */ + + packrl.ph t3, t1, t0 /* t3 = G3 | B3 | B2 | R3 */ + packrl.ph t4, t2, t1 /* t4 = B4 | R5 | R4 | G4 */ + rotr t0, t0, 24 /* t0 = R3 | R2 | G2 | B2 */ + rotr t3, t3, 16 /* t3 = B2 | R3 | G3 | B3 */ + rotr t4, t4, 24 /* t4 = R5 | R4 | G4 | B4 */ + or t7, t7, t8 /* t7 = FF | R1 | G1 | B1 */ + or t0, t0, t8 /* t0 = FF | R2 | G2 | B2 */ + or t3, t3, t8 /* t1 = FF | R3 | G3 | B3 */ + or t4, t4, t8 /* t3 = FF | R4 | G4 | B4 */ + + sw t7, 0(a0) + sw t0, 4(a0) + sw t3, 8(a0) + sw t4, 12(a0) + rotr t7, t2, 16 /* t7 = xx | R5 | G5 | B5 */ + b 11b + addiu a0, a0, 16 + +2: + lhu t7, 0(a1) /* t7 = 0 | 0 | G1 | R1 */ + wsbh t7, t7 /* t7 = 0 | 0 | R1 | G1 */ +21: + beqz t9, 4f + addiu t9, t9, -1 + lw t0, 2(a1) /* t0 = B2 | G2 | R2 | B1 */ + lw t1, 6(a1) /* t1 = R4 | B3 | G3 | R3 */ + lw t2, 10(a1) /* t2 = G5 | R5 | B4 | G4 */ + + addiu a1, a1, 12 + addiu a2, a2, -4 + + wsbh t0, t0 /* t0 = G2 | B2 | B1 | R2 */ + wsbh t1, t1 /* t1 = B3 | R4 | R3 | G3 */ + wsbh t2, t2 /* t2 = R5 | G5 | G4 | B4 */ + + precr_sra.ph.w t7, t0, 0 /* t7 = R1 | G1 | B1 | R2 */ + rotr t0, t0, 16 /* t0 = B1 | R2 | G2 | B2 */ + packrl.ph t3, t2, t1 /* t3 = G4 | B4 | B3 | R4 */ + rotr t1, t1, 24 /* t1 = R4 | R3 | G3 | B3 */ + srl t7, t7, 8 /* t7 = 0 | R1 | G1 | B1 */ + rotr t3, t3, 16 /* t3 = B3 | R4 | G4 | B4 */ + or t7, t7, t8 /* t7 = FF | R1 | G1 | B1 */ + or t0, t0, t8 /* t0 = FF | R2 | G2 | B2 */ + or t1, t1, t8 /* t1 = FF | R3 | G3 | B3 */ + or t3, t3, t8 /* t3 = FF | R4 | G4 | B4 */ + + sw t7, 0(a0) + sw t0, 4(a0) + sw t1, 8(a0) + sw t3, 12(a0) + srl t7, t2, 16 /* t7 = 0 | 0 | R5 | G5 */ + b 21b + addiu a0, a0, 16 + +3: + lbu t7, 0(a1) /* t7 = 0 | 0 | 0 | R1 */ +31: + beqz t9, 4f + addiu t9, t9, -1 + lw t0, 1(a1) /* t0 = G2 | R2 | B1 | G1 */ + lw t1, 5(a1) /* t1 = B3 | G3 | R3 | B2 */ + lw t2, 9(a1) /* t2 = R5 | B4 | G4 | R4 */ + + addiu a1, a1, 12 + addiu a2, a2, -4 + + wsbh t0, t0 /* t0 = R2 | G2 | G1 | B1 */ + wsbh t1, t1 /* t1 = G3 | B3 | B2 | R3 */ + wsbh t2, t2 /* t2 = B4 | R5 | R4 | G4 */ + + precr_sra.ph.w t7, t0, 0 /* t7 = xx | R1 | G1 | B1 */ + packrl.ph t3, t1, t0 /* t3 = B2 | R3 | R2 | G2 */ + rotr t1, t1, 16 /* t1 = B2 | R3 | G3 | B3 */ + rotr t4, t2, 24 /* t4 = R5 | R4 | G4 | B4 */ + rotr t3, t3, 24 /* t3 = R3 | R2 | G2 | B2 */ + or t7, t7, t8 /* t7 = FF | R1 | G1 | B1 */ + or t3, t3, t8 /* t3 = FF | R2 | G2 | B2 */ + or t1, t1, t8 /* t1 = FF | R3 | G3 | B3 */ + or t4, t4, t8 /* t4 = FF | R4 | G4 | B4 */ + + sw t7, 0(a0) + sw t3, 4(a0) + sw t1, 8(a0) + sw t4, 12(a0) + srl t7, t2, 16 /* t7 = 0 | 0 | xx | R5 */ + b 31b + addiu a0, a0, 16 + +4: + beqz a2, 6f + nop +5: + lbu t0, 0(a1) /* t0 = 0 | 0 | 0 | R */ + lbu t1, 1(a1) /* t1 = 0 | 0 | 0 | G */ + lbu t2, 2(a1) /* t2 = 0 | 0 | 0 | B */ + addiu a1, a1, 3 + + sll t0, t0, 16 /* t2 = 0 | R | 0 | 0 */ + sll t1, t1, 8 /* t1 = 0 | 0 | G | 0 */ + + or t2, t2, t1 /* t2 = 0 | 0 | G | B */ + or t2, t2, t0 /* t2 = 0 | R | G | B */ + or t2, t2, t8 /* t2 = FF | R | G | B */ + + sw t2, 0(a0) + addiu a2, a2, -1 + bnez a2, 5b + addiu a0, a0, 4 +6: + j ra + nop + +END(pixman_composite_src_0888_8888_rev_asm_mips) + +LEAF_MIPS_DSPR2(pixman_composite_src_0888_0565_rev_asm_mips) +/* + * a0 - dst (r5g6b5) + * a1 - src (b8g8r8) + * a2 - w + */ + + SAVE_REGS_ON_STACK 0, v0, v1 + beqz a2, 6f + nop + + li t6, 0xf800f800 + li t7, 0x07e007e0 + li t8, 0x001F001F + srl t9, a2, 2 /* t9 = how many multiples of 4 src pixels */ + beqz t9, 4f /* branch if less than 4 src pixels */ + nop + + li t0, 0x1 + li t1, 0x2 + li t2, 0x3 + andi t3, a1, 0x3 + beq t3, t0, 1f + nop + beq t3, t1, 2f + nop + beq t3, t2, 3f + nop + +0: + beqz t9, 4f + addiu t9, t9, -1 + lw t0, 0(a1) /* t0 = R2 | B1 | G1 | R1 */ + lw t1, 4(a1) /* t1 = G3 | R3 | B2 | G2 */ + lw t2, 8(a1) /* t2 = B4 | G4 | R4 | B3 */ + + addiu a1, a1, 12 + addiu a2, a2, -4 + + wsbh t0, t0 /* t0 = B1 | R2 | R1 | G1 */ + wsbh t1, t1 /* t1 = R3 | G3 | G2 | B2 */ + wsbh t2, t2 /* t2 = G4 | B4 | B3 | R4 */ + + packrl.ph t3, t1, t0 /* t3 = G2 | B2 | B1 | R2 */ + packrl.ph t4, t0, t0 /* t4 = R1 | G1 | B1 | R2 */ + rotr t3, t3, 16 /* t3 = B1 | R2 | G2 | B2 */ + srl t4, t4, 8 /* t4 = 0 | R1 | G1 | B1 */ + packrl.ph t5, t2, t1 /* t5 = B3 | R4 | R3 | G3 */ + rotr t5, t5, 24 /* t5 = R4 | R3 | G3 | B3 */ + rotr t2, t2, 16 /* t2 = B3 | R4 | G4 | B4 */ + + CONVERT_2x8888_TO_2x0565 t4, t3, t4, t3, t6, t7, t8, v0, v1 + CONVERT_2x8888_TO_2x0565 t5, t2, t5, t2, t6, t7, t8, v0, v1 + + sh t4, 0(a0) + sh t3, 2(a0) + sh t5, 4(a0) + sh t2, 6(a0) + b 0b + addiu a0, a0, 8 + +1: + lbu t4, 0(a1) /* t4 = 0 | 0 | 0 | R1 */ + lhu t5, 1(a1) /* t5 = 0 | 0 | B1 | G1 */ + sll t4, t4, 16 /* t4 = 0 | R1 | 0 | 0 */ + wsbh t5, t5 /* t5 = 0 | 0 | G1 | B1 */ + or t5, t4, t5 /* t5 = 0 | R1 | G1 | B1 */ +11: + beqz t9, 4f + addiu t9, t9, -1 + lw t0, 3(a1) /* t0 = R3 | B2 | G2 | R2 */ + lw t1, 7(a1) /* t1 = G4 | R4 | B3 | G3 */ + lw t2, 11(a1) /* t2 = B5 | G5 | R5 | B4 */ + + addiu a1, a1, 12 + addiu a2, a2, -4 + + wsbh t0, t0 /* t0 = B2 | R3 | R2 | G2 */ + wsbh t1, t1 /* t1 = R4 | G4 | G3 | B3 */ + wsbh t2, t2 /* t2 = G5 | B5 | B4 | R5 */ + + packrl.ph t3, t1, t0 /* t3 = G3 | B3 | B2 | R3 */ + packrl.ph t4, t2, t1 /* t4 = B4 | R5 | R4 | G4 */ + rotr t0, t0, 24 /* t0 = R3 | R2 | G2 | B2 */ + rotr t3, t3, 16 /* t3 = B2 | R3 | G3 | B3 */ + rotr t4, t4, 24 /* t4 = R5 | R4 | G4 | B4 */ + + CONVERT_2x8888_TO_2x0565 t5, t0, t5, t0, t6, t7, t8, v0, v1 + CONVERT_2x8888_TO_2x0565 t3, t4, t3, t4, t6, t7, t8, v0, v1 + + sh t5, 0(a0) + sh t0, 2(a0) + sh t3, 4(a0) + sh t4, 6(a0) + rotr t5, t2, 16 /* t5 = xx | R5 | G5 | B5 */ + b 11b + addiu a0, a0, 8 + +2: + lhu t5, 0(a1) /* t5 = 0 | 0 | G1 | R1 */ + wsbh t5, t5 /* t5 = 0 | 0 | R1 | G1 */ +21: + beqz t9, 4f + addiu t9, t9, -1 + lw t0, 2(a1) /* t0 = B2 | G2 | R2 | B1 */ + lw t1, 6(a1) /* t1 = R4 | B3 | G3 | R3 */ + lw t2, 10(a1) /* t2 = G5 | R5 | B4 | G4 */ + + addiu a1, a1, 12 + addiu a2, a2, -4 + + wsbh t0, t0 /* t0 = G2 | B2 | B1 | R2 */ + wsbh t1, t1 /* t1 = B3 | R4 | R3 | G3 */ + wsbh t2, t2 /* t2 = R5 | G5 | G4 | B4 */ + + precr_sra.ph.w t5, t0, 0 /* t5 = R1 | G1 | B1 | R2 */ + rotr t0, t0, 16 /* t0 = B1 | R2 | G2 | B2 */ + packrl.ph t3, t2, t1 /* t3 = G4 | B4 | B3 | R4 */ + rotr t1, t1, 24 /* t1 = R4 | R3 | G3 | B3 */ + srl t5, t5, 8 /* t5 = 0 | R1 | G1 | B1 */ + rotr t3, t3, 16 /* t3 = B3 | R4 | G4 | B4 */ + + CONVERT_2x8888_TO_2x0565 t5, t0, t5, t0, t6, t7, t8, v0, v1 + CONVERT_2x8888_TO_2x0565 t1, t3, t1, t3, t6, t7, t8, v0, v1 + + sh t5, 0(a0) + sh t0, 2(a0) + sh t1, 4(a0) + sh t3, 6(a0) + srl t5, t2, 16 /* t5 = 0 | 0 | R5 | G5 */ + b 21b + addiu a0, a0, 8 + +3: + lbu t5, 0(a1) /* t5 = 0 | 0 | 0 | R1 */ +31: + beqz t9, 4f + addiu t9, t9, -1 + lw t0, 1(a1) /* t0 = G2 | R2 | B1 | G1 */ + lw t1, 5(a1) /* t1 = B3 | G3 | R3 | B2 */ + lw t2, 9(a1) /* t2 = R5 | B4 | G4 | R4 */ + + addiu a1, a1, 12 + addiu a2, a2, -4 + + wsbh t0, t0 /* t0 = R2 | G2 | G1 | B1 */ + wsbh t1, t1 /* t1 = G3 | B3 | B2 | R3 */ + wsbh t2, t2 /* t2 = B4 | R5 | R4 | G4 */ + + precr_sra.ph.w t5, t0, 0 /* t5 = xx | R1 | G1 | B1 */ + packrl.ph t3, t1, t0 /* t3 = B2 | R3 | R2 | G2 */ + rotr t1, t1, 16 /* t1 = B2 | R3 | G3 | B3 */ + rotr t4, t2, 24 /* t4 = R5 | R4 | G4 | B4 */ + rotr t3, t3, 24 /* t3 = R3 | R2 | G2 | B2 */ + + CONVERT_2x8888_TO_2x0565 t5, t3, t5, t3, t6, t7, t8, v0, v1 + CONVERT_2x8888_TO_2x0565 t1, t4, t1, t4, t6, t7, t8, v0, v1 + + sh t5, 0(a0) + sh t3, 2(a0) + sh t1, 4(a0) + sh t4, 6(a0) + srl t5, t2, 16 /* t5 = 0 | 0 | xx | R5 */ + b 31b + addiu a0, a0, 8 + +4: + beqz a2, 6f + nop +5: + lbu t0, 0(a1) /* t0 = 0 | 0 | 0 | R */ + lbu t1, 1(a1) /* t1 = 0 | 0 | 0 | G */ + lbu t2, 2(a1) /* t2 = 0 | 0 | 0 | B */ + addiu a1, a1, 3 + + sll t0, t0, 16 /* t2 = 0 | R | 0 | 0 */ + sll t1, t1, 8 /* t1 = 0 | 0 | G | 0 */ + + or t2, t2, t1 /* t2 = 0 | 0 | G | B */ + or t2, t2, t0 /* t2 = 0 | R | G | B */ + + CONVERT_1x8888_TO_1x0565 t2, t3, t4, t5 + + sh t3, 0(a0) + addiu a2, a2, -1 + bnez a2, 5b + addiu a0, a0, 2 +6: + RESTORE_REGS_FROM_STACK 0, v0, v1 + j ra + nop + +END(pixman_composite_src_0888_0565_rev_asm_mips) +#endif + LEAF_MIPS_DSPR2(pixman_composite_src_n_8_8888_asm_mips) /* * a0 - dst (a8r8g8b8) @@ -658,6 +1047,126 @@ LEAF_MIPS_DSPR2(pixman_composite_over_n_8888_0565_ca_asm_mips) END(pixman_composite_over_n_8888_0565_ca_asm_mips) +LEAF_MIPS_DSPR2(pixman_composite_over_n_8_8_asm_mips) +/* + * a0 - dst (a8) + * a1 - src (32bit constant) + * a2 - mask (a8) + * a3 - w + */ + + SAVE_REGS_ON_STACK 0, v0 + li t9, 0x00ff00ff + beqz a3, 3f + nop + srl v0, a3, 2 /* v0 = how many multiples of 4 dst pixels */ + beqz v0, 1f /* branch if less than 4 src pixels */ + nop + + srl t8, a1, 24 + replv.ph t8, t8 + +0: + beqz v0, 1f + addiu v0, v0, -1 + lbu t0, 0(a2) + lbu t1, 1(a2) + lbu t2, 2(a2) + lbu t3, 3(a2) + lbu t4, 0(a0) + lbu t5, 1(a0) + lbu t6, 2(a0) + lbu t7, 3(a0) + + addiu a2, a2, 4 + + precr_sra.ph.w t1, t0, 0 + precr_sra.ph.w t3, t2, 0 + precr_sra.ph.w t5, t4, 0 + precr_sra.ph.w t7, t6, 0 + + precr.qb.ph t0, t3, t1 + precr.qb.ph t1, t7, t5 + + muleu_s.ph.qbl t2, t0, t8 + muleu_s.ph.qbr t3, t0, t8 + shra_r.ph t4, t2, 8 + shra_r.ph t5, t3, 8 + and t4, t4, t9 + and t5, t5, t9 + addq.ph t2, t2, t4 + addq.ph t3, t3, t5 + shra_r.ph t2, t2, 8 + shra_r.ph t3, t3, 8 + precr.qb.ph t0, t2, t3 + not t6, t0 + + preceu.ph.qbl t7, t6 + preceu.ph.qbr t6, t6 + + muleu_s.ph.qbl t2, t1, t7 + muleu_s.ph.qbr t3, t1, t6 + shra_r.ph t4, t2, 8 + shra_r.ph t5, t3, 8 + and t4, t4, t9 + and t5, t5, t9 + addq.ph t2, t2, t4 + addq.ph t3, t3, t5 + shra_r.ph t2, t2, 8 + shra_r.ph t3, t3, 8 + precr.qb.ph t1, t2, t3 + + addu_s.qb t2, t0, t1 + + sb t2, 0(a0) + srl t2, t2, 8 + sb t2, 1(a0) + srl t2, t2, 8 + sb t2, 2(a0) + srl t2, t2, 8 + sb t2, 3(a0) + addiu a3, a3, -4 + b 0b + addiu a0, a0, 4 + +1: + beqz a3, 3f + nop + srl t8, a1, 24 +2: + lbu t0, 0(a2) + lbu t1, 0(a0) + addiu a2, a2, 1 + + mul t2, t0, t8 + shra_r.ph t3, t2, 8 + andi t3, t3, 0x00ff + addq.ph t2, t2, t3 + shra_r.ph t2, t2, 8 + not t3, t2 + andi t3, t3, 0x00ff + + + mul t4, t1, t3 + shra_r.ph t5, t4, 8 + andi t5, t5, 0x00ff + addq.ph t4, t4, t5 + shra_r.ph t4, t4, 8 + andi t4, t4, 0x00ff + + addu_s.qb t2, t2, t4 + sb t2, 0(a0) + addiu a3, a3, -1 + bnez a3, 2b + addiu a0, a0, 1 + +3: + RESTORE_REGS_FROM_STACK 0, v0 + j ra + nop + +END(pixman_composite_over_n_8_8_asm_mips) + LEAF_MIPS_DSPR2(pixman_composite_over_n_8_8888_asm_mips) /* * a0 - dst (a8r8g8b8) @@ -1342,6 +1851,84 @@ LEAF_MIPS_DSPR2(pixman_composite_over_8888_8888_asm_mips) END(pixman_composite_over_8888_8888_asm_mips) +LEAF_MIPS_DSPR2(pixman_composite_over_8888_0565_asm_mips) +/* + * a0 - dst (r5g6b5) + * a1 - src (a8r8g8b8) + * a2 - w + */ + + SAVE_REGS_ON_STACK 8, s0, s1, s2, s3, s4, s5 + li t4, 0x00ff00ff + li s3, 0xf800f800 + li s4, 0x07e007e0 + li s5, 0x001F001F + beqz a2, 3f + nop + addiu t1, a2, -1 + beqz t1, 2f + nop +1: + lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ + lw t1, 4(a1) /* t1 = source (a8r8g8b8) */ + lhu t2, 0(a0) /* t2 = destination (r5g6b5) */ + lhu t3, 2(a0) /* t3 = destination (r5g6b5) */ + addiu a1, a1, 8 + + not t5, t0 + srl t5, t5, 24 + not t6, t1 + srl t6, t6, 24 + + or t7, t5, t6 + beqz t7, 11f + or t8, t0, t1 + beqz t8, 12f + + CONVERT_2x0565_TO_2x8888 t2, t3, s0, s1, s4, s5, t7, t8, t9, s2 + MIPS_2xUN8x4_MUL_2xUN8 s0, s1, t5, t6, t7, t8, t4, t9, t2, t3, s2, s0, s1 + + addu_s.qb t0, t7, t0 + addu_s.qb t1, t8, t1 +11: + CONVERT_2x8888_TO_2x0565 t0, t1, t7, t8, s3, s4, s5, t2, t3 + sh t7, 0(a0) + sh t8, 2(a0) +12: + addiu a2, a2, -2 + addiu t1, a2, -1 + bgtz t1, 1b + addiu a0, a0, 4 +2: + beqz a2, 3f + nop + + lw t0, 0(a1) /* t0 = source (a8r8g8b8) */ + lhu t1, 0(a0) /* t1 = destination (r5g6b5) */ + addiu a1, a1, 4 + + not t2, t0 + srl t2, t2, 24 + + beqz t2, 21f + nop + beqz t0, 3f + + CONVERT_1x0565_TO_1x8888 t1, s0, t8, t9 + MIPS_UN8x4_MUL_UN8 s0, t2, t3, t4, t5, t6, t7 + + addu_s.qb t0, t3, t0 +21: + CONVERT_1x8888_TO_1x0565 t0, s0, t8, t9 + sh s0, 0(a0) + +3: + RESTORE_REGS_FROM_STACK 8, s0, s1, s2, s3, s4, s5 + j ra + nop + +END(pixman_composite_over_8888_0565_asm_mips) + LEAF_MIPS_DSPR2(pixman_composite_over_n_0565_asm_mips) /* * a0 - dst (r5g6b5) diff --git a/pixman/pixman/pixman-mips-dspr2.c b/pixman/pixman/pixman-mips-dspr2.c index e14e1c43b..1ea244576 100644 --- a/pixman/pixman/pixman-mips-dspr2.c +++ b/pixman/pixman/pixman-mips-dspr2.c @@ -48,8 +48,16 @@ PIXMAN_MIPS_BIND_FAST_PATH_SRC_DST (DO_FAST_MEMCPY, src_8888_8888, uint32_t, 1, uint32_t, 1) PIXMAN_MIPS_BIND_FAST_PATH_SRC_DST (DO_FAST_MEMCPY, src_0888_0888, uint8_t, 3, uint8_t, 3) +#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) +PIXMAN_MIPS_BIND_FAST_PATH_SRC_DST (0, src_0888_8888_rev, + uint8_t, 3, uint32_t, 1) +PIXMAN_MIPS_BIND_FAST_PATH_SRC_DST (0, src_0888_0565_rev, + uint8_t, 3, uint16_t, 1) +#endif PIXMAN_MIPS_BIND_FAST_PATH_SRC_DST (0, over_8888_8888, uint32_t, 1, uint32_t, 1) +PIXMAN_MIPS_BIND_FAST_PATH_SRC_DST (0, over_8888_0565, + uint32_t, 1, uint16_t, 1) PIXMAN_MIPS_BIND_FAST_PATH_SRC_DST (0, add_8_8, uint8_t, 1, uint8_t, 1) PIXMAN_MIPS_BIND_FAST_PATH_SRC_DST (0, add_8888_8888, @@ -67,6 +75,8 @@ PIXMAN_MIPS_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, over_n_8888_8888_ca, uint32_t, 1, uint32_t, 1) PIXMAN_MIPS_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, over_n_8888_0565_ca, uint32_t, 1, uint16_t, 1) +PIXMAN_MIPS_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, over_n_8_8, + uint8_t, 1, uint8_t, 1) PIXMAN_MIPS_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, over_n_8_8888, uint8_t, 1, uint32_t, 1) PIXMAN_MIPS_BIND_FAST_PATH_N_MASK_DST (SKIP_ZERO_SRC, over_n_8_0565, @@ -278,6 +288,10 @@ static const pixman_fast_path_t mips_dspr2_fast_paths[] = PIXMAN_STD_FAST_PATH (SRC, x8r8g8b8, null, a8r8g8b8, mips_composite_src_x888_8888), PIXMAN_STD_FAST_PATH (SRC, x8b8g8r8, null, a8b8g8r8, mips_composite_src_x888_8888), PIXMAN_STD_FAST_PATH (SRC, r8g8b8, null, r8g8b8, mips_composite_src_0888_0888), +#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + PIXMAN_STD_FAST_PATH (SRC, b8g8r8, null, x8r8g8b8, mips_composite_src_0888_8888_rev), + PIXMAN_STD_FAST_PATH (SRC, b8g8r8, null, r5g6b5, mips_composite_src_0888_0565_rev), +#endif PIXMAN_STD_FAST_PATH (SRC, solid, a8, a8r8g8b8, mips_composite_src_n_8_8888), PIXMAN_STD_FAST_PATH (SRC, solid, a8, x8r8g8b8, mips_composite_src_n_8_8888), PIXMAN_STD_FAST_PATH (SRC, solid, a8, a8b8g8r8, mips_composite_src_n_8_8888), @@ -290,6 +304,7 @@ static const pixman_fast_path_t mips_dspr2_fast_paths[] = PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8b8g8r8, x8b8g8r8, mips_composite_over_n_8888_8888_ca), PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8r8g8b8, r5g6b5, mips_composite_over_n_8888_0565_ca), PIXMAN_STD_FAST_PATH_CA (OVER, solid, a8b8g8r8, b5g6r5, mips_composite_over_n_8888_0565_ca), + PIXMAN_STD_FAST_PATH (OVER, solid, a8, a8, mips_composite_over_n_8_8), PIXMAN_STD_FAST_PATH (OVER, solid, a8, a8r8g8b8, mips_composite_over_n_8_8888), PIXMAN_STD_FAST_PATH (OVER, solid, a8, x8r8g8b8, mips_composite_over_n_8_8888), PIXMAN_STD_FAST_PATH (OVER, solid, a8, a8b8g8r8, mips_composite_over_n_8_8888), @@ -318,6 +333,8 @@ static const pixman_fast_path_t mips_dspr2_fast_paths[] = PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, x8r8g8b8, mips_composite_over_8888_8888), PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, a8b8g8r8, mips_composite_over_8888_8888), PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, x8b8g8r8, mips_composite_over_8888_8888), + PIXMAN_STD_FAST_PATH (OVER, a8r8g8b8, null, r5g6b5, mips_composite_over_8888_0565), + PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, b5g6r5, mips_composite_over_8888_0565), PIXMAN_STD_FAST_PATH (ADD, solid, a8, a8, mips_composite_add_n_8_8), PIXMAN_STD_FAST_PATH (ADD, solid, a8, a8r8g8b8, mips_composite_add_n_8_8888), PIXMAN_STD_FAST_PATH (ADD, solid, a8, a8b8g8r8, mips_composite_add_n_8_8888), diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.c b/xorg-server/hw/xfree86/common/xf86platformBus.c index 0525e39bc..58663336a 100644 --- a/xorg-server/hw/xfree86/common/xf86platformBus.c +++ b/xorg-server/hw/xfree86/common/xf86platformBus.c @@ -438,7 +438,12 @@ xf86platformAddDevice(int index) } scr_index = AddGPUScreen(xf86GPUScreens[i]->ScreenInit, 0, NULL); - + if (scr_index == -1) { + xf86DeleteScreen(xf86GPUScreens[i]); + xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL); + xf86NumGPUScreens = old_screens; + return -1; + } dixSetPrivate(&xf86GPUScreens[i]->pScreen->devPrivates, xf86ScreenKey, xf86GPUScreens[i]); diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c index b3ded5a33..f9ae46596 100644 --- a/xorg-server/hw/xfree86/modes/xf86Crtc.c +++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c @@ -743,16 +743,8 @@ xf86CrtcCloseScreen(ScreenPtr screen) } /* detach any providers */ if (config->randr_provider) { - if (config->randr_provider->offload_sink) { - DetachOffloadGPU(screen); - config->randr_provider->offload_sink = NULL; - } - else if (config->randr_provider->output_source) { - DetachOutputGPU(screen); - config->randr_provider->output_source = NULL; - } - else if (screen->current_master) - DetachUnboundGPU(screen); + RRProviderDestroy(config->randr_provider); + config->randr_provider = NULL; } return TRUE; } @@ -1848,8 +1840,10 @@ SetCompatOutput(xf86CrtcConfigPtr config) } /* All outputs are disconnected, select one to fake */ - if (!output && config->num_output) - output = config->output[0]; + if (!output && config->num_output) { + config->compat_output = 0; + output = config->output[config->compat_output]; + } return output; } diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c index 3530abf24..01fc9c5e3 100644 --- a/xorg-server/hw/xfree86/modes/xf86RandR12.c +++ b/xorg-server/hw/xfree86/modes/xf86RandR12.c @@ -1885,6 +1885,27 @@ xf86RandR13ConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, i } } +static void +xf86RandR14ProviderDestroy(ScreenPtr screen, RRProviderPtr provider) +{ + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + + if (config->randr_provider == provider) { + if (config->randr_provider->offload_sink) { + DetachOffloadGPU(screen); + config->randr_provider->offload_sink = NULL; + } + else if (config->randr_provider->output_source) { + DetachOutputGPU(screen); + config->randr_provider->output_source = NULL; + } + else if (screen->current_master) + DetachUnboundGPU(screen); + } + config->randr_provider = NULL; +} + static Bool xf86RandR12Init12(ScreenPtr pScreen) { @@ -1914,6 +1935,7 @@ xf86RandR12Init12(ScreenPtr pScreen) rp->rrProviderSetProperty = xf86RandR14ProviderSetProperty; rp->rrProviderGetProperty = xf86RandR14ProviderGetProperty; rp->rrCrtcSetScanoutPixmap = xf86CrtcSetScanoutPixmap; + rp->rrProviderDestroy = xf86RandR14ProviderDestroy; pScrn->PointerMoved = xf86RandR12PointerMoved; pScrn->ChangeGamma = xf86RandR12ChangeGamma; diff --git a/xorg-server/randr/randrstr.h b/xorg-server/randr/randrstr.h index f52d0f284..25174798f 100644 --- a/xorg-server/randr/randrstr.h +++ b/xorg-server/randr/randrstr.h @@ -232,6 +232,9 @@ typedef Bool (*RRProviderSetOffloadSinkProcPtr)(ScreenPtr pScreen, RRProviderPtr offload_sink); +typedef void (*RRProviderDestroyProcPtr)(ScreenPtr pScreen, + RRProviderPtr provider); + /* These are for 1.0 compatibility */ typedef struct _rrRefresh { @@ -330,6 +333,9 @@ typedef struct _rrScrPriv { Bool discontiguous; RRProviderPtr provider; + + RRProviderDestroyProcPtr rrProviderDestroy; + } rrScrPrivRec, *rrScrPrivPtr; extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec; diff --git a/xorg-server/randr/rrprovider.c b/xorg-server/randr/rrprovider.c index c4ed515d6..b321e6227 100644 --- a/xorg-server/randr/rrprovider.c +++ b/xorg-server/randr/rrprovider.c @@ -389,6 +389,8 @@ RRProviderDestroyResource (pointer value, XID pid) { rrScrPriv(pScreen); + if (pScrPriv->rrProviderDestroy) + (*pScrPriv->rrProviderDestroy)(pScreen, provider); pScrPriv->provider = NULL; } free(provider); diff --git a/xorg-server/xkeyboard-config/rules/base.o_s.part b/xorg-server/xkeyboard-config/rules/base.o_s.part index 253effded..721291985 100644 --- a/xorg-server/xkeyboard-config/rules/base.o_s.part +++ b/xorg-server/xkeyboard-config/rules/base.o_s.part @@ -78,12 +78,19 @@ ctrl:ralt_rctrl = +ctrl(ralt_rctrl) compose:ralt = +compose(ralt) compose:lwin = +compose(lwin) + compose:lwin-altgr = +compose(lwin-altgr) compose:rwin = +compose(rwin) + compose:rwin-altgr = +compose(rwin-altgr) compose:menu = +compose(menu) + compose:menu-altgr = +compose(menu-altgr) compose:lctrl = +compose(lctrl) + compose:lctrl-altgr = +compose(lctrl-altgr) compose:rctrl = +compose(rctrl) + compose:rctrl-altgr = +compose(rctrl-altgr) compose:caps = +compose(caps) + compose:caps-altgr = +compose(caps-altgr) compose:102 = +compose(102) + compose:102-altgr = +compose(102-altgr) compose:paus = +compose(paus) compose:prsc = +compose(prsc) compose:sclk = +compose(sclk) diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in index 83dc894e2..95790dda8 100644 --- a/xorg-server/xkeyboard-config/rules/base.xml.in +++ b/xorg-server/xkeyboard-config/rules/base.xml.in @@ -6282,42 +6282,84 @@ </option> <option> <configItem> + <name>compose:lwin-altgr</name> + <_description>3rd level of Left Win</_description> + </configItem> + </option> + <option> + <configItem> <name>compose:rwin</name> <_description>Right Win</_description> </configItem> </option> <option> <configItem> + <name>compose:rwin-altgr</name> + <_description>3rd level of Right Win</_description> + </configItem> + </option> + <option> + <configItem> <name>compose:menu</name> <_description>Menu</_description> </configItem> </option> <option> <configItem> + <name>compose:menu-altgr</name> + <_description>3rd level of Menu</_description> + </configItem> + </option> + <option> + <configItem> <name>compose:lctrl</name> <_description>Left Ctrl</_description> </configItem> </option> <option> <configItem> + <name>compose:lctrl-altgr</name> + <_description>3rd level of Left Ctrl</_description> + </configItem> + </option> + <option> + <configItem> <name>compose:rctrl</name> <_description>Right Ctrl</_description> </configItem> </option> <option> <configItem> + <name>compose:rctrl-altgr</name> + <_description>3rd level of Right Ctrl</_description> + </configItem> + </option> + <option> + <configItem> <name>compose:caps</name> <_description>Caps Lock</_description> </configItem> </option> <option> <configItem> + <name>compose:caps-altgr</name> + <_description>3rd level of Caps Lock</_description> + </configItem> + </option> + <option> + <configItem> <name>compose:102</name> <_description><Less/Greater></_description> </configItem> </option> <option> <configItem> + <name>compose:102-altgr</name> + <_description>3rd level of <Less/Greater></_description> + </configItem> + </option> + <option> + <configItem> <name>compose:paus</name> <_description>Pause</_description> </configItem> diff --git a/xorg-server/xkeyboard-config/symbols/compose b/xorg-server/xkeyboard-config/symbols/compose index d7257329e..08446bf24 100644 --- a/xorg-server/xkeyboard-config/symbols/compose +++ b/xorg-server/xkeyboard-config/symbols/compose @@ -9,36 +9,71 @@ xkb_symbols "lwin" { }; partial modifier_keys +xkb_symbols "lwin-altgr" { + key <LWIN> { type[Group1]="FOUR_LEVEL", [ Super_L, Super_L, Multi_key, Multi_key ] }; +}; + +partial modifier_keys xkb_symbols "rwin" { key <RWIN> { type[Group1]="TWO_LEVEL", [ Multi_key, Multi_key ] }; }; partial modifier_keys +xkb_symbols "rwin-altgr" { + key <RWIN> { type[Group1]="FOUR_LEVEL", [ Super_R, Super_R, Multi_key, Multi_key ] }; +}; + +partial modifier_keys xkb_symbols "menu" { key <MENU> { type[Group1]="TWO_LEVEL", [ Multi_key, Multi_key ] }; }; partial modifier_keys +xkb_symbols "menu-altgr" { + key <MENU> { type[Group1]="FOUR_LEVEL", [ Menu, Menu, Multi_key, Multi_key ] }; +}; + +partial modifier_keys xkb_symbols "rctrl" { key <RCTL> { type[Group1]="TWO_LEVEL", [ Multi_key, Multi_key ] }; }; partial modifier_keys +xkb_symbols "rctrl-altgr" { + key <RCTL> { type[Group1]="FOUR_LEVEL", [ Control_R, Control_R, Multi_key, Multi_key ] }; +}; + +partial modifier_keys xkb_symbols "lctrl" { key <LCTL> { type[Group1]="TWO_LEVEL", [ Multi_key, Multi_key ] }; }; partial modifier_keys +xkb_symbols "lctrl-altgr" { + key <LCTL> { type[Group1]="FOUR_LEVEL", [ Control_L, Control_L, Multi_key, Multi_key ] }; +}; + +partial modifier_keys xkb_symbols "caps" { key <CAPS> { type[Group1]="TWO_LEVEL", [ Multi_key, Multi_key ] }; }; partial modifier_keys +xkb_symbols "caps-altgr" { + key <CAPS> { type[Group1]="FOUR_LEVEL", [ Caps_Lock, Caps_Lock, Multi_key, Multi_key ] }; +}; + +partial modifier_keys xkb_symbols "102" { key <LSGT> { type[Group1]="TWO_LEVEL", [ Multi_key, Multi_key ] }; }; partial modifier_keys +xkb_symbols "102-altgr" { + key <LSGT> { type[Group1]="FOUR_LEVEL", [ less, greater, Multi_key, Multi_key ] }; +}; + +partial modifier_keys xkb_symbols "paus" { key <PAUS> { type[Group1]="TWO_LEVEL", [ Multi_key, Multi_key ] }; }; |