From 3e4302fe3b3cf0d559b1288f3965f800ee35cd41 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 9 May 2007 08:04:32 -0600 Subject: Check that texture units/samplers specified with glUniform1i() are legal. --- src/mesa/shader/shader_api.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 64f2a9fa12..3a54e68d0d 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.0 * * Copyright (C) 2004-2007 Brian Paul All Rights Reserved. * @@ -1072,12 +1072,20 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count, * If we're setting a sampler, we must use glUniformi1()! */ if (shProg->Uniforms->Parameters[location].Type == PROGRAM_SAMPLER) { + GLint unit; if (type != GL_INT || count != 1) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(only glUniform1i can be used " "to set sampler uniforms)"); return; } + /* check that the sampler (tex unit index) is legal */ + unit = ((GLint *) values)[0]; + if (unit >= ctx->Const.MaxTextureImageUnits) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glUniform1(invalid sampler/tex unit index)"); + return; + } } if (count < 0) { -- cgit v1.2.3 From 516259d609d1f9c598fefb38d82103211c9463db Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 9 May 2007 08:07:10 -0600 Subject: Clean-up in I830AllocVidMem(), s/int/unsigned long/ for ret variable. --- src/mesa/drivers/dri/i915/server/intel_dri.c | 27 +++++++++++++------------ src/mesa/drivers/dri/i915tex/server/intel_dri.c | 27 +++++++++++++------------ 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/mesa/drivers/dri/i915/server/intel_dri.c b/src/mesa/drivers/dri/i915/server/intel_dri.c index 169fdbece3..b6946b75d2 100644 --- a/src/mesa/drivers/dri/i915/server/intel_dri.c +++ b/src/mesa/drivers/dri/i915/server/intel_dri.c @@ -455,12 +455,14 @@ static unsigned long AllocFromAGP(const DRIDriverContext *ctx, I830Rec *pI830, l } unsigned long -I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *result, I830MemPool *pool, long size, unsigned long alignment, int flags) +I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, + I830MemRange *result, I830MemPool *pool, long size, + unsigned long alignment, int flags) { - int ret; + unsigned long ret; - if (!result) - return 0; + if (!result) + return 0; /* Make sure these are initialised. */ result->Size = 0; @@ -470,16 +472,15 @@ I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *resul return 0; } - if (pool->Free.Size < size) - return AllocFromAGP(ctx, pI830, size, alignment, result); - else - { - ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags); - - if (ret==0) - return AllocFromAGP(ctx, pI830, size, alignment, result); - return ret; + if (pool->Free.Size < size) { + ret = AllocFromAGP(ctx, pI830, size, alignment, result); + } + else { + ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags); + if (ret == 0) + ret = AllocFromAGP(ctx, pI830, size, alignment, result); } + return ret; } static Bool BindAgpRange(const DRIDriverContext *ctx, I830MemRange *mem) diff --git a/src/mesa/drivers/dri/i915tex/server/intel_dri.c b/src/mesa/drivers/dri/i915tex/server/intel_dri.c index 2d425d04ac..e49c4214ad 100644 --- a/src/mesa/drivers/dri/i915tex/server/intel_dri.c +++ b/src/mesa/drivers/dri/i915tex/server/intel_dri.c @@ -483,12 +483,14 @@ static unsigned long AllocFromAGP(const DRIDriverContext *ctx, I830Rec *pI830, l } unsigned long -I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *result, I830MemPool *pool, long size, unsigned long alignment, int flags) +I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, + I830MemRange *result, I830MemPool *pool, long size, + unsigned long alignment, int flags) { - int ret; + unsigned long ret; - if (!result) - return 0; + if (!result) + return 0; /* Make sure these are initialised. */ result->Size = 0; @@ -498,16 +500,15 @@ I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *resul return 0; } - if (pool->Free.Size < size) - return AllocFromAGP(ctx, pI830, size, alignment, result); - else - { - ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags); - - if (ret==0) - return AllocFromAGP(ctx, pI830, size, alignment, result); - return ret; + if (pool->Free.Size < size) { + ret = AllocFromAGP(ctx, pI830, size, alignment, result); + } + else { + ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags); + if (ret == 0) + ret = AllocFromAGP(ctx, pI830, size, alignment, result); } + return ret; } static Bool BindAgpRange(const DRIDriverContext *ctx, I830MemRange *mem) -- cgit v1.2.3 From 62ef001de7c16aff459114c1dcc8097270689e6d Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 9 May 2007 08:17:57 -0600 Subject: add pointers to git repo for drm/libpciaccess, replace & with & --- docs/fbdev-dri.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/fbdev-dri.html b/docs/fbdev-dri.html index 294ddb1e05..c7f59bb0c2 100644 --- a/docs/fbdev-dri.html +++ b/docs/fbdev-dri.html @@ -39,6 +39,19 @@ You'll need the DRM and pciaccess libraries. Check with: pkg-config --modversion pciaccess +

+You can get them from the git repository with: +

+
+   git clone git://anongit.freedesktop.org/git/mesa/drm
+   git clone git://anongit.freedesktop.org/git/xorg/lib/libpciaccess
+
+ +

+See the README files in those projects for build/install instructions. +

+ +

You'll need fbdev header files. Check with:

@@ -168,7 +181,7 @@ Change to the Mesa/progs/miniglx/ directory and start the sample_server program in the background:

-   ./sample_server &
+   ./sample_server &
 

-- cgit v1.2.3