diff options
author | Brian Paul <[email protected]> | 2009-12-21 18:35:54 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-12-21 18:35:54 -0700 |
commit | 9eb7fc6661a1d46c06cec8584b898e3e690af6fa (patch) | |
tree | 78ed4336c613303ef02691baf4d89e7330a0f6cf /src | |
parent | ae1c0a06e81b8c6f015a3b64616a5d3a989f9373 (diff) | |
parent | b57abd3bea29e95e5dee2524c3f1be4b26017c0f (diff) |
Merge branch 'mesa_7_7_branch'
Conflicts:
src/mesa/main/version.h
src/mesa/state_tracker/st_atom_shader.c
Diffstat (limited to 'src')
45 files changed, 363 insertions, 124 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 53915958914..8a24aa10a3c 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -480,7 +480,7 @@ static void drv_block_handler(int i, pointer blockData, pointer pTimeout, if (num_cliprects) { drmModeClip *clip = alloca(num_cliprects * sizeof(drmModeClip)); BoxPtr rect = REGION_RECTS(dirty); - int i; + int i, ret; /* XXX no need for copy? */ for (i = 0; i < num_cliprects; i++, rect++) { @@ -491,7 +491,11 @@ static void drv_block_handler(int i, pointer blockData, pointer pTimeout, } /* TODO query connector property to see if this is needed */ - drmModeDirtyFB(ms->fd, ms->fb_id, clip, num_cliprects); + ret = drmModeDirtyFB(ms->fd, ms->fb_id, clip, num_cliprects); + if (ret) { + debug_printf("%s: failed to send dirty (%i, %s)\n", + __func__, ret, strerror(-ret)); + } DamageEmpty(ms->damage); } @@ -837,6 +841,7 @@ drv_create_front_buffer_ga3d(ScrnInfoPtr pScrn) modesettingPtr ms = modesettingPTR(pScrn); unsigned handle, stride; struct pipe_texture *tex; + int ret; ms->noEvict = TRUE; @@ -850,16 +855,21 @@ drv_create_front_buffer_ga3d(ScrnInfoPtr pScrn) tex, &stride, &handle)) - return FALSE; + goto err_destroy; - drmModeAddFB(ms->fd, - pScrn->virtualX, - pScrn->virtualY, - pScrn->depth, - pScrn->bitsPerPixel, - stride, - handle, - &ms->fb_id); + ret = drmModeAddFB(ms->fd, + pScrn->virtualX, + pScrn->virtualY, + pScrn->depth, + pScrn->bitsPerPixel, + stride, + handle, + &ms->fb_id); + if (ret) { + debug_printf("%s: failed to create framebuffer (%i, %s)", + __func__, ret, strerror(-ret)); + goto err_destroy; + } pScrn->frameX0 = 0; pScrn->frameY0 = 0; @@ -869,6 +879,10 @@ drv_create_front_buffer_ga3d(ScrnInfoPtr pScrn) pipe_texture_reference(&tex, NULL); return TRUE; + +err_destroy: + pipe_texture_reference(&tex, NULL); + return FALSE; } static Bool @@ -898,6 +912,8 @@ static Bool drv_destroy_front_buffer_kms(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); + ScreenPtr pScreen = pScrn->pScreen; + PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen); if (!ms->root_bo) return TRUE; @@ -914,6 +930,7 @@ drv_create_front_buffer_kms(ScrnInfoPtr pScrn) unsigned handle, stride; struct kms_bo *bo; unsigned attr[8]; + int ret; attr[0] = KMS_BO_TYPE; attr[1] = KMS_BO_TYPE_SCANOUT; @@ -932,14 +949,19 @@ drv_create_front_buffer_kms(ScrnInfoPtr pScrn) if (kms_bo_get_prop(bo, KMS_HANDLE, &handle)) goto err_destroy; - drmModeAddFB(ms->fd, - pScrn->virtualX, - pScrn->virtualY, - pScrn->depth, - pScrn->bitsPerPixel, - stride, - handle, - &ms->fb_id); + ret = drmModeAddFB(ms->fd, + pScrn->virtualX, + pScrn->virtualY, + pScrn->depth, + pScrn->bitsPerPixel, + stride, + handle, + &ms->fb_id); + if (ret) { + debug_printf("%s: failed to create framebuffer (%i, %s)", + __func__, ret, strerror(-ret)); + goto err_destroy; + } pScrn->frameX0 = 0; pScrn->frameY0 = 0; @@ -966,7 +988,7 @@ drv_bind_front_buffer_kms(ScrnInfoPtr pScrn) return FALSE; if (kms_bo_map(ms->root_bo, &ptr)) - return FALSE; + goto err_destroy; pScreen->ModifyPixmapHeader(rootPixmap, pScreen->width, @@ -976,6 +998,10 @@ drv_bind_front_buffer_kms(ScrnInfoPtr pScrn) stride, ptr); return TRUE; + +err_destroy: + kms_bo_destroy(&ms->root_bo); + return FALSE; } #endif /* HAVE_LIBKMS */ diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 1769c12e808..d5c005ebadd 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -344,6 +344,9 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) #if DEBUG_PRINT debug_printf("ExaPrepareSolid(0x%x)\n", fg); #endif + if (!exa->accel) + return FALSE; + if (!exa->pipe) XORG_FALLBACK("accle not enabled"); @@ -362,7 +365,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) XORG_FALLBACK("format %s", pf_name(priv->tex->format)); } - return exa->accel && xorg_solid_bind_state(exa, priv, fg); + return xorg_solid_bind_state(exa, priv, fg); } static void @@ -418,6 +421,10 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, #if DEBUG_PRINT debug_printf("ExaPrepareCopy\n"); #endif + + if (!exa->accel) + return FALSE; + if (!exa->pipe) XORG_FALLBACK("accle not enabled"); @@ -491,7 +498,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, } - return exa->accel; + return TRUE; } static void @@ -599,15 +606,19 @@ ExaCheckComposite(int op, ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; - boolean accelerated = xorg_composite_accelerated(op, - pSrcPicture, - pMaskPicture, - pDstPicture); + #if DEBUG_PRINT debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n", op, pSrcPicture, pMaskPicture, pDstPicture, accelerated); #endif - return exa->accel && accelerated; + + if (!exa->accel) + return FALSE; + + return xorg_composite_accelerated(op, + pSrcPicture, + pMaskPicture, + pDstPicture); } @@ -621,6 +632,9 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, struct exa_context *exa = ms->exa; struct exa_pixmap_priv *priv; + if (!exa->accel) + return FALSE; + #if DEBUG_PRINT debug_printf("ExaPrepareComposite(%d, src=0x%p, mask=0x%p, dst=0x%p)\n", op, pSrcPicture, pMaskPicture, pDstPicture); @@ -679,8 +693,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, render_format_name(pMaskPicture->format)); } - return exa->accel && - xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture, + return xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL, pMask ? exaGetPixmapDriverPrivate(pMask) : NULL, diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c index 9ed570ff6e4..5ed2a10af1c 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c +++ b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c @@ -32,6 +32,7 @@ intel_drm_get_device_id(unsigned int *device_id) } shutup_gcc = fgets(path, sizeof(path), file); + (void) shutup_gcc; sscanf(path, "%x", device_id); fclose(file); } diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c b/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c index 51e455f9254..ccd0b418a16 100644 --- a/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c +++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c @@ -468,6 +468,15 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws) VMW_FUNC; memset(&gp_arg, 0, sizeof(gp_arg)); + gp_arg.param = DRM_VMW_PARAM_3D; + ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_GET_PARAM, + &gp_arg, sizeof(gp_arg)); + if (ret || gp_arg.value == 0) { + debug_printf("No 3D enabled (%i, %s)\n", ret, strerror(-ret)); + goto out_err1; + } + + memset(&gp_arg, 0, sizeof(gp_arg)); gp_arg.param = DRM_VMW_PARAM_FIFO_OFFSET; ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_GET_PARAM, &gp_arg, sizeof(gp_arg)); diff --git a/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h b/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h index 89bbf17ce99..2be7e1249b6 100644 --- a/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h +++ b/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h @@ -25,28 +25,32 @@ * **************************************************************************/ -#ifndef _VMWGFX_DRM_H_ -#define _VMWGFX_DRM_H_ +#ifndef __VMWGFX_DRM_H__ +#define __VMWGFX_DRM_H__ #define DRM_VMW_MAX_SURFACE_FACES 6 #define DRM_VMW_MAX_MIP_LEVELS 24 #define DRM_VMW_EXT_NAME_LEN 128 -#define DRM_VMW_GET_PARAM 1 -#define DRM_VMW_EXTENSION 2 -#define DRM_VMW_CREATE_CONTEXT 3 -#define DRM_VMW_UNREF_CONTEXT 4 -#define DRM_VMW_CREATE_SURFACE 5 -#define DRM_VMW_UNREF_SURFACE 6 -#define DRM_VMW_REF_SURFACE 7 -#define DRM_VMW_EXECBUF 8 -#define DRM_VMW_ALLOC_DMABUF 9 -#define DRM_VMW_UNREF_DMABUF 10 -#define DRM_VMW_FIFO_DEBUG 11 -#define DRM_VMW_FENCE_WAIT 12 -#define DRM_VMW_OVERLAY 13 -#define DRM_VMW_CURSOR_BYPASS 14 +#define DRM_VMW_GET_PARAM 0 +#define DRM_VMW_ALLOC_DMABUF 1 +#define DRM_VMW_UNREF_DMABUF 2 +#define DRM_VMW_CURSOR_BYPASS 3 +/* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/ +#define DRM_VMW_CONTROL_STREAM 4 +#define DRM_VMW_CLAIM_STREAM 5 +#define DRM_VMW_UNREF_STREAM 6 +/* guarded by DRM_VMW_PARAM_3D == 1 */ +#define DRM_VMW_CREATE_CONTEXT 7 +#define DRM_VMW_UNREF_CONTEXT 8 +#define DRM_VMW_CREATE_SURFACE 9 +#define DRM_VMW_UNREF_SURFACE 10 +#define DRM_VMW_REF_SURFACE 11 +#define DRM_VMW_EXECBUF 12 +#define DRM_VMW_FIFO_DEBUG 13 +#define DRM_VMW_FENCE_WAIT 14 + /*************************************************************************/ /** @@ -60,8 +64,11 @@ * Does the driver support the overlay ioctl. */ -#define DRM_VMW_PARAM_FIFO_OFFSET 0 -#define DRM_VMW_PARAM_OVERLAY_IOCTL 1 +#define DRM_VMW_PARAM_NUM_STREAMS 0 +#define DRM_VMW_PARAM_NUM_FREE_STREAMS 1 +#define DRM_VMW_PARAM_3D 2 +#define DRM_VMW_PARAM_FIFO_OFFSET 3 + /** * struct drm_vmw_getparam_arg @@ -444,7 +451,7 @@ struct drm_vmw_fence_wait_arg { /*************************************************************************/ /** - * DRM_VMW_OVERLAY - Control overlays. + * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams. * * This IOCTL controls the overlay units of the svga device. * The SVGA overlay units does not work like regular hardware units in @@ -469,7 +476,7 @@ struct drm_vmw_rect { }; /** - * struct drm_vmw_overlay_arg + * struct drm_vmw_control_stream_arg * * @stream_id: Stearm to control * @enabled: If false all following arguments are ignored. @@ -483,10 +490,10 @@ struct drm_vmw_rect { * @src: Source rect, must be within the defined area above. * @dst: Destination rect, x and y may be negative. * - * Argument to the DRM_VMW_OVERLAY Ioctl. + * Argument to the DRM_VMW_CONTROL_STREAM Ioctl. */ -struct drm_vmw_overlay_arg { +struct drm_vmw_control_stream_arg { uint32_t stream_id; uint32_t enabled; @@ -537,4 +544,31 @@ struct drm_vmw_cursor_bypass_arg { int32_t yhot; }; +/*************************************************************************/ +/** + * DRM_VMW_CLAIM_STREAM - Claim a single stream. + */ + +/** + * struct drm_vmw_context_arg + * + * @stream_id: Device unique context ID. + * + * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl. + * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl. + */ + +struct drm_vmw_stream_arg { + uint32_t stream_id; + uint32_t pad64; +}; + +/*************************************************************************/ +/** + * DRM_VMW_UNREF_STREAM - Unclaim a stream. + * + * Return a single stream that was claimed by this process. Also makes + * sure that the stream has been stopped. + */ + #endif diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h index 7265f767a53..3efe851a4be 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h @@ -73,8 +73,6 @@ void vmw_video_stop_all(ScrnInfoPtr pScrn, struct vmw_driver *vmw); * vmw_ioctl.c */ -int vmw_ioctl_supports_overlay(struct vmw_driver *vmw); - int vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot); struct vmw_dma_buffer * vmw_ioctl_buffer_create(struct vmw_driver *vmw, @@ -90,5 +88,14 @@ void vmw_ioctl_buffer_unmap(struct vmw_driver *vmw, void vmw_ioctl_buffer_destroy(struct vmw_driver *vmw, struct vmw_dma_buffer *buf); +int vmw_ioctl_supports_streams(struct vmw_driver *vmw); + +int vmw_ioctl_num_streams(struct vmw_driver *vmw, + uint32_t *ntot, uint32_t *nfree); + +int vmw_ioctl_unref_stream(struct vmw_driver *vmw, uint32_t stream_id); + +int vmw_ioctl_claim_stream(struct vmw_driver *vmw, uint32_t *out); + #endif diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c index 0d1a0fcee63..ab2b5fadc49 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c @@ -75,12 +75,12 @@ vmw_ioctl_get_param(struct vmw_driver *vmw, uint32_t param, uint64_t *out) } int -vmw_ioctl_supports_overlay(struct vmw_driver *vmw) +vmw_ioctl_supports_streams(struct vmw_driver *vmw) { uint64_t value; int ret; - ret = vmw_ioctl_get_param(vmw, DRM_VMW_PARAM_OVERLAY_IOCTL, &value); + ret = vmw_ioctl_get_param(vmw, DRM_VMW_PARAM_NUM_STREAMS, &value); if (ret) return ret; @@ -88,6 +88,58 @@ vmw_ioctl_supports_overlay(struct vmw_driver *vmw) } int +vmw_ioctl_num_streams(struct vmw_driver *vmw, + uint32_t *ntot, uint32_t *nfree) +{ + uint64_t v1, v2; + int ret; + + ret = vmw_ioctl_get_param(vmw, DRM_VMW_PARAM_NUM_STREAMS, &v1); + if (ret) + return ret; + + ret = vmw_ioctl_get_param(vmw, DRM_VMW_PARAM_NUM_FREE_STREAMS, &v2); + if (ret) + return ret; + + *ntot = (uint32_t)v1; + *nfree = (uint32_t)v2; + + return 0; +} + +int +vmw_ioctl_claim_stream(struct vmw_driver *vmw, uint32_t *out) +{ + struct drm_vmw_stream_arg s_arg; + int ret; + + ret = drmCommandRead(vmw->fd, DRM_VMW_CLAIM_STREAM, + &s_arg, sizeof(s_arg)); + + if (ret) + return -1; + + *out = s_arg.stream_id; + return 0; +} + +int +vmw_ioctl_unref_stream(struct vmw_driver *vmw, uint32_t stream_id) +{ + struct drm_vmw_stream_arg s_arg; + int ret; + + memset(&s_arg, 0, sizeof(s_arg)); + s_arg.stream_id = stream_id; + + ret = drmCommandRead(vmw->fd, DRM_VMW_CLAIM_STREAM, + &s_arg, sizeof(s_arg)); + + return 0; +} + +int vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot) { struct drm_vmw_cursor_bypass_arg arg; diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c index 5674e4f3529..b065b96346a 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c @@ -273,11 +273,17 @@ vmw_video_init(ScrnInfoPtr pScrn, struct vmw_driver *vmw) XF86VideoAdaptorPtr *overlayAdaptors, *newAdaptors = NULL; XF86VideoAdaptorPtr newAdaptor = NULL; int numAdaptors; + unsigned int ntot, nfree; debug_printf("%s: enter\n", __func__); - if (vmw_ioctl_supports_overlay(vmw) != 0) { - debug_printf("No overlay ioctl support\n"); + if (vmw_ioctl_num_streams(vmw, &ntot, &nfree) != 0) { + debug_printf("No stream ioctl support\n"); + return FALSE; + } + + if (nfree == 0) { + debug_printf("No free streams\n"); return FALSE; } @@ -353,6 +359,7 @@ vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw) for (i = 0; i < VMWARE_VID_NUM_PORTS; ++i) { /* make sure the port is stoped as well */ vmw_xv_stop_video(pScrn, &video->port[i], TRUE); + vmw_ioctl_unref_stream(vmw, video->port[i].streamId); } /* XXX: I'm sure this function is missing code for turning off Xv */ @@ -448,7 +455,7 @@ vmw_video_init_adaptor(ScrnInfoPtr pScrn, struct vmw_driver *vmw) adaptor->pPortPrivates = video->port_ptr; for (i = 0; i < VMWARE_VID_NUM_PORTS; ++i) { - video->port[i].streamId = i; + vmw_ioctl_claim_stream(vmw, &video->port[i].streamId); video->port[i].play = vmw_video_port_init; video->port[i].flags = SVGA_VIDEO_FLAG_COLORKEY; video->port[i].colorKey = VMWARE_VIDEO_COLORKEY; @@ -577,7 +584,7 @@ vmw_video_port_play(ScrnInfoPtr pScrn, struct vmw_video_port *port, short height, RegionPtr clipBoxes) { struct vmw_driver *vmw = vmw_driver(pScrn); - struct drm_vmw_overlay_arg arg; + struct drm_vmw_control_stream_arg arg; unsigned short w, h; int size; int ret; @@ -636,7 +643,7 @@ vmw_video_port_play(ScrnInfoPtr pScrn, struct vmw_video_port *port, } } - ret = drmCommandWrite(vmw->fd, DRM_VMW_OVERLAY, &arg, sizeof(arg)); + ret = drmCommandWrite(vmw->fd, DRM_VMW_CONTROL_STREAM, &arg, sizeof(arg)); if (ret) { vmw_video_port_cleanup(pScrn, port); return XvBadAlloc; @@ -846,7 +853,7 @@ vmw_xv_stop_video(ScrnInfoPtr pScrn, pointer data, Bool cleanup) { struct vmw_driver *vmw = vmw_driver(pScrn); struct vmw_video_port *port = data; - struct drm_vmw_overlay_arg arg; + struct drm_vmw_control_stream_arg arg; int ret; debug_printf("%s: cleanup is %s\n", __func__, cleanup ? "TRUE" : "FALSE"); @@ -862,7 +869,7 @@ vmw_xv_stop_video(ScrnInfoPtr pScrn, pointer data, Bool cleanup) arg.stream_id = port->streamId; arg.enabled = FALSE; - ret = drmCommandWrite(vmw->fd, DRM_VMW_OVERLAY, &arg, sizeof(arg)); + ret = drmCommandWrite(vmw->fd, DRM_VMW_CONTROL_STREAM, &arg, sizeof(arg)); assert(ret == 0); vmw_video_port_cleanup(pScrn, port); diff --git a/src/gallium/winsys/xlib/Makefile b/src/gallium/winsys/xlib/Makefile index 3dc38a78e45..a0293fe9b4b 100644 --- a/src/gallium/winsys/xlib/Makefile +++ b/src/gallium/winsys/xlib/Makefile @@ -84,11 +84,11 @@ depend: $(XLIB_WINSYS_SOURCES) install: default - $(INSTALL) -d $(INSTALL_DIR)/include/GL - $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR) - $(INSTALL) -m 644 $(TOP)/include/GL/*.h $(INSTALL_DIR)/include/GL + $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL + $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR) + $(INSTALL) -m 644 $(TOP)/include/GL/*.h $(DESTDIR)$(INSTALL_DIR)/include/GL @if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \ - $(MINSTALL) $(TOP)/$(LIB_DIR)/libGL* $(INSTALL_DIR)/$(LIB_DIR); \ + $(MINSTALL) $(TOP)/$(LIB_DIR)/libGL* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \ fi diff --git a/src/glut/glx/glut_menu.c b/src/glut/glx/glut_menu.c index 4c4a5ae7503..d136823c54f 100644 --- a/src/glut/glx/glut_menu.c +++ b/src/glut/glx/glut_menu.c @@ -225,6 +225,7 @@ menuVisualSetup(void) if (!status) { XFreeColormap(__glutDisplay, menuColormap); free(placeHolders); + placeHolders = NULL; continue; } } @@ -241,6 +242,7 @@ menuVisualSetup(void) XFreeColormap(__glutDisplay, menuColormap); if (placeHolders) { free(placeHolders); + placeHolders = NULL; } continue; } @@ -252,6 +254,7 @@ menuVisualSetup(void) XFreeColormap(__glutDisplay, menuColormap); if (placeHolders) { free(placeHolders); + placeHolders = NULL; } continue; } @@ -263,6 +266,7 @@ menuVisualSetup(void) XFreeColormap(__glutDisplay, menuColormap); if (placeHolders) { free(placeHolders); + placeHolders = NULL; } continue; } @@ -271,6 +275,7 @@ menuVisualSetup(void) XFreeColors(__glutDisplay, menuColormap, placeHolders, numPlaceHolders, 0); free(placeHolders); + placeHolders = NULL; } menuWhite = color.pixel; menuVisual = visual->vinfo.visual; diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 39b0ab13c6b..cd9075b3936 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2170,6 +2170,9 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, _mesa_meta_begin(ctx, META_ALL); + if (original_active_unit != 0) + _mesa_BindTexture(target, texObj->Name); + if (mipmap->ArrayObj == 0) { /* one-time setup */ @@ -2289,9 +2292,6 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, /* texture is already locked, unlock now */ _mesa_unlock_texture(ctx, texObj); - if (original_active_unit != 0) - _mesa_BindTexture(target, texObj->Name); - for (dstLevel = baseLevel + 1; dstLevel <= maxLevel; dstLevel++) { const struct gl_texture_image *srcImage; const GLuint srcLevel = dstLevel - 1; diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index da81ec9de51..547f18a009e 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -167,7 +167,7 @@ static int driBindContext(__DRIcontext *pcp, __DRIdrawable *pdp, __DRIdrawable *prp) { - __DRIscreenPrivate *psp; + __DRIscreenPrivate *psp = NULL; /* Bind the drawable to the context */ diff --git a/src/mesa/drivers/dri/i810/i810tris.c b/src/mesa/drivers/dri/i810/i810tris.c index b508496fb69..213ba541cee 100644 --- a/src/mesa/drivers/dri/i810/i810tris.c +++ b/src/mesa/drivers/dri/i810/i810tris.c @@ -270,7 +270,8 @@ do { \ #define LOCAL_VARS(n) \ i810ContextPtr imesa = I810_CONTEXT(ctx); \ - GLuint color[n], spec[n]; \ + GLuint color[n] = { 0 }; \ + GLuint spec[n] = { 0 }; \ GLuint coloroffset = (imesa->vertex_size == 4 ? 3 : 4); \ GLboolean havespec = (imesa->vertex_size > 4); \ (void) color; (void) spec; (void) coloroffset; (void) havespec; diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 2b03331a004..221bf033327 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -139,6 +139,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) GLuint *state = i915->state.Tex[unit], format, pitch; GLint lodbias, aniso = 0; GLubyte border[4]; + GLfloat maxlod; memset(state, 0, sizeof(state)); @@ -176,18 +177,9 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) pitch = intelObj->pitchOverride; } else { - GLuint dst_x, dst_y; - - intel_miptree_get_image_offset(intelObj->mt, intelObj->firstLevel, 0, 0, - &dst_x, &dst_y); - dri_bo_reference(intelObj->mt->region->buffer); i915->state.tex_buffer[unit] = intelObj->mt->region->buffer; - /* XXX: This calculation is probably broken for tiled images with - * a non-page-aligned offset. - */ - i915->state.tex_offset[unit] = (dst_x + dst_y * intelObj->mt->pitch) * - intelObj->mt->cpp; + i915->state.tex_offset[unit] = 0; /* Always the origin of the miptree */ format = translate_texture_format(firstImage->TexFormat, firstImage->InternalFormat, @@ -205,10 +197,14 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) state[I915_TEXREG_MS3] |= MS3_TILE_WALK; } + /* We get one field with fraction bits to cover the maximum addressable (smallest + * resolution) LOD. Use it to cover both MAX_LEVEL and MAX_LOD. + */ + maxlod = MIN2(tObj->MaxLod, tObj->MaxLevel - tObj->BaseLevel); state[I915_TEXREG_MS4] = ((((pitch / 4) - 1) << MS4_PITCH_SHIFT) | MS4_CUBE_FACE_ENA_MASK | - (U_FIXED(CLAMP(tObj->MaxLod, 0.0, 11.0), 2) << MS4_MAX_LOD_SHIFT) | + (U_FIXED(CLAMP(maxlod, 0.0, 11.0), 2) << MS4_MAX_LOD_SHIFT) | ((firstImage->Depth - 1) << MS4_VOLUME_DEPTH_SHIFT)); diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c index ab301b9a3a0..bac1c3a49c3 100644 --- a/src/mesa/drivers/dri/i965/brw_cc.c +++ b/src/mesa/drivers/dri/i965/brw_cc.c @@ -158,9 +158,9 @@ cc_unit_populate_key(struct brw_context *brw, struct brw_cc_unit_key *key) /* If the renderbuffer is XRGB, we have to frob the blend function to * force the destination alpha to 1.0. This means replacing GL_DST_ALPHA - * with GL_ONE and GL_ONE_MINUS_DST_ALPAH with GL_ZERO. + * with GL_ONE and GL_ONE_MINUS_DST_ALPHA with GL_ZERO. */ - if (ctx->Visual.alphaBits == 0) { + if (ctx->DrawBuffer->Visual.alphaBits == 0) { key->blend_src_rgb = fix_xRGB_alpha(key->blend_src_rgb); key->blend_src_a = fix_xRGB_alpha(key->blend_src_a); key->blend_dst_rgb = fix_xRGB_alpha(key->blend_dst_rgb); diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 00efd3443d1..27aac8b54a9 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -392,6 +392,17 @@ static void emit_sge( struct brw_vs_compile *c, emit_sop(c, dst, arg0, arg1, BRW_CONDITIONAL_GE); } +static void emit_cmp( struct brw_compile *p, + struct brw_reg dst, + struct brw_reg arg0, + struct brw_reg arg1, + struct brw_reg arg2 ) +{ + brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, arg0, brw_imm_f(0)); + brw_SEL(p, dst, arg1, arg2); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); +} + static void emit_max( struct brw_compile *p, struct brw_reg dst, struct brw_reg arg0, @@ -1485,6 +1496,9 @@ void brw_vs_emit(struct brw_vs_compile *c ) brw_MOV(p, brw_acc_reg(), args[2]); brw_MAC(p, dst, args[0], args[1]); break; + case OPCODE_CMP: + emit_cmp(p, dst, args[0], args[1], args[2]); + break; case OPCODE_MAX: emit_max(p, dst, args[0], args[1]); break; diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 3f9b1fbfdc6..8335e5a650e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -581,7 +581,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, /* As mentioned above, disable writes to the alpha component when the * renderbuffer is XRGB. */ - if (ctx->Visual.alphaBits == 0) + if (ctx->DrawBuffer->Visual.alphaBits == 0) key.color_mask[3] = GL_FALSE; key.color_blend = (!ctx->Color._LogicOpEnabled && diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index 6b12d484d85..05643189a21 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -191,10 +191,15 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) return; } - /* - * How many color buffers are we drawing into? + /* How many color buffers are we drawing into? + * + * If there are zero buffers or the buffer is too big, don't configure any + * regions for hardware drawing. We'll fallback to software below. Not + * having regions set makes some of the software fallback paths faster. */ - if (fb->_NumColorDrawBuffers == 0) { + if ((fb->Width > ctx->Const.MaxRenderbufferSize) + || (fb->Height > ctx->Const.MaxRenderbufferSize) + || (fb->_NumColorDrawBuffers == 0)) { /* writing to 0 */ colorRegions[0] = NULL; intel->constant_cliprect = GL_TRUE; diff --git a/src/mesa/drivers/dri/mach64/mach64_tris.c b/src/mesa/drivers/dri/mach64/mach64_tris.c index f2e8e2e3ae8..c2a0adfef02 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tris.c +++ b/src/mesa/drivers/dri/mach64/mach64_tris.c @@ -1297,7 +1297,8 @@ do { \ #define LOCAL_VARS(n) \ mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); \ - GLuint color[n], spec[n]; \ + GLuint color[n] = { 0 }; \ + GLuint spec[n] = { 0 }; \ GLuint vertex_size = mmesa->vertex_size; \ const GLuint xyoffset = 9; \ const GLuint coloroffset = 8; \ diff --git a/src/mesa/drivers/dri/mga/mgatris.c b/src/mesa/drivers/dri/mga/mgatris.c index b93a21c3acf..c1bcd4b8531 100644 --- a/src/mesa/drivers/dri/mga/mgatris.c +++ b/src/mesa/drivers/dri/mga/mgatris.c @@ -397,7 +397,8 @@ do { \ #define LOCAL_VARS(n) \ mgaContextPtr mmesa = MGA_CONTEXT(ctx); \ - GLuint color[n], spec[n]; \ + GLuint color[n] = { 0 }; \ + GLuint spec[n] = { 0 }; \ (void) color; (void) spec; diff --git a/src/mesa/drivers/dri/r128/r128_tris.c b/src/mesa/drivers/dri/r128/r128_tris.c index 448e34e047c..86d4717b050 100644 --- a/src/mesa/drivers/dri/r128/r128_tris.c +++ b/src/mesa/drivers/dri/r128/r128_tris.c @@ -216,7 +216,8 @@ do { \ #define LOCAL_VARS(n) \ r128ContextPtr rmesa = R128_CONTEXT(ctx); \ - GLuint color[n], spec[n]; \ + GLuint color[n] = { 0 }; \ + GLuint spec[n] = { 0 }; \ GLuint coloroffset = rmesa->coloroffset; \ GLuint specoffset = rmesa->specoffset; \ GLboolean havespec = (rmesa->specoffset != 0); \ diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index d4a728381e4..eea3dee7bc6 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -181,9 +181,9 @@ void r300SetDepthTexMode(struct gl_texture_object *tObj) R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X16), }, { - R300_EASY_TX_FORMAT(X, X, X, ONE, X24_Y8), - R300_EASY_TX_FORMAT(X, X, X, X, X24_Y8), - R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X24_Y8), + R300_EASY_TX_FORMAT(Y, Y, Y, ONE, X24_Y8), + R300_EASY_TX_FORMAT(Y, Y, Y, Y, X24_Y8), + R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, Y, X24_Y8), }, { R300_EASY_TX_FORMAT(X, X, X, ONE, X32), diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 7b1fa732246..16b05d5cd9a 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -705,6 +705,10 @@ static void r700UpdateCulling(GLcontext * ctx) CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, FACE_bit); /* default: ccw */ break; } + + /* Winding is inverted when rendering to FBO */ + if (ctx->DrawBuffer && ctx->DrawBuffer->Name) + r700->PA_SU_SC_MODE_CNTL.u32All ^= FACE_bit; } static void r700UpdateLineStipple(GLcontext * ctx) diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index a7f347202a1..033f26db2a1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -452,7 +452,10 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_bo_unmap(image->mt->bo); radeon_miptree_unreference(&image->mt); - } else { + } else if (image->base.Data) { + /* This condition should be removed, it's here to workaround + * a segfault when mapping textures during software fallbacks. + */ const uint32_t srcrowstride = _mesa_format_row_stride(image->base.TexFormat, image->base.Width); uint32_t rows = image->base.Height * image->base.Depth; diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 28690325d12..03178116c1a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -472,6 +472,19 @@ gl_format radeonChooseTextureFormat(GLcontext * ctx, case GL_RGBA32F_ARB: return MESA_FORMAT_RGBA_FLOAT32; +#ifdef RADEON_R300 + case GL_DEPTH_COMPONENT: + case GL_DEPTH_COMPONENT16: + return MESA_FORMAT_Z16; + case GL_DEPTH_COMPONENT24: + case GL_DEPTH_COMPONENT32: + case GL_DEPTH_STENCIL_EXT: + case GL_DEPTH24_STENCIL8_EXT: + if (rmesa->radeonScreen->chip_family >= CHIP_FAMILY_RV515) + return MESA_FORMAT_S8_Z24; + else + return MESA_FORMAT_Z16; +#else case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16: case GL_DEPTH_COMPONENT24: @@ -479,6 +492,7 @@ gl_format radeonChooseTextureFormat(GLcontext * ctx, case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: return MESA_FORMAT_S8_Z24; +#endif /* EXT_texture_sRGB */ case GL_SRGB: diff --git a/src/mesa/drivers/dri/savage/savageioctl.c b/src/mesa/drivers/dri/savage/savageioctl.c index 948ed18419e..77ab8d16e0a 100644 --- a/src/mesa/drivers/dri/savage/savageioctl.c +++ b/src/mesa/drivers/dri/savage/savageioctl.c @@ -337,6 +337,8 @@ static void savageDDClear( GLcontext *ctx, GLbitfield mask ) GLint ch = ctx->DrawBuffer->_Ymax - cy; /* XXX FIX ME: the cx,cy,cw,ch vars are currently ignored! */ + (void) ch; + (void) cw; if (SAVAGE_DEBUG & DEBUG_VERBOSE_MSG) fprintf (stderr, "%s\n", __FUNCTION__); diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c index e9529d19391..9a92541ef7e 100644 --- a/src/mesa/drivers/dri/savage/savagetris.c +++ b/src/mesa/drivers/dri/savage/savagetris.c @@ -435,7 +435,8 @@ do { \ #define LOCAL_VARS(n) \ savageContextPtr imesa = SAVAGE_CONTEXT(ctx); \ - GLuint color[n], spec[n]; \ + GLuint color[n] = { 0 }; \ + GLuint spec[n] = { 0 }; \ GLuint coloroffset = \ ((imesa->skip & SAVAGE_SKIP_W) ? 3 : 4); \ GLboolean specoffset = \ diff --git a/src/mesa/drivers/dri/sis/sis_clear.c b/src/mesa/drivers/dri/sis/sis_clear.c index 323383da62a..d358ef62dc7 100644 --- a/src/mesa/drivers/dri/sis/sis_clear.c +++ b/src/mesa/drivers/dri/sis/sis_clear.c @@ -393,7 +393,6 @@ sis_clear_z_stencil_buffer( GLcontext * ctx, GLbitfield mask, GLint x, GLint y, GLint width, GLint height ) { sisContextPtr smesa = SIS_CONTEXT(ctx); - int cmd; mWait3DCmdQueue (8); MMIO(REG_SRC_PITCH, (smesa->zFormat == SiS_ZFORMAT_Z16) ? diff --git a/src/mesa/drivers/dri/sis/sis_tris.c b/src/mesa/drivers/dri/sis/sis_tris.c index 3cf10007b58..4690274c3c0 100644 --- a/src/mesa/drivers/dri/sis/sis_tris.c +++ b/src/mesa/drivers/dri/sis/sis_tris.c @@ -430,7 +430,8 @@ do { \ #define LOCAL_VARS(n) \ sisContextPtr smesa = SIS_CONTEXT(ctx); \ - GLuint color[n], spec[n]; \ + GLuint color[n] = { 0 }; \ + GLuint spec[n] = { 0 }; \ GLuint coloroffset = smesa->coloroffset; \ GLuint specoffset = smesa->specoffset; \ (void) color; (void) spec; (void) coloroffset; (void) specoffset; diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index b34c133600a..91c94fa377d 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -885,7 +885,6 @@ void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags) } else if (vmesa->numClipRects) { drm_clip_rect_t *pbox = vmesa->pClipRects; - __DRIdrawablePrivate *dPriv = vmesa->driDrawable; for (i = 0; i < vmesa->numClipRects; i++) { drm_clip_rect_t b; diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c index ab457d41dc8..01359d51ea6 100644 --- a/src/mesa/drivers/dri/unichrome/via_tris.c +++ b/src/mesa/drivers/dri/unichrome/via_tris.c @@ -330,7 +330,8 @@ do { \ #define LOCAL_VARS(n) \ struct via_context *vmesa = VIA_CONTEXT(ctx); \ - GLuint color[n], spec[n]; \ + GLuint color[n] = { 0 }; \ + GLuint spec[n] = { 0 }; \ GLuint coloroffset = vmesa->coloroffset; \ GLuint specoffset = vmesa->specoffset; \ (void)color; (void)spec; (void)coloroffset; (void)specoffset; diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index 87c3b2e5621..4eb249b4af1 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -234,7 +234,7 @@ extern "C" { #elif defined(__APPLE__) #include <CoreFoundation/CFByteOrder.h> #define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x ) -#elif defined(_AIX) +#elif (defined(_AIX) || defined(__blrts)) #define CPU_TO_LE32( x ) x = ((x & 0x000000ff) << 24) | \ ((x & 0x0000ff00) << 8) | \ ((x & 0x00ff0000) >> 8) | \ diff --git a/src/mesa/main/dlopen.c b/src/mesa/main/dlopen.c index 414cfad8e26..81e032081db 100644 --- a/src/mesa/main/dlopen.c +++ b/src/mesa/main/dlopen.c @@ -31,7 +31,7 @@ #include "compiler.h" #include "dlopen.h" -#if defined(_GNU_SOURCE) && !defined(__MINGW32__) +#if defined(_GNU_SOURCE) && !defined(__MINGW32__) && !defined(__blrts) #include <dlfcn.h> #endif #if defined(_WIN32) @@ -46,7 +46,9 @@ void * _mesa_dlopen(const char *libname, int flags) { -#if defined(_GNU_SOURCE) +#if defined(__blrts) + return NULL; +#elif defined(_GNU_SOURCE) flags = RTLD_LAZY | RTLD_GLOBAL; /* Overriding flags at this time */ return dlopen(libname, flags); #elif defined(__MINGW32__) @@ -65,7 +67,9 @@ _mesa_dlopen(const char *libname, int flags) GenericFunc _mesa_dlsym(void *handle, const char *fname) { -#if defined(__DJGPP__) +#if defined(__blrts) + return (GenericFunc) NULL; +#elif defined(__DJGPP__) /* need '_' prefix on symbol names */ char fname2[1000]; fname2[0] = '_'; @@ -88,7 +92,9 @@ _mesa_dlsym(void *handle, const char *fname) void _mesa_dlclose(void *handle) { -#if defined(_GNU_SOURCE) +#if defined(__blrts) + (void) handle; +#elif defined(_GNU_SOURCE) dlclose(handle); #elif defined(__MINGW32__) FreeLibrary(handle); diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 26ae453f0be..19b8e517259 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -2848,6 +2848,7 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) slang_info_log info_log; slang_code_object obj; slang_unit_type type; + GLenum progTarget; if (shader->Type == GL_VERTEX_SHADER) { type = SLANG_UNIT_VERTEX_SHADER; @@ -2864,17 +2865,18 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) shader->Main = GL_FALSE; - if (!shader->Program) { - GLenum progTarget; - if (shader->Type == GL_VERTEX_SHADER) - progTarget = GL_VERTEX_PROGRAM_ARB; - else - progTarget = GL_FRAGMENT_PROGRAM_ARB; - shader->Program = ctx->Driver.NewProgram(ctx, progTarget, 1); - shader->Program->Parameters = _mesa_new_parameter_list(); - shader->Program->Varying = _mesa_new_parameter_list(); - shader->Program->Attributes = _mesa_new_parameter_list(); - } + /* free the shader's old instructions, etc */ + _mesa_reference_program(ctx, &shader->Program, NULL); + + /* allocate new GPU program, parameter lists, etc. */ + if (shader->Type == GL_VERTEX_SHADER) + progTarget = GL_VERTEX_PROGRAM_ARB; + else + progTarget = GL_FRAGMENT_PROGRAM_ARB; + shader->Program = ctx->Driver.NewProgram(ctx, progTarget, 1); + shader->Program->Parameters = _mesa_new_parameter_list(); + shader->Program->Varying = _mesa_new_parameter_list(); + shader->Program->Attributes = _mesa_new_parameter_list(); slang_info_log_construct(&info_log); _slang_code_object_ctr(&obj); diff --git a/src/mesa/shader/slang/slang_compile_operation.c b/src/mesa/shader/slang/slang_compile_operation.c index 3e2bdbc91ff..be73094ca04 100644 --- a/src/mesa/shader/slang/slang_compile_operation.c +++ b/src/mesa/shader/slang/slang_compile_operation.c @@ -52,6 +52,7 @@ slang_operation_construct(slang_operation * oper) _slang_variable_scope_ctr(oper->locals); oper->fun = NULL; oper->var = NULL; + oper->label = NULL; return GL_TRUE; } diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index e13ae57a0ec..d297b9bc06d 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -381,7 +381,7 @@ setup_interleaved_attribs(GLcontext *ctx, { struct pipe_context *pipe = ctx->st->pipe; GLuint attr; - const GLubyte *offset0; + const GLubyte *offset0 = NULL; for (attr = 0; attr < vp->num_inputs; attr++) { const GLuint mesaAttr = vp->index_to_input[attr]; @@ -560,7 +560,7 @@ st_draw_vbo(GLcontext *ctx, GLuint attr; struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS]; unsigned num_vbuffers, num_velements; - GLboolean userSpace; + GLboolean userSpace = GL_FALSE; /* Gallium probably doesn't want this in some cases. */ if (!index_bounds_valid) diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 5a433dd7b90..2c283d464ae 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -225,6 +225,9 @@ st_generate_mipmap(GLcontext *ctx, GLenum target, /* find expected last mipmap level */ lastLevel = compute_num_levels(ctx, texObj, target) - 1; + if (lastLevel == 0) + return; + if (pt->last_level < lastLevel) { /* The current gallium texture doesn't have space for all the * mipmap levels we need to generate. So allocate a new texture. diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 5c81a033f9c..d91ed6806dc 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -102,6 +102,8 @@ st_prepare_vertex_program(struct st_context *st, if (stvp->Base.IsPositionInvariant) _mesa_insert_mvp_code(st->ctx, &stvp->Base); + assert(stvp->Base.Base.NumInstructions > 1); + /* * Determine number of inputs, the mappings between VERT_ATTRIB_x * and TGSI generic input indexes, plus input attrib semantic info. diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c index 5fefae6c42b..e88ff191239 100644 --- a/src/mesa/swrast/s_atifragshader.c +++ b/src/mesa/swrast/s_atifragshader.c @@ -279,7 +279,7 @@ handle_sample_op(GLcontext * ctx, struct atifs_machine *machine, /* sample from unit idx using texinst->src as coords */ GLuint swizzle = texinst->swizzle; GLuint coord_source = texinst->src; - GLfloat tex_coords[4]; + GLfloat tex_coords[4] = { 0 }; if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) { coord_source -= GL_TEXTURE0_ARB; diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index d80a6761f40..5bec6066967 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -553,6 +553,9 @@ affine_span(GLcontext *ctx, SWspan *span, info.format = texImg->TexFormat; \ info.filter = obj->MinFilter; \ info.envmode = unit->EnvMode; \ + info.er = 0; \ + info.eg = 0; \ + info.eb = 0; \ span.arrayMask |= SPAN_RGBA; \ \ if (info.envmode == GL_BLEND) { \ @@ -815,6 +818,9 @@ fast_persp_span(GLcontext *ctx, SWspan *span, info.format = texImg->TexFormat; \ info.filter = obj->MinFilter; \ info.envmode = unit->EnvMode; \ + info.er = 0; \ + info.eg = 0; \ + info.eb = 0; \ \ if (info.envmode == GL_BLEND) { \ /* potential off-by-one error here? (1.0f -> 2048 -> 0) */ \ diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h index 17f38639563..8484aab5a93 100644 --- a/src/mesa/swrast_setup/ss_tritmp.h +++ b/src/mesa/swrast_setup/ss_tritmp.h @@ -41,9 +41,9 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) GLenum mode = GL_FILL; GLuint facing = 0; GLchan saved_color[3][4]; - GLfloat saved_col0[3][4]; - GLfloat saved_spec[3][4]; - GLfloat saved_index[3]; + GLfloat saved_col0[3][4] = { { 0 } }; + GLfloat saved_spec[3][4] = { { 0 } }; + GLfloat saved_index[3] = { 0 }; v[0] = &verts[e0]; v[1] = &verts[e1]; diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h index e5885782c7a..2424204b886 100644 --- a/src/mesa/tnl_dd/t_dd_dmatmp.h +++ b/src/mesa/tnl_dd/t_dd_dmatmp.h @@ -241,6 +241,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx, tmp = ALLOC_VERTS(nr+1); tmp = TAG(emit_verts)( ctx, j, nr, tmp ); tmp = TAG(emit_verts)( ctx, start, 1, tmp ); + (void) tmp; } else { TAG(emit_verts)( ctx, j, nr, ALLOC_VERTS(nr) ); @@ -254,6 +255,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx, tmp = ALLOC_VERTS(2); tmp = TAG(emit_verts)( ctx, start+1, 1, tmp ); tmp = TAG(emit_verts)( ctx, start, 1, tmp ); + (void) tmp; } FLUSH(); @@ -358,6 +360,7 @@ static void TAG(render_tri_fan_verts)( GLcontext *ctx, tmp = ALLOC_VERTS( nr ); tmp = TAG(emit_verts)( ctx, start, 1, tmp ); tmp = TAG(emit_verts)( ctx, j, nr - 1, tmp ); + (void) tmp; currentsz = dmasz; } @@ -397,6 +400,7 @@ static void TAG(render_poly_verts)( GLcontext *ctx, tmp = ALLOC_VERTS( nr ); tmp = TAG(emit_verts)( ctx, start, 1, tmp ); tmp = TAG(emit_verts)( ctx, j, nr - 1, tmp ); + (void) tmp; currentsz = dmasz; } @@ -634,6 +638,7 @@ static void TAG(render_quads_verts)( GLcontext *ctx, /* Send v1, v2, v3 */ tmp = EMIT_VERTS(ctx, j + 1, 3, tmp); + (void) tmp; } } else { @@ -820,6 +825,7 @@ static void TAG(render_line_loop_elts)( GLcontext *ctx, tmp = ALLOC_ELTS(nr+1); tmp = TAG(emit_elts)( ctx, elts+j, nr, tmp ); tmp = TAG(emit_elts)( ctx, elts+start, 1, tmp ); + (void) tmp; } else { TAG(emit_elts)( ctx, elts+j, nr, ALLOC_ELTS(nr) ); @@ -833,6 +839,7 @@ static void TAG(render_line_loop_elts)( GLcontext *ctx, tmp = ALLOC_ELTS(2); tmp = TAG(emit_elts)( ctx, elts+start+1, 1, tmp ); tmp = TAG(emit_elts)( ctx, elts+start, 1, tmp ); + (void) tmp; } FLUSH(); @@ -946,6 +953,7 @@ static void TAG(render_tri_fan_elts)( GLcontext *ctx, tmp = ALLOC_ELTS( nr ); tmp = TAG(emit_elts)( ctx, elts+start, 1, tmp ); tmp = TAG(emit_elts)( ctx, elts+j, nr - 1, tmp ); + (void) tmp; FLUSH(); currentsz = dmasz; } @@ -983,6 +991,7 @@ static void TAG(render_poly_elts)( GLcontext *ctx, tmp = ALLOC_ELTS( nr ); tmp = TAG(emit_elts)( ctx, elts+start, 1, tmp ); tmp = TAG(emit_elts)( ctx, elts+j, nr - 1, tmp ); + (void) tmp; FLUSH(); currentsz = dmasz; } diff --git a/src/mesa/tnl_dd/t_dd_dmatmp2.h b/src/mesa/tnl_dd/t_dd_dmatmp2.h index 2380c49fdf4..cd225b6343e 100644 --- a/src/mesa/tnl_dd/t_dd_dmatmp2.h +++ b/src/mesa/tnl_dd/t_dd_dmatmp2.h @@ -266,6 +266,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx, if (j + nr < count) { ELT_TYPE *dest = ALLOC_ELTS( nr ); dest = TAG(emit_consecutive_elts)( ctx, dest, j, nr ); + (void) dest; j += nr - 1; CLOSE_ELTS(); } @@ -273,6 +274,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx, ELT_TYPE *dest = ALLOC_ELTS( nr + 1 ); dest = TAG(emit_consecutive_elts)( ctx, dest, j, nr ); dest = TAG(emit_consecutive_elts)( ctx, dest, start, 1 ); + (void) dest; j += nr; CLOSE_ELTS(); } @@ -554,6 +556,7 @@ static void TAG(render_points_elts)( GLcontext *ctx, nr = MIN2( dmasz, count - j ); dest = ALLOC_ELTS( nr ); dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); + (void) dest; CLOSE_ELTS(); } } @@ -590,6 +593,7 @@ static void TAG(render_lines_elts)( GLcontext *ctx, nr = MIN2( dmasz, count - j ); dest = ALLOC_ELTS( nr ); dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); + (void) dest; CLOSE_ELTS(); } @@ -621,6 +625,7 @@ static void TAG(render_line_strip_elts)( GLcontext *ctx, nr = MIN2( dmasz, count - j ); dest = ALLOC_ELTS( nr ); dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); + (void) dest; CLOSE_ELTS(); } } @@ -671,6 +676,7 @@ static void TAG(render_line_loop_elts)( GLcontext *ctx, j += nr - 1; if (j + 1 >= count && (flags & PRIM_END)) { dest = TAG(emit_elts)( ctx, dest, elts+start, 1 ); + (void) dest; } CLOSE_ELTS(); } @@ -703,6 +709,7 @@ static void TAG(render_triangles_elts)( GLcontext *ctx, nr = MIN2( dmasz, count - j ); dest = ALLOC_ELTS( nr ); dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); + (void) dest; CLOSE_ELTS(); } } @@ -734,6 +741,7 @@ static void TAG(render_tri_strip_elts)( GLcontext *ctx, dest = ALLOC_ELTS( nr ); dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); + (void) dest; CLOSE_ELTS(); } } @@ -759,6 +767,7 @@ static void TAG(render_tri_fan_elts)( GLcontext *ctx, dest = ALLOC_ELTS( nr ); dest = TAG(emit_elts)( ctx, dest, elts+start, 1 ); dest = TAG(emit_elts)( ctx, dest, elts+j, nr - 1 ); + (void) dest; CLOSE_ELTS(); } } @@ -785,6 +794,7 @@ static void TAG(render_poly_elts)( GLcontext *ctx, dest = ALLOC_ELTS( nr ); dest = TAG(emit_elts)( ctx, dest, elts+start, 1 ); dest = TAG(emit_elts)( ctx, dest, elts+j, nr - 1 ); + (void) dest; CLOSE_ELTS(); } } @@ -843,6 +853,7 @@ static void TAG(render_quad_strip_elts)( GLcontext *ctx, nr = MIN2( dmasz, count - j ); dest = ALLOC_ELTS( nr ); dest = TAG(emit_elts)( ctx, dest, elts+j, nr ); + (void) dest; CLOSE_ELTS(); } } diff --git a/src/mesa/tnl_dd/t_dd_tritmp.h b/src/mesa/tnl_dd/t_dd_tritmp.h index 8574fe618b5..6acd837317f 100644 --- a/src/mesa/tnl_dd/t_dd_tritmp.h +++ b/src/mesa/tnl_dd/t_dd_tritmp.h @@ -132,7 +132,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb; VERTEX *v[3]; GLfloat offset = 0; - GLfloat z[3]; + GLfloat z[3] = { 0 }; GLenum mode = GL_FILL; GLuint facing = 0; LOCAL_VARS(3); @@ -395,7 +395,7 @@ static void TAG(quadr)( GLcontext *ctx, struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb; VERTEX *v[4]; GLfloat offset = 0; - GLfloat z[4]; + GLfloat z[4] = { 0 }; GLenum mode = GL_FILL; GLuint facing = 0; LOCAL_VARS(4); diff --git a/src/mesa/x86/rtasm/x86sse.c b/src/mesa/x86/rtasm/x86sse.c index 5aedf5b04be..647be995c12 100644 --- a/src/mesa/x86/rtasm/x86sse.c +++ b/src/mesa/x86/rtasm/x86sse.c @@ -7,10 +7,12 @@ #define DISASSEM 0 #define X86_TWOB 0x0f +#if 0 static unsigned char *cptr( void (*label)() ) { return (unsigned char *)(unsigned long)label; } +#endif static void do_realloc( struct x86_function *p ) |