diff options
author | anholt <anholt> | 2002-07-04 23:04:26 +0000 |
---|---|---|
committer | anholt <anholt> | 2002-07-04 23:04:26 +0000 |
commit | 0f1a3bf3dad6179414e7f05dba997bbca12ba072 (patch) | |
tree | 8c1a314524582cc5d9bb00892ce41d7578e8a18c | |
parent | a25cabca8a31947ab267e43a1d62627cb789b09c (diff) |
Update from trunk.bsd-3-0-0-20020705bsd-3-0-0-branch
8 files changed, 71 insertions, 61 deletions
diff --git a/xc/extras/Mesa/src/mmath.h b/xc/extras/Mesa/src/mmath.h index ea2aa7bc5..c39c93004 100644 --- a/xc/extras/Mesa/src/mmath.h +++ b/xc/extras/Mesa/src/mmath.h @@ -171,17 +171,17 @@ do { \ GLfloat len = LEN_SQUARED_3FV(V); \ if (len) { \ len = (GLfloat) (1.0 / GL_SQRT(len)); \ - V[0] = (GLfloat) (V[0] * len); \ - V[1] = (GLfloat) (V[1] * len); \ - V[2] = (GLfloat) (V[2] * len); \ + (V)[0] = (GLfloat) ((V)[0] * len); \ + (V)[1] = (GLfloat) ((V)[1] * len); \ + (V)[2] = (GLfloat) ((V)[2] * len); \ } \ } while(0) -#define LEN_3FV( V ) (GL_SQRT(V[0]*V[0]+V[1]*V[1]+V[2]*V[2])) -#define LEN_2FV( V ) (GL_SQRT(V[0]*V[0]+V[1]*V[1])) +#define LEN_3FV( V ) (GL_SQRT((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2])) +#define LEN_2FV( V ) (GL_SQRT((V)[0]*(V)[0]+(V)[1]*(V)[1])) -#define LEN_SQUARED_3FV( V ) (V[0]*V[0]+V[1]*V[1]+V[2]*V[2]) -#define LEN_SQUARED_2FV( V ) (V[0]*V[0]+V[1]*V[1]) +#define LEN_SQUARED_3FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1]+(V)[2]*(V)[2]) +#define LEN_SQUARED_2FV( V ) ((V)[0]*(V)[0]+(V)[1]*(V)[1]) /* @@ -398,8 +398,8 @@ static INLINE int iceil(float f) #define UNCLAMPED_FLOAT_TO_UBYTE(b, f) \ do { \ union { GLfloat r; GLuint i; } __tmp; \ - __tmp.r = f; \ - b = ((__tmp.i >= IEEE_0996) \ + __tmp.r = (f); \ + b = ((__tmp.i >= IEEE_0996) \ ? ((GLint)__tmp.i < 0) ? (GLubyte)0 : (GLubyte)255 \ : (__tmp.r = __tmp.r*(255.0F/256.0F) + 32768.0F, \ (GLubyte)__tmp.i)); \ @@ -417,7 +417,7 @@ static INLINE int iceil(float f) b = ((GLubyte) IROUND(CLAMP(f, 0.0F, 1.0F) * 255.0F)) #define CLAMPED_FLOAT_TO_UBYTE(b, f) \ - b = ((GLubyte) IROUND(f * 255.0F)) + b = ((GLubyte) IROUND((f) * 255.0F)) #define COPY_FLOAT( dst, src ) (dst) = (src) @@ -431,10 +431,10 @@ static INLINE int iceil(float f) /* Convert GLubyte in [0,255] to GLfloat in [0.0,1.0] */ extern float _mesa_ubyte_to_float_color_tab[256]; -#define UBYTE_TO_FLOAT(u) _mesa_ubyte_to_float_color_tab[(unsigned int)u] +#define UBYTE_TO_FLOAT(u) _mesa_ubyte_to_float_color_tab[(unsigned int)(u)] /* Convert GLfloat in [0.0,1.0] to GLubyte in [0,255] */ -#define FLOAT_TO_UBYTE(X) ((GLubyte) (GLint) (((X)) * 255.0F)) +#define FLOAT_TO_UBYTE(X) ((GLubyte) (GLint) ((X) * 255.0F)) /* Convert GLbyte in [-128,127] to GLfloat in [-1.0,1.0] */ @@ -488,12 +488,14 @@ extern float _mesa_ubyte_to_float_color_tab[256]; #define SHORT_TO_USHORT(s) ((s) < 0 ? 0 : ((GLushort) (((s) * 65535 / 32767)))) #define INT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 15))) #define UINT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 16))) -#define UNCLAMPED_FLOAT_TO_USHORT(us, f) us = (GLushort) (f * 65535.0F) +#define UNCLAMPED_FLOAT_TO_USHORT(us, f) us = (GLushort) ((f) * 65535.0F) /* * Linear interpolation + * NOTE: OUT argument is evaluated twice! + * NOTE: Be wary of using *coord++ as an argument to any of these macros! */ #define LINTERP(T, OUT, IN) ((OUT) + (T) * ((IN) - (OUT))) @@ -509,56 +511,56 @@ do { \ #define INTERP_CHAN( t, dstc, outc, inc ) \ do { \ - GLfloat inf = CHAN_TO_FLOAT( inc ); \ + GLfloat inf = CHAN_TO_FLOAT( inc ); \ GLfloat outf = CHAN_TO_FLOAT( outc ); \ GLfloat dstf = LINTERP( t, outf, inf ); \ UNCLAMPED_FLOAT_TO_CHAN( dstc, dstf ); \ } while (0) #define INTERP_UI( t, dstui, outui, inui ) \ - dstui = (GLuint) (GLint) LINTERP( t, (GLfloat) outui, (GLfloat) inui ) + dstui = (GLuint) (GLint) LINTERP( t, (GLfloat) (outui), (GLfloat) (inui) ) #define INTERP_F( t, dstf, outf, inf ) \ dstf = LINTERP( t, outf, inf ) -#define INTERP_4F( t, dst, out, in ) \ -do { \ - dst[0] = LINTERP( t, out[0], in[0] ); \ - dst[1] = LINTERP( t, out[1], in[1] ); \ - dst[2] = LINTERP( t, out[2], in[2] ); \ - dst[3] = LINTERP( t, out[3], in[3] ); \ +#define INTERP_4F( t, dst, out, in ) \ +do { \ + (dst)[0] = LINTERP( (t), (out)[0], (in)[0] ); \ + (dst)[1] = LINTERP( (t), (out)[1], (in)[1] ); \ + (dst)[2] = LINTERP( (t), (out)[2], (in)[2] ); \ + (dst)[3] = LINTERP( (t), (out)[3], (in)[3] ); \ } while (0) -#define INTERP_3F( t, dst, out, in ) \ -do { \ - dst[0] = LINTERP( t, out[0], in[0] ); \ - dst[1] = LINTERP( t, out[1], in[1] ); \ - dst[2] = LINTERP( t, out[2], in[2] ); \ +#define INTERP_3F( t, dst, out, in ) \ +do { \ + (dst)[0] = LINTERP( (t), (out)[0], (in)[0] ); \ + (dst)[1] = LINTERP( (t), (out)[1], (in)[1] ); \ + (dst)[2] = LINTERP( (t), (out)[2], (in)[2] ); \ } while (0) -#define INTERP_4CHAN( t, dst, out, in ) \ -do { \ - INTERP_CHAN( t, dst[0], out[0], in[0] ); \ - INTERP_CHAN( t, dst[1], out[1], in[1] ); \ - INTERP_CHAN( t, dst[2], out[2], in[2] ); \ - INTERP_CHAN( t, dst[3], out[3], in[3] ); \ +#define INTERP_4CHAN( t, dst, out, in ) \ +do { \ + INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \ + INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \ + INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \ + INTERP_CHAN( (t), (dst)[3], (out)[3], (in)[3] ); \ } while (0) -#define INTERP_3CHAN( t, dst, out, in ) \ -do { \ - INTERP_CHAN( t, dst[0], out[0], in[0] ); \ - INTERP_CHAN( t, dst[1], out[1], in[1] ); \ - INTERP_CHAN( t, dst[2], out[2], in[2] ); \ +#define INTERP_3CHAN( t, dst, out, in ) \ +do { \ + INTERP_CHAN( (t), (dst)[0], (out)[0], (in)[0] ); \ + INTERP_CHAN( (t), (dst)[1], (out)[1], (in)[1] ); \ + INTERP_CHAN( (t), (dst)[2], (out)[2], (in)[2] ); \ } while (0) -#define INTERP_SZ( t, vec, to, out, in, sz ) \ -do { \ - switch (sz) { \ - case 4: vec[to][3] = LINTERP( t, vec[out][3], vec[in][3] ); \ - case 3: vec[to][2] = LINTERP( t, vec[out][2], vec[in][2] ); \ - case 2: vec[to][1] = LINTERP( t, vec[out][1], vec[in][1] ); \ - case 1: vec[to][0] = LINTERP( t, vec[out][0], vec[in][0] ); \ - } \ +#define INTERP_SZ( t, vec, to, out, in, sz ) \ +do { \ + switch (sz) { \ + case 4: (vec)[to][3] = LINTERP( (t), (vec)[out][3], (vec)[in][3] ); \ + case 3: (vec)[to][2] = LINTERP( (t), (vec)[out][2], (vec)[in][2] ); \ + case 2: (vec)[to][1] = LINTERP( (t), (vec)[out][1], (vec)[in][1] ); \ + case 1: (vec)[to][0] = LINTERP( (t), (vec)[out][0], (vec)[in][0] ); \ + } \ } while(0) diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h index 22e0fb97b..12a1f90eb 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h @@ -783,7 +783,7 @@ static __inline GLuint radeonPackColor( GLuint cpp, } } -#define RADEON_OLD_PACKETS 0 +#define RADEON_OLD_PACKETS 1 /* ================================================================ * Debugging: diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_vbtmp.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_vbtmp.h index 74587eac3..8ce767774 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_vbtmp.h +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_maos_vbtmp.h @@ -1,5 +1,3 @@ -/* $Id: radeon_maos_vbtmp.h,v 1.2.6.1 2002/07/03 07:54:11 anholt Exp $ */ - /* * Mesa 3-D graphics library * Version: 3.5 diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile index 078fdc18d..67d983a56 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile @@ -310,6 +310,7 @@ InstallDriverSDKNonExecFile(r128_reg.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(r128_sarea.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(r128_version.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(r128_video.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(r128_common.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_accel.c,$(DRIVERSDKDIR)/drivers/ati) @@ -326,6 +327,7 @@ InstallDriverSDKNonExecFile(radeon_reg.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_sarea.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_version.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_video.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(radeon_common.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKObjectModule(ati,$(DRIVERSDKMODULEDIR),drivers) InstallDriverSDKObjectModule(atimisc,$(DRIVERSDKMODULEDIR),drivers) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile index 487789761..337fc6243 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile @@ -68,6 +68,7 @@ InstallDriverSDKNonExecFile(glint_driver.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(glint_dga.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(glint_regs.h,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(glint_shadow.c,$(DRIVERSDKDIR)/drivers/glint) +InstallDriverSDKNonExecFile(glint_common.h,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(pm2_accel.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(pm2_dac.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(pm2_video.c,$(DRIVERSDKDIR)/drivers/glint) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile index 32e11a698..ff04afea1 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile @@ -68,8 +68,10 @@ InstallDriverSDKNonExecFile(i810_io.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i810_memory.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i810_wmark.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i810_reg.h,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i810_common.h,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i830_dri.c,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i830_dri.h,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKNonExecFile(i830_driver.c,$(DRIVERSDKDIR)/drivers/i810) +InstallDriverSDKNonExecFile(i830_common.h,$(DRIVERSDKDIR)/drivers/i810) InstallDriverSDKObjectModule(i810,$(DRIVERSDKMODULEDIR),drivers) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile index 0291d615a..c9f497688 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile @@ -130,6 +130,7 @@ InstallDriverSDKNonExecFile(mga_shadow.c,$(DRIVERSDKDIR)/drivers/mga) InstallDriverSDKNonExecFile(mga_storm.c,$(DRIVERSDKDIR)/drivers/mga) InstallDriverSDKNonExecFile(mga_video.c,$(DRIVERSDKDIR)/drivers/mga) InstallDriverSDKNonExecFile(mga_halmod.c,$(DRIVERSDKDIR)/drivers/mga) +InstallDriverSDKNonExecFile(mga_common.h,$(DRIVERSDKDIR)/drivers/mga) InstallDriverSDKObjectModule(mga,$(DRIVERSDKMODULEDIR),drivers) #if BuildMatroxHal diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_state.c b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_state.c index 88f0605fc..83fae4932 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_state.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/radeon_state.c @@ -46,10 +46,11 @@ static __inline__ void radeon_emit_clip_rect( drm_radeon_private_t *dev_priv, DRM_DEBUG( " box: x1=%d y1=%d x2=%d y2=%d\n", box->x1, box->y1, box->x2, box->y2 ); - BEGIN_RING( 3 ); - OUT_RING( CP_PACKET3( RADEON_CNTL_SET_SCISSORS, 1 )); + BEGIN_RING( 4 ); + OUT_RING( CP_PACKET0( RADEON_RE_TOP_LEFT, 0 ) ); OUT_RING( (box->y1 << 16) | box->x1 ); -/* OUT_RING( ((box->y2 - 1) << 16) | (box->x2 - 1) );*/ + OUT_RING( CP_PACKET0( RADEON_RE_WIDTH_HEIGHT, 0 ) ); +/* OUT_RING( ((box->y2 - 1) << 16) | (box->x2 - 1) );*/ OUT_RING( (box->y2 << 16) | box->x2 ); ADVANCE_RING(); } @@ -1070,15 +1071,17 @@ int radeon_cp_clear( DRM_IOCTL_ARGS ) static int radeon_do_init_pageflip( drm_device_t *dev ) { drm_radeon_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + DRM_DEBUG( "\n" ); - dev_priv->crtc_offset = RADEON_READ( RADEON_CRTC_OFFSET ); dev_priv->crtc_offset_cntl = RADEON_READ( RADEON_CRTC_OFFSET_CNTL ); - RADEON_WRITE( RADEON_CRTC_OFFSET, dev_priv->front_offset ); - RADEON_WRITE( RADEON_CRTC_OFFSET_CNTL, - dev_priv->crtc_offset_cntl | - RADEON_CRTC_OFFSET_FLIP_CNTL ); + BEGIN_RING( 4 ); + RADEON_WAIT_UNTIL_3D_IDLE(); + OUT_RING( CP_PACKET0( RADEON_CRTC_OFFSET_CNTL, 0 ) ); + OUT_RING( dev_priv->crtc_offset_cntl | RADEON_CRTC_OFFSET_FLIP_CNTL ); + ADVANCE_RING(); dev_priv->page_flipping = 1; dev_priv->current_page = 0; @@ -1092,13 +1095,14 @@ int radeon_do_cleanup_pageflip( drm_device_t *dev ) drm_radeon_private_t *dev_priv = dev->dev_private; DRM_DEBUG( "\n" ); - RADEON_WRITE( RADEON_CRTC_OFFSET, dev_priv->crtc_offset ); - RADEON_WRITE( RADEON_CRTC_OFFSET_CNTL, dev_priv->crtc_offset_cntl ); + if (dev_priv->current_page != 0) + radeon_cp_dispatch_flip( dev ); + /* FIXME: If the X server changes screen resolution, it + * clobbers the value of RADEON_CRTC_OFFSET_CNTL, above, + * leading to a flashing efect. + */ dev_priv->page_flipping = 0; - dev_priv->current_page = 0; - dev_priv->sarea_priv->pfCurrentPage = dev_priv->current_page; - return 0; } |