aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/dri/common
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-04-12 09:53:17 +0000
committermarha <marha@users.sourceforge.net>2010-04-12 09:53:17 +0000
commit29b86f9852b2b7ecc31cdfee56679537e40bc6e2 (patch)
tree1e6ec8ccf2dbf773260a1953b8e13c49f9b7c5f5 /mesalib/src/mesa/drivers/dri/common
parent529236591df7366479a6fac30b387667678fd1ba (diff)
downloadvcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.tar.gz
vcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.tar.bz2
vcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.zip
svn merge -r524:HEAD "^/branches/released" .
Diffstat (limited to 'mesalib/src/mesa/drivers/dri/common')
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_metaops.c8
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.c96
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.h28
-rw-r--r--mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c17
-rw-r--r--mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h8
-rw-r--r--mesalib/src/mesa/drivers/dri/common/spantmp.h23
-rw-r--r--mesalib/src/mesa/drivers/dri/common/spantmp2.h25
-rw-r--r--mesalib/src/mesa/drivers/dri/common/utils.c37
-rw-r--r--mesalib/src/mesa/drivers/dri/common/utils.h3
-rw-r--r--mesalib/src/mesa/drivers/dri/common/vblank.c20
-rw-r--r--mesalib/src/mesa/drivers/dri/common/vblank.h16
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlconfig.c7
12 files changed, 129 insertions, 159 deletions
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_metaops.c b/mesalib/src/mesa/drivers/dri/common/dri_metaops.c
index c7bea07dc..dfb7d6404 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_metaops.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_metaops.c
@@ -27,17 +27,9 @@
**************************************************************************/
#include "main/arrayobj.h"
-#include "main/attrib.h"
-#include "main/blend.h"
#include "main/bufferobj.h"
-#include "main/buffers.h"
-#include "main/depth.h"
#include "main/enable.h"
#include "main/matrix.h"
-#include "main/macros.h"
-#include "main/polygon.h"
-#include "main/shaders.h"
-#include "main/stencil.h"
#include "main/texstate.h"
#include "main/varray.h"
#include "main/viewport.h"
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index 547f18a00..75c98825b 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
@@ -97,7 +97,7 @@ driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 )
*
* \internal
* This function calls __DriverAPIRec::UnbindContext, and then decrements
- * __DRIdrawablePrivateRec::refcount which must be non-zero for a successful
+ * __DRIdrawableRec::refcount which must be non-zero for a successful
* return.
*
* While casting the opaque private pointers associated with the parameters
@@ -127,6 +127,7 @@ static int driUnbindContext(__DRIcontext *pcp)
/* Let driver unbind drawable from context */
(*psp->DriverAPI.UnbindContext)(pcp);
+ assert(pdp);
if (pdp->refcount == 0) {
/* ERROR!!! */
return GL_FALSE;
@@ -167,7 +168,7 @@ static int driBindContext(__DRIcontext *pcp,
__DRIdrawable *pdp,
__DRIdrawable *prp)
{
- __DRIscreenPrivate *psp = NULL;
+ __DRIscreen *psp = NULL;
/* Bind the drawable to the context */
@@ -189,6 +190,7 @@ static int driBindContext(__DRIcontext *pcp,
** initialize the drawable information if has not been done before.
*/
+ assert(psp);
if (!psp->dri2.enabled) {
if (pdp && !pdp->pStamp) {
DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
@@ -220,7 +222,7 @@ static int driBindContext(__DRIcontext *pcp,
*
* \param pdp pointer to the private drawable information to update.
*
- * This function basically updates the __DRIdrawablePrivate struct's
+ * This function basically updates the __DRIdrawable struct's
* cliprect information by calling \c __DRIinterfaceMethods::getDrawableInfo.
* This is usually called by the DRI_VALIDATE_DRAWABLE_INFO macro which
* compares the __DRIdrwablePrivate pStamp and lastStamp values. If
@@ -228,10 +230,10 @@ static int driBindContext(__DRIcontext *pcp,
* info.
*/
void
-__driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
+__driUtilUpdateDrawableInfo(__DRIdrawable *pdp)
{
- __DRIscreenPrivate *psp = pdp->driScreenPriv;
- __DRIcontextPrivate *pcp = pdp->driContextPriv;
+ __DRIscreen *psp = pdp->driScreenPriv;
+ __DRIcontext *pcp = pdp->driContextPriv;
if (!pcp
|| ((pdp != pcp->driDrawablePriv) && (pdp != pcp->driReadablePriv))) {
@@ -242,12 +244,12 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
}
if (pdp->pClipRects) {
- _mesa_free(pdp->pClipRects);
+ free(pdp->pClipRects);
pdp->pClipRects = NULL;
}
if (pdp->pBackClipRects) {
- _mesa_free(pdp->pBackClipRects);
+ free(pdp->pBackClipRects);
pdp->pBackClipRects = NULL;
}
@@ -309,7 +311,7 @@ static void driReportDamage(__DRIdrawable *pdp,
* \param drawablePrivate opaque pointer to the per-drawable private info.
*
* \internal
- * This function calls __DRIdrawablePrivate::swapBuffers.
+ * This function calls __DRIdrawable::swapBuffers.
*
* Is called directly from glXSwapBuffers().
*/
@@ -324,7 +326,7 @@ static void driSwapBuffers(__DRIdrawable *dPriv)
if (!dPriv->numClipRects)
return;
- rects = _mesa_malloc(sizeof(*rects) * dPriv->numClipRects);
+ rects = malloc(sizeof(*rects) * dPriv->numClipRects);
if (!rects)
return;
@@ -337,7 +339,7 @@ static void driSwapBuffers(__DRIdrawable *dPriv)
}
driReportDamage(dPriv, rects, dPriv->numClipRects);
- _mesa_free(rects);
+ free(rects);
}
static int driDrawableGetMSC( __DRIscreen *sPriv, __DRIdrawable *dPriv,
@@ -430,7 +432,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config,
*/
(void) attrs;
- pdp = _mesa_malloc(sizeof *pdp);
+ pdp = malloc(sizeof *pdp);
if (!pdp) {
return NULL;
}
@@ -457,7 +459,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config,
if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes,
renderType == GLX_PIXMAP_BIT)) {
- _mesa_free(pdp);
+ free(pdp);
return NULL;
}
@@ -484,8 +486,11 @@ dri2CreateNewDrawable(__DRIscreen *screen,
if (!pdraw)
return NULL;
- pdraw->pClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects);
- pdraw->pBackClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects);
+ pdraw->pClipRects = &pdraw->dri2.clipRect;
+ pdraw->pBackClipRects = &pdraw->dri2.clipRect;
+
+ pdraw->pStamp = &pdraw->dri2.stamp;
+ *pdraw->pStamp = pdraw->lastStamp + 1;
return pdraw;
}
@@ -497,7 +502,7 @@ static void dri_get_drawable(__DRIdrawable *pdp)
static void dri_put_drawable(__DRIdrawable *pdp)
{
- __DRIscreenPrivate *psp;
+ __DRIscreen *psp;
if (pdp) {
pdp->refcount--;
@@ -506,15 +511,15 @@ static void dri_put_drawable(__DRIdrawable *pdp)
psp = pdp->driScreenPriv;
(*psp->DriverAPI.DestroyBuffer)(pdp);
- if (pdp->pClipRects) {
- _mesa_free(pdp->pClipRects);
+ if (pdp->pClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
+ free(pdp->pClipRects);
pdp->pClipRects = NULL;
}
- if (pdp->pBackClipRects) {
- _mesa_free(pdp->pBackClipRects);
+ if (pdp->pBackClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
+ free(pdp->pBackClipRects);
pdp->pBackClipRects = NULL;
}
- _mesa_free(pdp);
+ free(pdp);
}
}
@@ -544,7 +549,7 @@ driDestroyContext(__DRIcontext *pcp)
{
if (pcp) {
(*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp);
- _mesa_free(pcp);
+ free(pcp);
}
}
@@ -560,7 +565,7 @@ driDestroyContext(__DRIcontext *pcp)
* success, or \c NULL on failure.
*
* \internal
- * This function allocates and fills a __DRIcontextPrivateRec structure. It
+ * This function allocates and fills a __DRIcontextRec structure. It
* performs some device independent initialization and passes all the
* relevent information to __DriverAPIRec::CreateContext to create the
* context.
@@ -574,13 +579,16 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
__DRIcontext *pcp;
void * const shareCtx = (shared != NULL) ? shared->driverPrivate : NULL;
- pcp = _mesa_malloc(sizeof *pcp);
+ pcp = malloc(sizeof *pcp);
if (!pcp)
return NULL;
pcp->driScreenPriv = psp;
pcp->driDrawablePriv = NULL;
-
+ pcp->loaderPrivate = data;
+
+ pcp->dri2.draw_stamp = 0;
+ pcp->dri2.read_stamp = 0;
/* When the first context is created for a screen, initialize a "dummy"
* context.
*/
@@ -596,7 +604,7 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
pcp->hHWContext = hwContext;
if ( !(*psp->DriverAPI.CreateContext)(&config->modes, pcp, shareCtx) ) {
- _mesa_free(pcp);
+ free(pcp);
return NULL;
}
@@ -650,7 +658,7 @@ static void driDestroyScreen(__DRIscreen *psp)
(void)drmCloseOnce(psp->fd);
}
- _mesa_free(psp);
+ free(psp);
}
}
@@ -669,6 +677,8 @@ setupLoaderExtensions(__DRIscreen *psp,
psp->systemTime = (__DRIsystemTimeExtension *) extensions[i];
if (strcmp(extensions[i]->name, __DRI_DRI2_LOADER) == 0)
psp->dri2.loader = (__DRIdri2LoaderExtension *) extensions[i];
+ if (strcmp(extensions[i]->name, __DRI_IMAGE_LOOKUP) == 0)
+ psp->dri2.image = (__DRIimageLookupExtension *) extensions[i];
}
}
@@ -688,7 +698,7 @@ setupLoaderExtensions(__DRIscreen *psp,
* \param drm_version Version of the kernel DRM.
* \param frame_buffer Data describing the location and layout of the
* framebuffer.
- * \param pSAREA Pointer the the SAREA.
+ * \param pSAREA Pointer to the SAREA.
* \param fd Device handle for the DRM.
* \param extensions ??
* \param driver_modes Returns modes suppoted by the driver
@@ -712,7 +722,7 @@ driCreateNewScreen(int scrn,
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
- psp = _mesa_calloc(sizeof *psp);
+ psp = calloc(1, sizeof *psp);
if (!psp)
return NULL;
@@ -757,7 +767,7 @@ driCreateNewScreen(int scrn,
*driver_modes = driDriverAPI.InitScreen(psp);
if (*driver_modes == NULL) {
- _mesa_free(psp);
+ free(psp);
return NULL;
}
@@ -779,7 +789,7 @@ dri2CreateNewScreen(int scrn, int fd,
if (driDriverAPI.InitScreen2 == NULL)
return NULL;
- psp = _mesa_calloc(sizeof(*psp));
+ psp = calloc(1, sizeof(*psp));
if (!psp)
return NULL;
@@ -801,7 +811,7 @@ dri2CreateNewScreen(int scrn, int fd,
psp->DriverAPI = driDriverAPI;
*driver_configs = driDriverAPI.InitScreen2(psp);
if (*driver_configs == NULL) {
- _mesa_free(psp);
+ free(psp);
return NULL;
}
@@ -841,7 +851,7 @@ const __DRIlegacyExtension driLegacyExtension = {
driCreateNewContext,
};
-/** Legacy DRI interface */
+/** DRI2 interface */
const __DRIdri2Extension driDRI2Extension = {
{ __DRI_DRI2, __DRI_DRI2_VERSION },
dri2CreateNewScreen,
@@ -849,14 +859,6 @@ const __DRIdri2Extension driDRI2Extension = {
dri2CreateNewContext,
};
-/* This is the table of extensions that the loader will dlsym() for. */
-PUBLIC const __DRIextension *__driDriverExtensions[] = {
- &driCoreExtension.base,
- &driLegacyExtension.base,
- &driDRI2Extension.base,
- NULL
-};
-
static int
driFrameTracking(__DRIdrawable *drawable, GLboolean enable)
{
@@ -871,7 +873,7 @@ driQueryFrameTracking(__DRIdrawable *dpriv,
__DRIswapInfo sInfo;
int status;
int64_t ust;
- __DRIscreenPrivate *psp = dpriv->driScreenPriv;
+ __DRIscreen *psp = dpriv->driScreenPriv;
status = dpriv->driScreenPriv->DriverAPI.GetSwapInfo( dpriv, & sInfo );
if ( status == 0 ) {
@@ -921,14 +923,14 @@ const __DRIframeTrackingExtension driFrameTrackingExtension = {
* be possible to cache the sync rate?
*/
float
-driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust,
+driCalculateSwapUsage( __DRIdrawable *dPriv, int64_t last_swap_ust,
int64_t current_ust )
{
int32_t n;
int32_t d;
int interval;
float usage = 1.0;
- __DRIscreenPrivate *psp = dPriv->driScreenPriv;
+ __DRIscreen *psp = dPriv->driScreenPriv;
if ( (*psp->systemTime->getMSCRate)(dPriv, &n, &d, dPriv->loaderPrivate) ) {
interval = (dPriv->swap_interval != 0) ? dPriv->swap_interval : 1;
@@ -955,4 +957,10 @@ driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust,
return usage;
}
+void
+dri2InvalidateDrawable(__DRIdrawable *drawable)
+{
+ drawable->dri2.stamp++;
+}
+
/*@}*/
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.h b/mesalib/src/mesa/drivers/dri/common/dri_util.h
index c95a5c829..99c0f1e44 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.h
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.h
@@ -59,16 +59,12 @@
typedef struct __DRIswapInfoRec __DRIswapInfo;
-/* Typedefs to avoid rewriting the world. */
-typedef struct __DRIscreenRec __DRIscreenPrivate;
-typedef struct __DRIdrawableRec __DRIdrawablePrivate;
-typedef struct __DRIcontextRec __DRIcontextPrivate;
-
/**
* Extensions.
*/
extern const __DRIlegacyExtension driLegacyExtension;
extern const __DRIcoreExtension driCoreExtension;
+extern const __DRIdri2Extension driDRI2Extension;
extern const __DRIextension driReadDrawableExtension;
extern const __DRIcopySubBufferExtension driCopySubBufferExtension;
extern const __DRIswapControlExtension driSwapControlExtension;
@@ -299,7 +295,8 @@ struct __DRIdrawableRec {
unsigned int index;
/**
- * Pointer to the "drawable has changed ID" stamp in the SAREA.
+ * Pointer to the "drawable has changed ID" stamp in the SAREA (or
+ * to dri2.stamp if DRI2 is being used).
*/
unsigned int *pStamp;
@@ -380,6 +377,11 @@ struct __DRIdrawableRec {
* GLX_MESA_swap_control.
*/
unsigned int swap_interval;
+
+ struct {
+ unsigned int stamp;
+ drm_clip_rect_t clipRect;
+ } dri2;
};
/**
@@ -415,6 +417,16 @@ struct __DRIcontextRec {
* Pointer to screen on which this context was created.
*/
__DRIscreen *driScreenPriv;
+
+ /**
+ * The loaders's private context data. This structure is opaque.
+ */
+ void *loaderPrivate;
+
+ struct {
+ int draw_stamp;
+ int read_stamp;
+ } dri2;
};
/**
@@ -532,6 +544,7 @@ struct __DRIscreenRec {
* fields will not be valid or initializaed in that case. */
int enabled;
__DRIdri2LoaderExtension *loader;
+ __DRIimageLookupExtension *image;
} dri2;
/* The lock actually in use, old sarea or DRI2 */
@@ -552,4 +565,7 @@ driCalculateSwapUsage( __DRIdrawable *dPriv,
extern GLint
driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 );
+extern void
+dri2InvalidateDrawable(__DRIdrawable *drawable);
+
#endif /* _DRI_UTIL_H_ */
diff --git a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c
index 4e7e92c82..c9ce6e3cb 100644
--- a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c
+++ b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c
@@ -1,7 +1,6 @@
#include "main/mtypes.h"
#include "main/formats.h"
-#include "main/framebuffer.h"
#include "main/renderbuffer.h"
#include "main/imports.h"
#include "drirenderbuffer.h"
@@ -33,7 +32,7 @@ driDeleteRenderbuffer(struct gl_renderbuffer *rb)
/* don't free rb->Data Chances are it's a memory mapped region for
* the dri drivers.
*/
- _mesa_free(rb);
+ free(rb);
}
@@ -56,22 +55,14 @@ driDeleteRenderbuffer(struct gl_renderbuffer *rb)
driRenderbuffer *
driNewRenderbuffer(gl_format format, GLvoid *addr,
GLint cpp, GLint offset, GLint pitch,
- __DRIdrawablePrivate *dPriv)
+ __DRIdrawable *dPriv)
{
driRenderbuffer *drb;
- assert(format == GL_RGBA ||
- format == GL_RGB5 ||
- format == GL_RGBA8 ||
- format == GL_DEPTH_COMPONENT16 ||
- format == GL_DEPTH_COMPONENT24 ||
- format == GL_DEPTH_COMPONENT32 ||
- format == GL_STENCIL_INDEX8_EXT);
-
assert(cpp > 0);
assert(pitch > 0);
- drb = _mesa_calloc(sizeof(driRenderbuffer));
+ drb = calloc(1, sizeof(driRenderbuffer));
if (drb) {
const GLuint name = 0;
@@ -196,7 +187,7 @@ driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped)
* gl_framebuffer object.
*/
void
-driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv)
+driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawable *dPriv)
{
struct gl_framebuffer *fb = (struct gl_framebuffer *) dPriv->driverPrivate;
if (fb && (dPriv->w != fb->Width || dPriv->h != fb->Height)) {
diff --git a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h
index 3a5cbcdaa..677511334 100644
--- a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h
+++ b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h
@@ -43,10 +43,10 @@ typedef struct {
GLint flippedPitch;
GLvoid *flippedData; /* mmap'd address of buffer memory, if used */
- /* Pointer to corresponding __DRIdrawablePrivate. This is used to compute
+ /* Pointer to corresponding __DRIdrawable. This is used to compute
* the window's position within the framebuffer.
*/
- __DRIdrawablePrivate *dPriv;
+ __DRIdrawable *dPriv;
/* XXX this is for radeon/r200 only. We should really create a new
* r200Renderbuffer class, derived from this class... not a huge deal.
@@ -66,14 +66,14 @@ typedef struct {
extern driRenderbuffer *
driNewRenderbuffer(gl_format format, GLvoid *addr,
GLint cpp, GLint offset, GLint pitch,
- __DRIdrawablePrivate *dPriv);
+ __DRIdrawable *dPriv);
extern void
driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped);
extern void
-driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv);
+driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawable *dPriv);
#endif /* DRIRENDERBUFFER_H */
diff --git a/mesalib/src/mesa/drivers/dri/common/spantmp.h b/mesalib/src/mesa/drivers/dri/common/spantmp.h
index d5608b880..cdc4f422c 100644
--- a/mesalib/src/mesa/drivers/dri/common/spantmp.h
+++ b/mesalib/src/mesa/drivers/dri/common/spantmp.h
@@ -288,7 +288,6 @@ static void TAG(ReadRGBAPixels)( GLcontext *ctx,
HW_READ_LOCK()
{
GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
- const GLubyte *mask = NULL; /* remove someday */
GLuint i;
LOCAL_VARS;
@@ -296,23 +295,11 @@ static void TAG(ReadRGBAPixels)( GLcontext *ctx,
HW_READ_CLIPLOOP()
{
- if (mask)
- {
- for (i=0;i<n;i++)
- if (mask[i]) {
- int fy = Y_FLIP( y[i] );
- if (CLIPPIXEL( x[i], fy ))
- READ_RGBA( rgba[i], x[i], fy );
- }
- }
- else
- {
- for (i=0;i<n;i++) {
- int fy = Y_FLIP( y[i] );
- if (CLIPPIXEL( x[i], fy ))
- READ_RGBA( rgba[i], x[i], fy );
- }
- }
+ for (i=0;i<n;i++) {
+ int fy = Y_FLIP( y[i] );
+ if (CLIPPIXEL( x[i], fy ))
+ READ_RGBA( rgba[i], x[i], fy );
+ }
}
HW_ENDCLIPLOOP();
}
diff --git a/mesalib/src/mesa/drivers/dri/common/spantmp2.h b/mesalib/src/mesa/drivers/dri/common/spantmp2.h
index 447f3d15b..98422a856 100644
--- a/mesalib/src/mesa/drivers/dri/common/spantmp2.h
+++ b/mesalib/src/mesa/drivers/dri/common/spantmp2.h
@@ -400,7 +400,7 @@
# define READ_RGBA( rgba, _x, _y ) \
do { \
GLuint p = GET_VALUE(_x, _y); \
- *((uint32_t *) rgba) = (t << 8) | 0xff; \
+ *((uint32_t *) rgba) = (p << 8) | 0xff; \
} while (0)
# else
# define READ_RGBA( rgba, _x, _y ) \
@@ -805,7 +805,6 @@ static void TAG(ReadRGBAPixels)( GLcontext *ctx,
HW_READ_LOCK()
{
GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
- GLubyte *mask = NULL; /* remove someday */
GLint i;
LOCAL_VARS;
@@ -813,23 +812,11 @@ static void TAG(ReadRGBAPixels)( GLcontext *ctx,
HW_READ_CLIPLOOP()
{
- if (mask)
- {
- for (i=0;i<n;i++)
- if (mask[i]) {
- int fy = Y_FLIP( y[i] );
- if (CLIPPIXEL( x[i], fy ))
- READ_RGBA( rgba[i], x[i], fy );
- }
- }
- else
- {
- for (i=0;i<n;i++) {
- int fy = Y_FLIP( y[i] );
- if (CLIPPIXEL( x[i], fy ))
- READ_RGBA( rgba[i], x[i], fy );
- }
- }
+ for (i=0;i<n;i++) {
+ int fy = Y_FLIP( y[i] );
+ if (CLIPPIXEL( x[i], fy ))
+ READ_RGBA( rgba[i], x[i], fy );
+ }
}
HW_ENDCLIPLOOP();
}
diff --git a/mesalib/src/mesa/drivers/dri/common/utils.c b/mesalib/src/mesa/drivers/dri/common/utils.c
index b272eb74e..b85b364c5 100644
--- a/mesalib/src/mesa/drivers/dri/common/utils.c
+++ b/mesalib/src/mesa/drivers/dri/common/utils.c
@@ -34,7 +34,6 @@
#include "main/mtypes.h"
#include "main/cpuinfo.h"
#include "main/extensions.h"
-#include "glapi/dispatch.h"
#include "utils.h"
@@ -109,7 +108,7 @@ driGetRendererString( char * buffer, const char * hardware_name,
cpu = _mesa_get_cpu_string();
if (cpu) {
offset += sprintf(buffer + offset, " %s", cpu);
- _mesa_free(cpu);
+ free(cpu);
}
return offset;
@@ -276,10 +275,9 @@ driCheckDriDdxDrmVersions3(const char * driver_name,
}
/* Check that the DDX driver version is compatible */
- /* for miniglx we pass in -1 so we can ignore the DDX version */
- if ( (ddxActual->major != -1) && ((ddxActual->major < ddxExpected->major_min)
+ if ( (ddxActual->major < ddxExpected->major_min)
|| (ddxActual->major > ddxExpected->major_max)
- || (ddxActual->minor < ddxExpected->minor)) ) {
+ || (ddxActual->minor < ddxExpected->minor) ) {
fprintf(stderr, format2, driver_name, "DDX",
ddxExpected->major_min, ddxExpected->major_max, ddxExpected->minor,
ddxActual->major, ddxActual->minor, ddxActual->patch);
@@ -425,7 +423,8 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
const uint8_t * depth_bits, const uint8_t * stencil_bits,
unsigned num_depth_stencil_bits,
const GLenum * db_modes, unsigned num_db_modes,
- const uint8_t * msaa_samples, unsigned num_msaa_modes)
+ const uint8_t * msaa_samples, unsigned num_msaa_modes,
+ GLboolean enable_accum)
{
static const uint8_t bits_table[4][4] = {
/* R G B A */
@@ -487,7 +486,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
__GLcontextModes *modes;
unsigned i, j, k, h;
unsigned num_modes;
- unsigned num_accum_bits = 2;
+ unsigned num_accum_bits = (enable_accum) ? 2 : 1;
switch ( fb_type ) {
case GL_UNSIGNED_BYTE_3_3_2:
@@ -559,7 +558,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
}
num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits * num_msaa_modes;
- configs = _mesa_calloc((num_modes + 1) * sizeof *configs);
+ configs = calloc(1, (num_modes + 1) * sizeof *configs);
if (configs == NULL)
return NULL;
@@ -568,7 +567,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
for ( i = 0 ; i < num_db_modes ; i++ ) {
for ( h = 0 ; h < num_msaa_modes; h++ ) {
for ( j = 0 ; j < num_accum_bits ; j++ ) {
- *c = _mesa_malloc (sizeof **c);
+ *c = malloc (sizeof **c);
modes = &(*c)->modes;
c++;
@@ -626,11 +625,10 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
modes->bindToTextureRgb = GL_TRUE;
modes->bindToTextureRgba = GL_TRUE;
modes->bindToMipmapTexture = GL_FALSE;
- modes->bindToTextureTargets = modes->rgbMode ?
- __DRI_ATTRIB_TEXTURE_1D_BIT |
- __DRI_ATTRIB_TEXTURE_2D_BIT |
- __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT :
- 0;
+ modes->bindToTextureTargets =
+ __DRI_ATTRIB_TEXTURE_1D_BIT |
+ __DRI_ATTRIB_TEXTURE_2D_BIT |
+ __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT;
}
}
}
@@ -653,7 +651,7 @@ __DRIconfig **driConcatConfigs(__DRIconfig **a,
while (b[j] != NULL)
j++;
- all = _mesa_malloc((i + j + 1) * sizeof *all);
+ all = malloc((i + j + 1) * sizeof *all);
index = 0;
for (i = 0; a[i] != NULL; i++)
all[index++] = a[i];
@@ -661,8 +659,8 @@ __DRIconfig **driConcatConfigs(__DRIconfig **a,
all[index++] = b[j];
all[index++] = NULL;
- _mesa_free(a);
- _mesa_free(b);
+ free(a);
+ free(b);
return all;
}
@@ -727,10 +725,7 @@ driGetConfigAttribIndex(const __DRIconfig *config,
{
switch (attribMap[index].attrib) {
case __DRI_ATTRIB_RENDER_TYPE:
- if (config->modes.rgbMode)
- *value = __DRI_ATTRIB_RGBA_BIT;
- else
- *value = __DRI_ATTRIB_COLOR_INDEX_BIT;
+ *value = __DRI_ATTRIB_RGBA_BIT;
break;
case __DRI_ATTRIB_CONFIG_CAVEAT:
if (config->modes.visualRating == GLX_NON_CONFORMANT_CONFIG)
diff --git a/mesalib/src/mesa/drivers/dri/common/utils.h b/mesalib/src/mesa/drivers/dri/common/utils.h
index 2aa6de66c..02ca3feb7 100644
--- a/mesalib/src/mesa/drivers/dri/common/utils.h
+++ b/mesalib/src/mesa/drivers/dri/common/utils.h
@@ -104,7 +104,8 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
const uint8_t * depth_bits, const uint8_t * stencil_bits,
unsigned num_depth_stencil_bits,
const GLenum * db_modes, unsigned num_db_modes,
- const uint8_t * msaa_samples, unsigned num_msaa_modes);
+ const uint8_t * msaa_samples, unsigned num_msaa_modes,
+ GLboolean enable_accum);
__DRIconfig **driConcatConfigs(__DRIconfig **a,
__DRIconfig **b);
diff --git a/mesalib/src/mesa/drivers/dri/common/vblank.c b/mesalib/src/mesa/drivers/dri/common/vblank.c
index 12aeaa108..49b22a2dc 100644
--- a/mesalib/src/mesa/drivers/dri/common/vblank.c
+++ b/mesalib/src/mesa/drivers/dri/common/vblank.c
@@ -34,12 +34,12 @@
#include "vblank.h"
#include "xmlpool.h"
-static unsigned int msc_to_vblank(__DRIdrawablePrivate * dPriv, int64_t msc)
+static unsigned int msc_to_vblank(__DRIdrawable * dPriv, int64_t msc)
{
return (unsigned int)(msc - dPriv->msc_base + dPriv->vblank_base);
}
-static int64_t vblank_to_msc(__DRIdrawablePrivate * dPriv, unsigned int vblank)
+static int64_t vblank_to_msc(__DRIdrawable * dPriv, unsigned int vblank)
{
return (int64_t)(vblank - dPriv->vblank_base + dPriv->msc_base);
}
@@ -64,8 +64,8 @@ static int64_t vblank_to_msc(__DRIdrawablePrivate * dPriv, unsigned int vblank)
* \return Zero is returned on success. A negative errno value
* is returned on failure.
*/
-int driDrawableGetMSC32( __DRIscreenPrivate * priv,
- __DRIdrawablePrivate * dPriv,
+int driDrawableGetMSC32( __DRIscreen * priv,
+ __DRIdrawable * dPriv,
int64_t * count)
{
drmVBlank vbl;
@@ -122,7 +122,7 @@ int driDrawableGetMSC32( __DRIscreenPrivate * priv,
* \return Zero on success or \c GLX_BAD_CONTEXT on failure.
*/
-int driWaitForMSC32( __DRIdrawablePrivate *priv,
+int driWaitForMSC32( __DRIdrawable *priv,
int64_t target_msc, int64_t divisor, int64_t remainder,
int64_t * msc )
{
@@ -278,7 +278,7 @@ static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd )
*/
static unsigned
-driGetDefaultVBlankInterval( const __DRIdrawablePrivate *priv )
+driGetDefaultVBlankInterval( const __DRIdrawable *priv )
{
if ( (priv->vblFlags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) != 0 ) {
return 1;
@@ -295,7 +295,7 @@ driGetDefaultVBlankInterval( const __DRIdrawablePrivate *priv )
* direct rendering context.
*/
-void driDrawableInitVBlank( __DRIdrawablePrivate *priv )
+void driDrawableInitVBlank( __DRIdrawable *priv )
{
if ( priv->swap_interval == (unsigned)-1 &&
!( priv->vblFlags & VBLANK_FLAG_NO_IRQ ) ) {
@@ -320,7 +320,7 @@ void driDrawableInitVBlank( __DRIdrawablePrivate *priv )
*/
unsigned
-driGetVBlankInterval( const __DRIdrawablePrivate *priv )
+driGetVBlankInterval( const __DRIdrawable *priv )
{
if ( (priv->vblFlags & VBLANK_FLAG_INTERVAL) != 0 ) {
/* this must have been initialized when the drawable was first bound
@@ -340,7 +340,7 @@ driGetVBlankInterval( const __DRIdrawablePrivate *priv )
*/
void
-driGetCurrentVBlank( __DRIdrawablePrivate *priv )
+driGetCurrentVBlank( __DRIdrawable *priv )
{
drmVBlank vbl;
@@ -366,7 +366,7 @@ driGetCurrentVBlank( __DRIdrawablePrivate *priv )
*/
int
-driWaitForVBlank( __DRIdrawablePrivate *priv, GLboolean * missed_deadline )
+driWaitForVBlank( __DRIdrawable *priv, GLboolean * missed_deadline )
{
drmVBlank vbl;
unsigned original_seq;
diff --git a/mesalib/src/mesa/drivers/dri/common/vblank.h b/mesalib/src/mesa/drivers/dri/common/vblank.h
index 8b2c761a1..29d1ad800 100644
--- a/mesalib/src/mesa/drivers/dri/common/vblank.h
+++ b/mesalib/src/mesa/drivers/dri/common/vblank.h
@@ -44,17 +44,17 @@
#define VBLANK_FLAG_SECONDARY (1U << 8) /* Wait for secondary vblank.
*/
-extern int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count );
-extern int driDrawableGetMSC32( __DRIscreenPrivate * priv,
- __DRIdrawablePrivate * drawablePrivate,
+extern int driGetMSC32( __DRIscreen * priv, int64_t * count );
+extern int driDrawableGetMSC32( __DRIscreen * priv,
+ __DRIdrawable * drawablePrivate,
int64_t * count);
-extern int driWaitForMSC32( __DRIdrawablePrivate *priv,
+extern int driWaitForMSC32( __DRIdrawable *priv,
int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc );
extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache );
-extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv );
-extern unsigned driGetVBlankInterval( const __DRIdrawablePrivate *priv );
-extern void driGetCurrentVBlank( __DRIdrawablePrivate *priv );
-extern int driWaitForVBlank( __DRIdrawablePrivate *priv,
+extern void driDrawableInitVBlank ( __DRIdrawable *priv );
+extern unsigned driGetVBlankInterval( const __DRIdrawable *priv );
+extern void driGetCurrentVBlank( __DRIdrawable *priv );
+extern int driWaitForVBlank( __DRIdrawable *priv,
GLboolean * missed_deadline );
#undef usleep
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
index 46ba2ffbf..477259ea7 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
@@ -39,13 +39,6 @@
#include "dri_util.h"
#include "xmlconfig.h"
-/*
- * OS dependent ways of getting the name of the running program
- */
-#if (defined(__unix__) || defined(unix)) && !defined(USG)
-#include <sys/param.h>
-#endif
-
#undef GET_PROGRAM_NAME
#if (defined(__GNU_LIBRARY__) || defined(__GLIBC__)) && !defined(__UCLIBC__)