add more Mesa patches

This commit is contained in:
Stephan Raue 2009-05-10 02:13:52 +02:00
parent dbd5269182
commit fb0b1aa15e
5 changed files with 474 additions and 9 deletions

View File

@ -1,13 +1,5 @@
commit 532d2051245a1d8afe7ca236f1d966d555bb121a
Author: Dave Airlie <airlied@linux.ie>
Date: Fri Sep 12 17:21:25 2008 +1000
Revert "intel: sync to vblank by default"
This reverts commit e9bf3e4cc9a7e4bcd4c45bd707541d26ecdf0409.
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index c193830..f02192d 100644
index 5233e58..5dded4b 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -55,7 +55,7 @@ PUBLIC const char __driConfigOptions[] =
@ -19,3 +11,4 @@ index c193830..f02192d 100644
/* Options correspond to DRI_CONF_BO_REUSE_DISABLED,
* DRI_CONF_BO_REUSE_ALL
*/

View File

@ -0,0 +1,33 @@
commit 954dfba12986f578f2d8461818f9e9ac1f8f2b41
Author: Keith Packard <keithp@keithp.com>
Date: Fri Jan 30 21:51:32 2009 -0800
i965: bump texture limit to 4kx4k
Rendering and textures are limited to 8kx8k, but mesa limits things to
4kx4k, and magic guard band stuff may break on 8kx8k drawing. This is safe
though, and makes compiz work on bigger screens.
Signed-off-by: Keith Packard <keithp@keithp.com>
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index d7a2bd9..d66781f 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -135,13 +135,12 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
ctx->Const.MaxTextureImageUnits);
ctx->Const.MaxVertexTextureImageUnits = 0; /* no vertex shader textures */
- /* Advertise the full hardware capabilities. The new memory
- * manager should cope much better with overload situations:
+ /* Mesa limits textures to 4kx4k; it would be nice to fix that someday
*/
- ctx->Const.MaxTextureLevels = 12;
+ ctx->Const.MaxTextureLevels = 13;
ctx->Const.Max3DTextureLevels = 9;
ctx->Const.MaxCubeTextureLevels = 12;
- ctx->Const.MaxTextureRectSize = (1<<11);
+ ctx->Const.MaxTextureRectSize = (1<<12);
/* if conformance mode is set, swrast can handle any size AA point */
ctx->Const.MaxPointSizeAA = 255.0;

View File

@ -0,0 +1,337 @@
Index: mesa/include/GL/internal/dri_interface.h
===================================================================
--- mesa.orig/include/GL/internal/dri_interface.h 2009-01-25 17:28:10.000000000 +0200
+++ mesa/include/GL/internal/dri_interface.h 2009-04-03 11:45:43.000000000 +0300
@@ -230,7 +230,7 @@
#define __DRI_TEX_BUFFER "DRI_TexBuffer"
-#define __DRI_TEX_BUFFER_VERSION 1
+#define __DRI_TEX_BUFFER_VERSION 2
struct __DRItexBufferExtensionRec {
__DRIextension base;
@@ -238,11 +238,23 @@
* Method to override base texture image with the contents of a
* __DRIdrawable.
*
- * For GLX_EXT_texture_from_pixmap with AIGLX.
+ * For GLX_EXT_texture_from_pixmap with AIGLX. Deprecated in favor of
+ * setTexBuffer2 in version 2 of this interface
*/
void (*setTexBuffer)(__DRIcontext *pDRICtx,
GLint target,
__DRIdrawable *pDraw);
+
+ /**
+ * Method to override base texture image with the contents of a
+ * __DRIdrawable, including the required texture format attribute.
+ *
+ * For GLX_EXT_texture_from_pixmap with AIGLX.
+ */
+ void (*setTexBuffer2)(__DRIcontext *pDRICtx,
+ GLint target,
+ GLint format,
+ __DRIdrawable *pDraw);
};
Index: mesa/include/GL/internal/glcore.h
===================================================================
--- mesa.orig/include/GL/internal/glcore.h 2009-01-16 21:37:10.000000000 +0200
+++ mesa/include/GL/internal/glcore.h 2009-04-03 11:45:43.000000000 +0300
@@ -176,4 +176,8 @@
#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
+#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8
+#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9
+#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA
+
#endif /* __gl_core_h_ */
Index: mesa/src/glx/x11/glx_pbuffer.c
===================================================================
--- mesa.orig/src/glx/x11/glx_pbuffer.c 2009-01-16 23:12:40.000000000 +0200
+++ mesa/src/glx/x11/glx_pbuffer.c 2009-04-03 11:45:43.000000000 +0300
@@ -189,6 +189,21 @@
return target;
}
+
+
+static GLenum
+determineTextureFormat(const int *attribs, int numAttribs)
+{
+ GLenum target = 0;
+ int i;
+
+ for (i = 0; i < numAttribs; i++) {
+ if (attribs[2 * i] == GLX_TEXTURE_FORMAT_EXT)
+ return attribs[2 * i + 1];
+ }
+
+ return 0;
+}
#endif
/**
@@ -294,6 +309,9 @@
if (pdraw != NULL && !pdraw->textureTarget)
pdraw->textureTarget =
determineTextureTarget((const int *) data, num_attributes);
+ if (pdraw != NULL && !pdraw->textureFormat)
+ pdraw->textureFormat =
+ determineTextureFormat((const int *) data, num_attributes);
}
#endif
@@ -374,6 +392,7 @@
}
pdraw->textureTarget = determineTextureTarget(attrib_list, i);
+ pdraw->textureFormat = determineTextureFormat(attrib_list, i);
} while (0);
#endif
Index: mesa/src/glx/x11/glxclient.h
===================================================================
--- mesa.orig/src/glx/x11/glxclient.h 2009-03-30 10:47:17.000000000 +0300
+++ mesa/src/glx/x11/glxclient.h 2009-04-03 11:45:43.000000000 +0300
@@ -161,6 +161,7 @@
__GLXscreenConfigs *psc;
GLenum textureTarget;
__DRIdrawable *driDrawable;
+ GLenum textureFormat; /* EXT_texture_from_pixmap support */
};
/*
Index: mesa/src/glx/x11/glxcmds.c
===================================================================
--- mesa.orig/src/glx/x11/glxcmds.c 2009-03-30 10:34:15.000000000 +0300
+++ mesa/src/glx/x11/glxcmds.c 2009-04-03 11:45:43.000000000 +0300
@@ -2631,11 +2631,19 @@
if (gc->driContext) {
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
- if (pdraw != NULL)
- (*pdraw->psc->texBuffer->setTexBuffer)(gc->__driContext,
- pdraw->textureTarget,
- pdraw->driDrawable);
-
+ if (pdraw != NULL) {
+ if (pdraw->psc->texBuffer->base.version >= 2 &&
+ pdraw->psc->texBuffer->setTexBuffer2 != NULL) {
+ (*pdraw->psc->texBuffer->setTexBuffer2)(gc->__driContext,
+ pdraw->textureTarget,
+ pdraw->textureFormat,
+ pdraw->driDrawable);
+ } else {
+ (*pdraw->psc->texBuffer->setTexBuffer)(gc->__driContext,
+ pdraw->textureTarget,
+ pdraw->driDrawable);
+ }
+ }
return;
}
#endif
Index: mesa/src/mesa/drivers/dri/i915/i830_texstate.c
===================================================================
--- mesa.orig/src/mesa/drivers/dri/i915/i830_texstate.c 2009-01-16 21:37:10.000000000 +0200
+++ mesa/src/mesa/drivers/dri/i915/i830_texstate.c 2009-04-03 11:45:43.000000000 +0300
@@ -38,7 +38,7 @@
static GLuint
-translate_texture_format(GLuint mesa_format)
+translate_texture_format(GLuint mesa_format, GLuint internal_format)
{
switch (mesa_format) {
case MESA_FORMAT_L8:
@@ -56,7 +56,10 @@
case MESA_FORMAT_ARGB4444:
return MAPSURF_16BIT | MT_16BIT_ARGB4444;
case MESA_FORMAT_ARGB8888:
- return MAPSURF_32BIT | MT_32BIT_ARGB8888;
+ if (internal_format == GL_RGB)
+ return MAPSURF_32BIT | MT_32BIT_XRGB8888;
+ else
+ return MAPSURF_32BIT | MT_32BIT_ARGB8888;
case MESA_FORMAT_YCBCR_REV:
return (MAPSURF_422 | MT_422_YCRCB_NORMAL);
case MESA_FORMAT_YCBCR:
@@ -162,7 +165,8 @@
0, intelObj->
firstLevel);
- format = translate_texture_format(firstImage->TexFormat->MesaFormat);
+ format = translate_texture_format(firstImage->TexFormat->MesaFormat,
+ firstImage->InternalFormat);
pitch = intelObj->mt->pitch * intelObj->mt->cpp;
}
Index: mesa/src/mesa/drivers/dri/i915/i915_texstate.c
===================================================================
--- mesa.orig/src/mesa/drivers/dri/i915/i915_texstate.c 2009-01-16 21:40:22.000000000 +0200
+++ mesa/src/mesa/drivers/dri/i915/i915_texstate.c 2009-04-03 11:45:43.000000000 +0300
@@ -37,7 +37,8 @@
static GLuint
-translate_texture_format(GLuint mesa_format, GLenum DepthMode)
+translate_texture_format(GLuint mesa_format, GLuint internal_format,
+ GLenum DepthMode)
{
switch (mesa_format) {
case MESA_FORMAT_L8:
@@ -55,7 +56,10 @@
case MESA_FORMAT_ARGB4444:
return MAPSURF_16BIT | MT_16BIT_ARGB4444;
case MESA_FORMAT_ARGB8888:
- return MAPSURF_32BIT | MT_32BIT_ARGB8888;
+ if (internal_format == GL_RGB)
+ return MAPSURF_32BIT | MT_32BIT_XRGB8888;
+ else
+ return MAPSURF_32BIT | MT_32BIT_ARGB8888;
case MESA_FORMAT_YCBCR_REV:
return (MAPSURF_422 | MT_422_YCRCB_NORMAL);
case MESA_FORMAT_YCBCR:
@@ -173,7 +177,8 @@
firstLevel);
format = translate_texture_format(firstImage->TexFormat->MesaFormat,
- tObj->DepthMode);
+ firstImage->InternalFormat,
+ tObj->DepthMode);
pitch = intelObj->mt->pitch * intelObj->mt->cpp;
}
Index: mesa/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
===================================================================
--- mesa.orig/src/mesa/drivers/dri/i965/brw_wm_surface_state.c 2009-03-30 10:34:15.000000000 +0300
+++ mesa/src/mesa/drivers/dri/i965/brw_wm_surface_state.c 2009-04-03 11:45:43.000000000 +0300
@@ -69,7 +69,8 @@
}
-static GLuint translate_tex_format( GLuint mesa_format, GLenum depth_mode )
+static GLuint translate_tex_format( GLuint mesa_format, GLenum internal_format,
+ GLenum depth_mode )
{
switch( mesa_format ) {
case MESA_FORMAT_L8:
@@ -89,10 +90,16 @@
return BRW_SURFACEFORMAT_R8G8B8_UNORM;
case MESA_FORMAT_ARGB8888:
- return BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
+ if (internal_format == GL_RGB)
+ return BRW_SURFACEFORMAT_B8G8R8X8_UNORM;
+ else
+ return BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
case MESA_FORMAT_RGBA8888_REV:
- return BRW_SURFACEFORMAT_R8G8B8A8_UNORM;
+ if (internal_format == GL_RGB)
+ return BRW_SURFACEFORMAT_R8G8B8X8_UNORM;
+ else
+ return BRW_SURFACEFORMAT_R8G8B8A8_UNORM;
case MESA_FORMAT_RGB565:
return BRW_SURFACEFORMAT_B5G6R5_UNORM;
@@ -150,7 +157,7 @@
struct brw_wm_surface_key {
GLenum target, depthmode;
dri_bo *bo;
- GLint format;
+ GLint format, internal_format;
GLint first_level, last_level;
GLint width, height, depth;
GLint pitch, cpp;
@@ -188,9 +195,11 @@
surf.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW;
surf.ss0.surface_type = translate_tex_target(key->target);
-
- if (key->bo)
- surf.ss0.surface_format = translate_tex_format(key->format, key->depthmode);
+ if (key->bo) {
+ surf.ss0.surface_format = translate_tex_format(key->format,
+ key->internal_format,
+ key->depthmode);
+ }
else {
switch (key->depth) {
case 32:
@@ -267,6 +276,7 @@
key.offset = intelObj->textureOffset;
} else {
key.format = firstImage->TexFormat->MesaFormat;
+ key.internal_format = firstImage->InternalFormat;
key.pitch = intelObj->mt->pitch;
key.depth = firstImage->Depth;
key.bo = intelObj->mt->region->buffer;
Index: mesa/src/mesa/drivers/dri/intel/intel_screen.c
===================================================================
--- mesa.orig/src/mesa/drivers/dri/intel/intel_screen.c 2009-04-03 11:45:43.000000000 +0300
+++ mesa/src/mesa/drivers/dri/intel/intel_screen.c 2009-04-03 11:45:43.000000000 +0300
@@ -210,6 +210,7 @@
static const __DRItexBufferExtension intelTexBufferExtension = {
{ __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
intelSetTexBuffer,
+ intelSetTexBuffer2,
};
static const __DRIextension *intelScreenExtensions[] = {
Index: mesa/src/mesa/drivers/dri/intel/intel_tex.h
===================================================================
--- mesa.orig/src/mesa/drivers/dri/intel/intel_tex.h 2009-01-16 21:40:22.000000000 +0200
+++ mesa/src/mesa/drivers/dri/intel/intel_tex.h 2009-04-03 11:45:43.000000000 +0300
@@ -149,6 +149,8 @@
unsigned long long offset, GLint depth, GLuint pitch);
void intelSetTexBuffer(__DRIcontext *pDRICtx,
GLint target, __DRIdrawable *pDraw);
+void intelSetTexBuffer2(__DRIcontext *pDRICtx,
+ GLint target, GLint format, __DRIdrawable *pDraw);
GLuint intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit);
Index: mesa/src/mesa/drivers/dri/intel/intel_tex_image.c
===================================================================
--- mesa.orig/src/mesa/drivers/dri/intel/intel_tex_image.c 2009-03-30 10:34:15.000000000 +0300
+++ mesa/src/mesa/drivers/dri/intel/intel_tex_image.c 2009-04-03 11:45:43.000000000 +0300
@@ -712,7 +712,9 @@
}
void
-intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
+intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
+ GLint glx_texture_format,
+ __DRIdrawable *dPriv)
{
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
struct intel_context *intel = pDRICtx->driverPrivate;
@@ -743,7 +745,10 @@
type = GL_BGRA;
format = GL_UNSIGNED_BYTE;
- internalFormat = (rb->region->cpp == 3 ? 3 : 4);
+ if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT)
+ internalFormat = GL_RGB;
+ else
+ internalFormat = GL_RGBA;
mt = intel_miptree_create_for_region(intel, target,
internalFormat,
@@ -783,3 +788,12 @@
_mesa_unlock_texture(&intel->ctx, texObj);
}
+
+void
+intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv)
+{
+ /* The old interface didn't have the format argument, so copy our
+ * implementation's behavior at the time.
+ */
+ intelSetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
+}

View File

@ -0,0 +1,11 @@
--- Mesa-7.4/src/glx/x11/drisw_glx.c 2009-01-22 17:38:33.000000000 +0000
+++ Mesa-7.4/src/glx/x11/drisw_glx.c.fixed 2009-04-03 23:25:17.000000000 +0100
@@ -405,6 +405,8 @@
psp->createContext = driCreateContext;
psp->createDrawable = driCreateDrawable;
psp->swapBuffers = driSwapBuffers;
+ psp->waitX = NULL;
+ psp->waitGL = NULL;
return psp;

View File

@ -0,0 +1,91 @@
#
# Ubuntu: https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/368049
# Upstream: https://bugs.freedesktop.org/show_bug.cgi?id=17895
# Patch: http://cgit.freedesktop.org/mesa/mesa/commit/?h=mesa_7_4_branch&id=a1ce4efefbb7f796a0a24544a1e893a56848f0c1
# Description: fix xserver segv triggered by compiz ring switcher plugin for users
# with r300/r400 radeon chipsets and -ati driver. Patch previously
# commited to mesa master as c28707b50701b1cf8727be29d61e2d939c6ee58f
# and also to mesa_7_4_branch as a1ce4efefbb7f796a0a24544a1e893a56848f0c1.
# Note: it was commited to the 7.4 branch after mesa 7.4.0 release.
# (LP: #368049)
#
Index: mesa-7.4/src/mesa/drivers/dri/r300/r300_context.h
===================================================================
--- mesa-7.4.orig/src/mesa/drivers/dri/r300/r300_context.h 2009-05-04 12:07:48.000000000 +0200
+++ mesa-7.4/src/mesa/drivers/dri/r300/r300_context.h 2009-05-04 12:08:56.000000000 +0200
@@ -211,7 +211,7 @@
};
struct r300_texture_env_state {
- r300TexObjPtr texobj;
+ struct gl_texture_object *texobj;
GLenum format;
GLenum envMode;
};
Index: mesa-7.4/src/mesa/drivers/dri/r300/r300_state.c
===================================================================
--- mesa-7.4.orig/src/mesa/drivers/dri/r300/r300_state.c 2009-05-04 12:07:59.000000000 +0200
+++ mesa-7.4/src/mesa/drivers/dri/r300/r300_state.c 2009-05-04 12:08:56.000000000 +0200
@@ -1487,7 +1487,7 @@
#endif
tmu_mappings[i] = hw_tmu;
- t = r300->state.texture.unit[i].texobj;
+ t = (r300TexObjPtr) r300->state.texture.unit[i].texobj->DriverData;
/* XXX questionable fix for bug 9170: */
if (!t)
continue;
Index: mesa-7.4/src/mesa/drivers/dri/r300/r300_texmem.c
===================================================================
--- mesa-7.4.orig/src/mesa/drivers/dri/r300/r300_texmem.c 2009-05-04 12:08:07.000000000 +0200
+++ mesa-7.4/src/mesa/drivers/dri/r300/r300_texmem.c 2009-05-04 12:08:56.000000000 +0200
@@ -44,6 +44,7 @@
#include "main/colormac.h"
#include "main/macros.h"
#include "main/simple_list.h"
+#include "main/texobj.h"
#include "radeon_reg.h" /* gets definition for usleep */
#include "r300_context.h"
#include "r300_state.h"
@@ -71,8 +72,8 @@
}
for (i = 0; i < rmesa->radeon.glCtx->Const.MaxTextureUnits; i++) {
- if (rmesa->state.texture.unit[i].texobj == t) {
- rmesa->state.texture.unit[i].texobj = NULL;
+ if (rmesa->state.texture.unit[i].texobj == t->base.tObj) {
+ _mesa_reference_texobj(&rmesa->state.texture.unit[i].texobj, NULL);
}
}
}
Index: mesa-7.4/src/mesa/drivers/dri/r300/r300_texstate.c
===================================================================
--- mesa-7.4.orig/src/mesa/drivers/dri/r300/r300_texstate.c 2009-05-04 12:08:17.000000000 +0200
+++ mesa-7.4/src/mesa/drivers/dri/r300/r300_texstate.c 2009-05-04 12:08:56.000000000 +0200
@@ -567,19 +567,20 @@
/* Update state if this is a different texture object to last
* time.
*/
- if (rmesa->state.texture.unit[unit].texobj != t) {
+ if (rmesa->state.texture.unit[unit].texobj != tObj) {
if (rmesa->state.texture.unit[unit].texobj != NULL) {
+ r300TexObjPtr t_old = (r300TexObjPtr) rmesa->state.texture.unit[unit].texobj->DriverData;
+
/* The old texture is no longer bound to this texture unit.
* Mark it as such.
*/
- rmesa->state.texture.unit[unit].texobj->base.bound &=
- ~(1 << unit);
+ t_old->base.bound &= ~(1 << unit);
}
- rmesa->state.texture.unit[unit].texobj = t;
+ _mesa_reference_texobj(&rmesa->state.texture.unit[unit].texobj, tObj);
t->base.bound |= (1 << unit);
- driUpdateTextureLRU((driTextureObject *) t); /* XXX: should be locked! */
+ driUpdateTextureLRU(&t->base); /* XXX: should be locked! */
}
return !t->border_fallback;