Merge branch 'mesa_7_7_branch'
authorBrian Paul <brianp@vmware.com>
Fri, 22 Jan 2010 19:17:02 +0000 (12:17 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 22 Jan 2010 19:17:02 +0000 (12:17 -0700)
Conflicts:
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
src/gallium/auxiliary/pipebuffer/Makefile
src/gallium/auxiliary/pipebuffer/SConscript
src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
src/gallium/auxiliary/tgsi/tgsi_scan.c
src/gallium/drivers/i915/i915_surface.c
src/gallium/drivers/i915/i915_texture.c
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_tex_sample_c.c
src/gallium/drivers/llvmpipe/lp_texture.c
src/gallium/drivers/softpipe/sp_prim_vbuf.c
src/gallium/state_trackers/xorg/xorg_dri2.c
src/gallium/winsys/drm/intel/gem/intel_drm_api.c
src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
src/gallium/winsys/drm/radeon/core/radeon_drm.c
src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
src/mesa/state_tracker/st_cb_clear.c

116 files changed:
1  2 
src/gallium/auxiliary/Makefile
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_pt.c
src/gallium/auxiliary/draw/draw_pt_fetch.c
src/gallium/auxiliary/draw/draw_pt_post_vs.c
src/gallium/auxiliary/draw/draw_vs_varient.c
src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
src/gallium/auxiliary/tgsi/tgsi_scan.c
src/gallium/auxiliary/util/u_blit.c
src/gallium/auxiliary/util/u_gen_mipmap.c
src/gallium/drivers/i915/i915_context.c
src/gallium/drivers/i915/i915_state.c
src/gallium/drivers/i915/i915_state_derived.c
src/gallium/drivers/i915/i915_state_sampler.c
src/gallium/drivers/i915/i915_surface.c
src/gallium/drivers/i915/i915_texture.c
src/gallium/drivers/llvmpipe/lp_bld_arit.c
src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c
src/gallium/drivers/llvmpipe/lp_draw_arrays.c
src/gallium/drivers/llvmpipe/lp_jit.c
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/llvmpipe/lp_state_surface.c
src/gallium/drivers/llvmpipe/lp_test_blend.c
src/gallium/drivers/llvmpipe/lp_tex_cache.c
src/gallium/drivers/llvmpipe/lp_texture.c
src/gallium/drivers/llvmpipe/lp_tile_cache.c
src/gallium/drivers/softpipe/sp_context.c
src/gallium/drivers/softpipe/sp_flush.c
src/gallium/drivers/softpipe/sp_prim_vbuf.c
src/gallium/drivers/softpipe/sp_quad_depth_test.c
src/gallium/drivers/softpipe/sp_setup.c
src/gallium/drivers/softpipe/sp_state_surface.c
src/gallium/drivers/softpipe/sp_tex_tile_cache.c
src/gallium/drivers/softpipe/sp_texture.c
src/gallium/drivers/svga/svga_pipe_constants.c
src/gallium/drivers/svga/svga_pipe_draw.c
src/gallium/drivers/svga/svga_pipe_sampler.c
src/gallium/drivers/svga/svga_pipe_vertex.c
src/gallium/drivers/svga/svga_pipe_vs.c
src/gallium/drivers/svga/svga_screen_buffer.c
src/gallium/drivers/svga/svga_screen_texture.c
src/gallium/drivers/svga/svga_swtnl_draw.c
src/gallium/drivers/svga/svga_swtnl_state.c
src/gallium/drivers/svga/svga_tgsi_decl_sm20.c
src/gallium/drivers/svga/svga_tgsi_decl_sm30.c
src/gallium/include/state_tracker/drm_api.h
src/gallium/state_trackers/dri/dri_context.c
src/gallium/state_trackers/dri/dri_drawable.c
src/gallium/state_trackers/dri/dri_screen.c
src/gallium/state_trackers/dri/dri_screen.h
src/gallium/state_trackers/wgl/stw_pixelformat.c
src/gallium/state_trackers/xorg/xorg_composite.c
src/gallium/state_trackers/xorg/xorg_dri2.c
src/gallium/state_trackers/xorg/xorg_exa.c
src/gallium/state_trackers/xorg/xorg_xv.c
src/gallium/winsys/drm/intel/gem/intel_drm_api.c
src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c
src/gallium/winsys/drm/radeon/core/radeon_drm.c
src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c
src/gallium/winsys/xlib/xlib_softpipe.c
src/mesa/drivers/dri/ffb/ffb_bitmap.c
src/mesa/drivers/dri/ffb/ffb_clear.c
src/mesa/drivers/dri/ffb/ffb_depth.c
src/mesa/drivers/dri/ffb/ffb_span.c
src/mesa/drivers/dri/ffb/ffb_state.c
src/mesa/drivers/dri/ffb/ffb_stencil.c
src/mesa/drivers/dri/ffb/ffb_xmesa.c
src/mesa/drivers/dri/i810/i810context.c
src/mesa/drivers/dri/i810/i810screen.c
src/mesa/drivers/dri/i810/i810state.c
src/mesa/drivers/dri/i810/i810tex.c
src/mesa/drivers/dri/mach64/mach64_context.c
src/mesa/drivers/dri/mach64/mach64_lock.c
src/mesa/drivers/dri/mach64/mach64_screen.c
src/mesa/drivers/dri/mach64/mach64_span.c
src/mesa/drivers/dri/mach64/mach64_state.c
src/mesa/drivers/dri/mach64/mach64_tex.c
src/mesa/drivers/dri/r600/r600_texstate.c
src/mesa/drivers/dri/r600/r700_state.c
src/mesa/drivers/dri/unichrome/via_context.c
src/mesa/drivers/dri/unichrome/via_ioctl.c
src/mesa/drivers/dri/unichrome/via_screen.c
src/mesa/drivers/dri/unichrome/via_state.c
src/mesa/main/attrib.c
src/mesa/main/blend.c
src/mesa/main/dlist.c
src/mesa/main/enable.c
src/mesa/main/fbobject.c
src/mesa/main/image.c
src/mesa/main/texgetimage.c
src/mesa/main/texobj.c
src/mesa/main/texparam.c
src/mesa/shader/arbprogparse.c
src/mesa/shader/prog_execute.c
src/mesa/shader/slang/slang_compile.c
src/mesa/shader/slang/slang_emit.c
src/mesa/shader/slang/slang_link.c
src/mesa/state_tracker/st_atom_framebuffer.c
src/mesa/state_tracker/st_atom_pixeltransfer.c
src/mesa/state_tracker/st_atom_sampler.c
src/mesa/state_tracker/st_atom_shader.c
src/mesa/state_tracker/st_cb_accum.c
src/mesa/state_tracker/st_cb_bitmap.c
src/mesa/state_tracker/st_cb_clear.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_fbo.c
src/mesa/state_tracker/st_cb_program.c
src/mesa/state_tracker/st_cb_queryobj.c
src/mesa/state_tracker/st_cb_readpixels.c
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_draw_feedback.c
src/mesa/state_tracker/st_extensions.c
src/mesa/state_tracker/st_format.c
src/mesa/state_tracker/st_gen_mipmap.c
src/mesa/swrast/s_span.c

index 8f937e3b4e9dbdab946b93394dbaa624fbf95d30,5446eb68a985f445980df4a975591ce0c3bb0a15..9b6babce33faf655784e4a6a47b58340f25eab36
  TOP = ../../..
  include $(TOP)/configs/current
  
 -SUBDIRS = $(GALLIUM_AUXILIARY_DIRS)
 +LIBNAME = gallium
  
 -default install clean:
 -      @for dir in $(SUBDIRS) ; do \
 -              if [ -d $$dir ] ; then \
 -                      (cd $$dir && $(MAKE) $@) || exit 1; \
 -              fi \
 -      done
 +C_SOURCES = \
 +      cso_cache/cso_context.c \
 +      cso_cache/cso_cache.c \
 +      cso_cache/cso_hash.c \
 +      draw/draw_context.c \
 +      draw/draw_gs.c \
 +      draw/draw_pipe.c \
 +      draw/draw_pipe_aaline.c \
 +      draw/draw_pipe_aapoint.c \
 +      draw/draw_pipe_clip.c \
 +      draw/draw_pipe_cull.c \
 +      draw/draw_pipe_flatshade.c \
 +      draw/draw_pipe_offset.c \
 +      draw/draw_pipe_pstipple.c \
 +      draw/draw_pipe_stipple.c \
 +      draw/draw_pipe_twoside.c \
 +      draw/draw_pipe_unfilled.c \
 +      draw/draw_pipe_util.c \
 +      draw/draw_pipe_validate.c \
 +      draw/draw_pipe_vbuf.c \
 +      draw/draw_pipe_wide_line.c \
 +      draw/draw_pipe_wide_point.c \
 +      draw/draw_pt.c \
 +      draw/draw_pt_elts.c \
 +      draw/draw_pt_emit.c \
 +      draw/draw_pt_fetch.c \
 +      draw/draw_pt_fetch_emit.c \
 +      draw/draw_pt_fetch_shade_emit.c \
 +      draw/draw_pt_fetch_shade_pipeline.c \
 +      draw/draw_pt_post_vs.c \
 +      draw/draw_pt_util.c \
 +      draw/draw_pt_varray.c \
 +      draw/draw_pt_vcache.c \
 +      draw/draw_vertex.c \
 +      draw/draw_vs.c \
 +      draw/draw_vs_varient.c \
 +      draw/draw_vs_aos.c \
 +      draw/draw_vs_aos_io.c \
 +      draw/draw_vs_aos_machine.c \
 +      draw/draw_vs_exec.c \
 +      draw/draw_vs_llvm.c \
 +      draw/draw_vs_ppc.c \
 +      draw/draw_vs_sse.c \
 +      indices/u_indices_gen.c \
 +      indices/u_unfilled_gen.c \
-       pipebuffer/pb_buffer_fenced.c \
 +      pipebuffer/pb_buffer_malloc.c \
 +      pipebuffer/pb_bufmgr_alt.c \
 +      pipebuffer/pb_bufmgr_cache.c \
 +      pipebuffer/pb_bufmgr_debug.c \
-       pipebuffer/pb_bufmgr_fenced.c \
 +      pipebuffer/pb_bufmgr_mm.c \
 +      pipebuffer/pb_bufmgr_ondemand.c \
 +      pipebuffer/pb_bufmgr_pool.c \
 +      pipebuffer/pb_bufmgr_slab.c \
 +      pipebuffer/pb_validate.c \
 +      rbug/rbug_connection.c \
 +      rbug/rbug_core.c \
 +      rbug/rbug_texture.c \
 +      rbug/rbug_context.c \
 +      rbug/rbug_shader.c \
 +      rbug/rbug_demarshal.c \
 +      rtasm/rtasm_cpu.c \
 +      rtasm/rtasm_execmem.c \
 +      rtasm/rtasm_x86sse.c \
 +      rtasm/rtasm_ppc.c \
 +      rtasm/rtasm_ppc_spe.c \
 +      tgsi/tgsi_sanity.c \
 +      tgsi/tgsi_build.c \
 +      tgsi/tgsi_dump.c \
 +      tgsi/tgsi_exec.c \
 +      tgsi/tgsi_info.c \
 +      tgsi/tgsi_iterate.c \
 +      tgsi/tgsi_parse.c \
 +      tgsi/tgsi_ppc.c \
 +      tgsi/tgsi_scan.c \
 +      tgsi/tgsi_sse2.c \
 +      tgsi/tgsi_text.c \
 +      tgsi/tgsi_transform.c \
 +      tgsi/tgsi_ureg.c \
 +      tgsi/tgsi_util.c \
 +      translate/translate_generic.c \
 +      translate/translate_sse.c \
 +      translate/translate.c \
 +      translate/translate_cache.c \
 +      util/u_debug.c \
 +      util/u_debug_dump.c \
 +      util/u_debug_symbol.c \
 +      util/u_debug_stack.c \
 +      util/u_blit.c \
 +      util/u_blitter.c \
 +      util/u_cache.c \
 +      util/u_cpu_detect.c \
 +      util/u_dl.c \
 +      util/u_draw_quad.c \
 +      util/u_format.c \
 +      util/u_format_access.c \
 +      util/u_format_table.c \
 +      util/u_gen_mipmap.c \
 +      util/u_handle_table.c \
 +      util/u_hash_table.c \
 +      util/u_hash.c \
 +      util/u_keymap.c \
 +      util/u_linear.c \
 +      util/u_network.c \
 +      util/u_math.c \
 +      util/u_mm.c \
 +      util/u_rect.c \
 +      util/u_ringbuffer.c \
 +      util/u_simple_shaders.c \
 +      util/u_snprintf.c \
 +      util/u_stream_stdc.c \
 +      util/u_stream_wd.c \
 +      util/u_surface.c \
 +      util/u_texture.c \
 +      util/u_tile.c \
 +      util/u_time.c \
 +      util/u_timed_winsys.c \
 +      util/u_upload_mgr.c \
 +      util/u_simple_screen.c \
 +      vl/vl_bitstream_parser.c \
 +      vl/vl_mpeg12_mc_renderer.c \
 +      vl/vl_compositor.c \
 +      vl/vl_csc.c \
 +      vl/vl_shader_build.c
 +
 +GALLIVM_SOURCES = \
 +      gallivm/gallivm.cpp  \
 +      gallivm/gallivm_cpu.cpp \
 +      gallivm/instructions.cpp  \
 +      gallivm/loweringpass.cpp \
 +      gallivm/tgsitollvm.cpp \
 +      gallivm/storage.cpp \
 +      gallivm/storagesoa.cpp \
 +      gallivm/instructionssoa.cpp
 +
 +INC_SOURCES = \
 +      gallivm/gallivm_builtins.cpp \
 +      gallivm/gallivmsoabuiltins.cpp
 +
 +# XXX: gallivm doesn't build correctly so disable for now
 +#ifeq ($(MESA_LLVM),1)
 +#DEFINES += -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
 +#CPP_SOURCES += \
 +#     $(GALLIVM_SOURCES)
 +#endif
 +
 +
 +include ../Makefile.template
 +
 +
 +gallivm/gallivm_builtins.cpp: gallivm/llvm_builtins.c
 +      clang --emit-llvm < $< |llvm-as|opt -std-compile-opts > temp1.bin
 +      (echo "static const unsigned char llvm_builtins_data[] = {"; od -txC temp1.bin | sed -e "s/^[0-9]*//" -e s"/ \([0-9a-f][0-9a-f]\)/0x\1,/g" -e"\$$d" | sed -e"\$$s/,$$/,0x00};/") >$@
 +      rm temp1.bin
 +
 +gallivm/gallivmsoabuiltins.cpp: gallivm/soabuiltins.c
 +      clang --emit-llvm < $< |llvm-as|opt -std-compile-opts > temp2.bin
 +      (echo "static const unsigned char soabuiltins_data[] = {"; od -txC temp2.bin | sed -e "s/^[0-9]*//" -e s"/ \([0-9a-f][0-9a-f]\)/0x\1,/g" -e"\$$d" | sed -e"\$$s/,$$/,0x00};/") >$@
 +      rm temp2.bin
 +
 +
 +indices/u_indices_gen.c: indices/u_indices_gen.py
 +      python $< > $@
 +
 +indices/u_unfilled_gen.c: indices/u_unfilled_gen.py
 +      python $< > $@
 +
 +util/u_format_table.c: util/u_format_table.py util/u_format_parse.py util/u_format.csv
 +      python util/u_format_table.py util/u_format.csv > $@
 +
 +util/u_format_access.c: util/u_format_access.py util/u_format_parse.py util/u_format.csv
 +      python util/u_format_access.py util/u_format.csv > $@
index e90dfc5aec4b53557898520e8d4cb9308b8e564e,b814ecb87ab932985ea3721029cef174cb6aa5b4..fb1bc05af4ae0aa8622e5d59f1dd46a255efec8b
  #include "util/u_memory.h"
  #include "util/u_math.h"
  #include "draw_context.h"
- #include "draw_vbuf.h"
  #include "draw_vs.h"
 +#include "draw_gs.h"
 +#include "draw_pt.h"
 +#include "draw_pipe.h"
  
  
  struct draw_context *draw_create( void )
Simple merge
index a4b78f1494383a02ba7705df62e316dbf7497f94,ba087ac0f34dec2a790ed6672b9043fa32687869..1ac424d678d26a6aa96e7354bd091b8f9bf73482
@@@ -1,6 -1,6 +1,7 @@@
  /**************************************************************************
   *
 + * Copyright 2007-2009 VMware, Inc.
+  * Copyright 2007-2010 VMware, Inc.
   * All Rights Reserved.
   *
   * Permission is hereby granted, free of charge, to any person obtaining a
@@@ -212,21 -388,23 +389,24 @@@ fenced_buffer_finish_locked(struct fenc
  
  
  /**
-  * Free as many fenced buffers from the list head as possible. 
+  * Remove as many fenced buffers from the fenced list as possible.
+  *
+  * Returns TRUE if at least one buffer was removed.
   */
- static void
- _fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list, 
-                                int wait)
+ static boolean
+ fenced_manager_check_signalled_locked(struct fenced_manager *fenced_mgr,
+                                       boolean wait)
  {
-    struct pb_fence_ops *ops = fenced_list->ops;
+    struct pb_fence_ops *ops = fenced_mgr->ops;
     struct list_head *curr, *next;
     struct fenced_buffer *fenced_buf;
 +   struct pb_buffer *pb_buf;
     struct pipe_fence_handle *prev_fence = NULL;
+    boolean ret = FALSE;
  
-    curr = fenced_list->delayed.next;
+    curr = fenced_mgr->fenced.next;
     next = curr->next;
-    while(curr != &fenced_list->delayed) {
+    while(curr != &fenced_mgr->fenced) {
        fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head);
  
        if(fenced_buf->fence != prev_fence) {
index a6cc773003ace80c6b7d904f89ef7cb3381c5e76,a4414d118a86dbe873be1a950f686ed97ed6a54e..b9be8dc0a316a22ca00ded7dffafcc7cf4edbf30
@@@ -96,17 -97,14 +96,15 @@@ tgsi_scan_shader(const struct tgsi_toke
                 uint i;
                 for (i = 0; i < fullinst->Instruction.NumSrcRegs; i++) {
                    const struct tgsi_full_src_register *src =
 -                     &fullinst->FullSrcRegisters[i];
 -                  if (src->SrcRegister.File == TGSI_FILE_INPUT) {
 -                     const int ind = src->SrcRegister.Index;
 +                     &fullinst->Src[i];
 +                  if (src->Register.File == TGSI_FILE_INPUT ||
 +                      src->Register.File == TGSI_FILE_SYSTEM_VALUE) {
 +                     const int ind = src->Register.Index;
                       if (info->input_semantic_name[ind] == TGSI_SEMANTIC_FOG) {
-                         if (src->Register.SwizzleX == TGSI_SWIZZLE_X) {
-                            info->uses_fogcoord = TRUE;
-                         }
-                         else if (src->Register.SwizzleX == TGSI_SWIZZLE_Y) {
-                            info->uses_frontfacing = TRUE;
-                         }
+                         info->uses_fogcoord = TRUE;
+                      }
+                      else if (info->input_semantic_name[ind] == TGSI_SEMANTIC_FACE) {
+                         info->uses_frontfacing = TRUE;
                       }
                    }
                 }
Simple merge
Simple merge
index c693eb30e87e3a1e9dcde7b1a4b06a1aa815204a,793613be7bae5b9850eb07253bdc424c1e9c4ffa..13684aa59c539515fbbf5a7d9dea3cf3167c9860
  
  #include "i915_context.h"
  #include "i915_blit.h"
- #include "i915_state.h"
  #include "pipe/p_defines.h"
- #include "pipe/p_inlines.h"
 +#include "pipe/p_inlines.h"
- #include "util/u_tile.h"
- #include "util/u_rect.h"
 +#include "pipe/internal/p_winsys_screen.h"
 +#include "util/u_format.h"
  
  
  /* Assumes all values are within bounds -- no checking at this level -
Simple merge
index 9f4bbef73fb7aba647bd696c30aa51448885ed84,2297cbb76f8fee41804be94252207e5b4f75437f..70e2a082cc02835fd29f23df50b476b2549af23f
@@@ -85,9 -84,7 +84,8 @@@
  #include "lp_context.h"
  #include "lp_buffer.h"
  #include "lp_state.h"
- #include "lp_quad.h"
  #include "lp_tex_sample.h"
 +#include "lp_debug.h"
  
  
  static const unsigned char quad_offset_x[4] = {0, 1, 0, 1};
index a6d9a2c1acfc724056542bcca14df24cb63c5641,b28f8dc5da204460ec8582e4e094495b13257436..8094625d74d9a1d324e3508790e0cde1b7675c81
@@@ -36,9 -36,7 +36,8 @@@
  #include "util/u_memory.h"
  #include "util/u_tile.h"
  #include "util/u_format.h"
 +#include "util/u_math.h"
  #include "lp_context.h"
- #include "lp_surface.h"
  #include "lp_texture.h"
  #include "lp_tex_cache.h"
  
index 0ca86c4e1cbb1a2e93e82c70132df62443a565d5,5cb17c5ae738743b14959bbf7df6c02fc54812f4..a981775cbd3c91f7c7d7147e51c6699ccbfbf109
@@@ -30,6 -30,6 +30,7 @@@
   */
  
  #include "pipe/p_defines.h"
++#include "util/u_format.h"
  #include "util/u_memory.h"
  #include "tgsi/tgsi_scan.h"
  #include "sp_context.h"
@@@ -651,6 -650,6 +651,20 @@@ static unsigned mask_count[16] 
  
  
  
++/** helper to get number of Z buffer bits */
++static unsigned
++get_depth_bits(struct quad_stage *qs)
++{
++   struct pipe_surface *zsurf = qs->softpipe->framebuffer.zsbuf;
++   if (zsurf)
++      return util_format_get_component_bits(zsurf->format,
++                                            UTIL_FORMAT_COLORSPACE_ZS, 0);
++   else
++      return 0;
++}
++
++
++
  static void
  depth_test_quads_fallback(struct quad_stage *qs, 
                            struct quad_header *quads[],
        nr = alpha_test_quads(qs, quads, nr);
     }
  
--   if (qs->softpipe->framebuffer.zsbuf && 
 -       pf_get_component_bits(qs->softpipe->framebuffer.zsbuf->format, PIPE_FORMAT_COMP_Z) &&
++   if (get_depth_bits(qs) > 0 &&
         (qs->softpipe->depth_stencil->depth.enabled ||
          qs->softpipe->depth_stencil->stencil[0].enabled)) {
  
@@@ -884,7 -884,8 +898,7 @@@ choose_depth_test(struct quad_stage *qs
  
     boolean alpha = qs->softpipe->depth_stencil->alpha.enabled;
  
--   boolean depth = (qs->softpipe->framebuffer.zsbuf && 
 -                    pf_get_component_bits(qs->softpipe->framebuffer.zsbuf->format, PIPE_FORMAT_COMP_Z) &&
++   boolean depth = (get_depth_bits(qs) > 0 &&
                      qs->softpipe->depth_stencil->depth.enabled);
  
     unsigned depthfunc = qs->softpipe->depth_stencil->depth.func;
index e50a76a73bc9b9809d525a50d66dfb374a4c0ea6,0312a31460bf6723d4f18ea3919d34bf679ba182..50242d5bd69d9bd41356a2ea5ee51fad4e3053cf
@@@ -35,9 -35,7 +35,8 @@@
  #include "pipe/p_inlines.h"
  #include "util/u_memory.h"
  #include "util/u_tile.h"
 +#include "util/u_math.h"
  #include "sp_context.h"
- #include "sp_surface.h"
  #include "sp_texture.h"
  #include "sp_tex_tile_cache.h"
  
index 58a1aba464b8fb4be3e29a0294414eb272082f9c,719adde27ef0705d0835b0ae354316d9b8df0083..430a6970fde490622aade880b9d37c9ca6f643c6
@@@ -355,9 -288,10 +288,11 @@@ svga_buffer_upload_flush(struct svga_co
     sbuf->hw.svga = NULL;
     sbuf->hw.boxes = NULL;
  
+    sbuf->host_written = TRUE;
     /* Decrement reference count */
 -   pipe_buffer_reference((struct pipe_buffer **)&sbuf, NULL);
 +   pipe_reference(&(sbuf->base.reference), NULL);
 +   sbuf = NULL;
  }
  
  
index 2224c2d3945d96d102dea8a032a9be3f311be2bb,9ad4edafef20c9c2604d77021ceddd7ecea00c80..0d69007fd87316ae6eeed7c879b23f1839b16647
@@@ -412,6 -420,62 +418,62 @@@ svga_texture_blanket(struct pipe_scree
     tex->key.cachable = 0;
     sws->surface_reference(sws, &tex->handle, sbuf->handle);
  
 -       base->depth[0] != 1) {
+    return &tex->base;
+ }
+ struct pipe_texture *
+ svga_screen_texture_wrap_surface(struct pipe_screen *screen,
+                                struct pipe_texture *base,
+                                enum SVGA3dSurfaceFormat format,
+                                struct svga_winsys_surface *srf)
+ {
+    struct svga_texture *tex;
+    assert(screen);
+    /* Only supports one type */
+    if (base->target != PIPE_TEXTURE_2D ||
+        base->last_level != 0 ||
++       base->depth0 != 1) {
+       return NULL;
+    }
+    if (!srf)
+       return NULL;
+    if (svga_translate_format(base->format) != format) {
+       unsigned f1 = svga_translate_format(base->format);
+       unsigned f2 = format;
+       /* It's okay for XRGB and ARGB or depth with/out stencil to get mixed up */
+       if ( !( (f1 == SVGA3D_X8R8G8B8 && f2 == SVGA3D_A8R8G8B8) ||
+               (f1 == SVGA3D_A8R8G8B8 && f2 == SVGA3D_X8R8G8B8) ||
+               (f1 == SVGA3D_Z_D24X8 && f2 == SVGA3D_Z_D24S8) ) ) {
+          debug_printf("%s wrong format %u != %u\n", __FUNCTION__, f1, f2);
+          return NULL;
+       }
+    }
+    tex = CALLOC_STRUCT(svga_texture);
+    if (!tex)
+       return NULL;
+    tex->base = *base;
+    
+    if (format == 1)
+       tex->base.format = PIPE_FORMAT_X8R8G8B8_UNORM;
+    else if (format == 2)
+       tex->base.format = PIPE_FORMAT_A8R8G8B8_UNORM;
+    pipe_reference_init(&tex->base.reference, 1);
+    tex->base.screen = screen;
+    SVGA_DBG(DEBUG_DMA, "wrap surface sid %p\n", srf);
+    tex->key.cachable = 0;
+    tex->handle = srf;
     return &tex->base;
  }
  
index bb928928c9076e63d130d240a7803a116e8f03c8,78882f3aa788d267cf7fa6b81aaeb80bfdb188a5..b248a81880866e4e25e6e31713383c06ab5d8a89
@@@ -28,8 -28,11 +28,13 @@@ struct drm_create_screen_arg 
  
  struct drm_api
  {
 +        const char *name;
 +
+       /**
+        * Kernel driver name, as accepted by drmOpenByName.
+        */
+       const char *driver_name;
        /**
         * Special buffer functions
         */
index d8c054313b3552f7f928a691d52235e6e6d84a05,25c392e84941e5e6337077831e63e80d567a7284..cdc8eb1b1220d6a479dfc12970aa07f739511f02
@@@ -323,11 -325,21 +328,21 @@@ dri_init_screen2(__DRIscreen * sPriv
  }
  
  static void
 -dri_destroy_screen(__DRIscreenPrivate * sPriv)
 +dri_destroy_screen(__DRIscreen * sPriv)
  {
     struct dri_screen *screen = dri_screen(sPriv);
+    int i;
  
     screen->pipe_screen->destroy(screen->pipe_screen);
+    
+    for (i = 0; i < (1 << screen->optionCache.tableSize); ++i) {
+       FREE(screen->optionCache.info[i].name);
+       FREE(screen->optionCache.info[i].ranges);
+    }
+    FREE(screen->optionCache.info);
+    FREE(screen->optionCache.values);
     FREE(screen);
     sPriv->private = NULL;
  }
index fd82f4fa1d1db4d31aca8003aac5db16446f6c82,468563e34c55b8903d09a8cdd2814cb7db05255d..e6a89c764510ef029a0a6f6c5ac4da229f74d017
  #include "pipe/p_state.h"
  #include "pipe/p_inlines.h"
  
 +#include "util/u_format.h"
 +#include "util/u_rect.h"
  
  /* Make all the #if cases in the code esier to read */
- /* XXX can it be set to 1? */
  #ifndef DRI2INFOREC_VERSION
- #define DRI2INFOREC_VERSION 0
+ #define DRI2INFOREC_VERSION 1
+ #endif
+ #if DRI2INFOREC_VERSION == 2
+ static Bool set_format_in_do_create_buffer;
  #endif
  
  typedef struct {
index d9432babf185080afced01fe76db5b105e8d5c3f,6d89fcaa9f18fc79713c977a3e6f11c98af0735d..c91dee73463c819d37ad6c93ee58f7183df04f1a
@@@ -41,9 -41,7 +41,8 @@@
  #include "pipe/p_format.h"
  #include "pipe/p_context.h"
  #include "pipe/p_state.h"
- #include "pipe/p_inlines.h"
  
 +#include "util/u_format.h"
  #include "util/u_rect.h"
  #include "util/u_math.h"
  #include "util/u_debug.h"
index 5bf0e94b62797a6440bebb987e06e4575e4b5235,5f6d74943f78d6af69c414891de4d1143220e4b0..7bcf77e1d318b54471b2dda448b110aacf5cd235
  #include "cso_cache/cso_context.h"
  
  #include "pipe/p_screen.h"
- #include "pipe/p_inlines.h"
  
 +#include "util/u_format.h"
 +
  /*XXX get these from pipe's texture limits */
  #define IMAGE_MAX_WIDTH               2048
  #define IMAGE_MAX_HEIGHT      2048
index 450ae09b345225fd48afa84ec82d34453db751dc,89b72fd6134e2026cec1d4c9b71a8409c839b3db..8c8176e44ac84dd63b21c8262e636daa4d332e9f
@@@ -195,7 -195,7 +195,8 @@@ destroy(struct drm_api *api
  
  struct drm_api intel_drm_api =
  {
 +   .name = "i915",
+    .driver_name = "i915",
     .create_context = intel_drm_create_context,
     .create_screen = intel_drm_create_screen,
     .texture_from_shared_handle = intel_drm_texture_from_shared_handle,
index 4b2c6a1025edda4df54f7249657827888bd19f40,6fccc358e90b03c560f86022e1daac58bc563d2a..c9f39d815d8a9e05c13a15f0238dcc429139818a
@@@ -254,7 -252,7 +254,8 @@@ nouveau_drm_handle_from_pt(struct drm_a
  }
  
  struct drm_api drm_api_hooks = {
 +      .name = "nouveau",
+       .driver_name = "nouveau",
        .create_screen = nouveau_drm_create_screen,
        .create_context = nouveau_drm_create_context,
        .texture_from_shared_handle = nouveau_drm_pt_from_name,
index 9552f0ad6a9cafd9d27be4ab323563a7f0f611ca,4d962c3abc0dd01b895f4c806050702b80b0bb0b..bff6fdc1ad060e00cd53df3f2fafd158a48c7574
@@@ -269,7 -176,7 +269,8 @@@ static boolean radeon_local_handle_from
  }
  
  struct drm_api drm_api_hooks = {
 +    .name = "radeon",
+     .driver_name = "radeon",
      .create_screen = radeon_create_screen,
      .create_context = radeon_create_context,
      .texture_from_shared_handle = radeon_texture_from_shared_handle,
index 4f5ccea4677124fb08b348b5ce1fcd05601c6fca,60491cb519f03aeef0b16668b66fb5bc3160defe..8be9d74bde38de321c39bba044c4ad14999cd344
@@@ -358,7 -345,7 +345,8 @@@ static struct dri1_api dri1_api_hooks 
  };
  
  static struct drm_api vmw_drm_api_hooks = {
 +   .name = "vmwgfx",
+    .driver_name = "vmwgfx",
     .create_screen = vmw_drm_create_screen,
     .create_context = vmw_drm_create_context,
     .texture_from_shared_handle = vmw_drm_texture_from_handle,
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 6499cfcb2fea6df802ed322c3afc703b8cdd13ff,6a91d0f3f07ec8090e7f2645bd92b00388ae6c64..63d10f45978705fafceb529c905335a242cdbcc1
  #include "shader/prog_optimize.h"
  #include "shader/prog_print.h"
  #include "shader/prog_parameter.h"
 -#include "shader/grammar/grammar_mesa.h"
 +#include "../../glsl/pp/sl_pp_public.h"
 +#include "../../glsl/cl/sl_cl_parse.h"
  #include "slang_codegen.h"
  #include "slang_compile.h"
 -#include "slang_preprocess.h"
  #include "slang_storage.h"
- #include "slang_emit.h"
  #include "slang_log.h"
  #include "slang_mem.h"
  #include "slang_vartable.h"
Simple merge
Simple merge
index 8ca4335e3307f2e90bf541a197635e6f417a57af,1e18497590d6a3b0c50ed8130c3116ce4938dbd4..8d045f2c6c06734aa8c15a154359f63091bd2cc5
  #include "st_public.h"
  #include "st_texture.h"
  #include "pipe/p_context.h"
- #include "pipe/p_inlines.h"
  #include "cso_cache/cso_context.h"
  #include "util/u_rect.h"
 +#include "util/u_math.h"
  
  
  
index 176f3ea68d745f176dce0f33e24f7c779582163e,4c106eb89b0bff180014946737c36bc34559ed82..181f88a33486bd1a9704236088173705ea106719
  #include "st_atom.h"
  #include "st_program.h"
  #include "st_atom_shader.h"
- #include "st_mesa_to_tgsi.h"
  
  
 -/**
 - * This represents a vertex program, especially translated to match
 - * the inputs of a particular fragment shader.
 - */
 -struct translated_vertex_program
 -{
 -   struct st_vertex_program *master;
 -
 -   /** The fragment shader "signature" this vertex shader is meant for: */
 -   GLbitfield frag_inputs;
 -
 -   /** Compared against master vertex program's serialNo: */
 -   GLuint serialNo;
 -
 -   /** Maps VERT_RESULT_x to slot */
 -   GLuint output_to_slot[VERT_RESULT_MAX];
 -   ubyte output_to_semantic_name[VERT_RESULT_MAX];
 -   ubyte output_to_semantic_index[VERT_RESULT_MAX];
 -
 -   /** Pointer to the translated vertex program */
 -   struct st_vertex_program *vp;
 -
 -   struct translated_vertex_program *next;  /**< next in linked list */
 -};
 -
 -
 -
 -/**
 - * Given a vertex program output attribute, return the corresponding
 - * fragment program input attribute.
 - * \return -1 for vertex outputs that have no corresponding fragment input
 - */
 -static GLint
 -vp_out_to_fp_in(GLuint vertResult)
 -{
 -   if (vertResult >= VERT_RESULT_TEX0 &&
 -       vertResult < VERT_RESULT_TEX0 + MAX_TEXTURE_COORD_UNITS)
 -      return FRAG_ATTRIB_TEX0 + (vertResult - VERT_RESULT_TEX0);
 -
 -   if (vertResult >= VERT_RESULT_VAR0 &&
 -       vertResult < VERT_RESULT_VAR0 + MAX_VARYING)
 -      return FRAG_ATTRIB_VAR0 + (vertResult - VERT_RESULT_VAR0);
 -
 -   switch (vertResult) {
 -   case VERT_RESULT_HPOS:
 -      return FRAG_ATTRIB_WPOS;
 -   case VERT_RESULT_COL0:
 -      return FRAG_ATTRIB_COL0;
 -   case VERT_RESULT_COL1:
 -      return FRAG_ATTRIB_COL1;
 -   case VERT_RESULT_FOGC:
 -      return FRAG_ATTRIB_FOGC;
 -   default:
 -      /* Back-face colors, edge flags, etc */
 -      return -1;
 -   }
 -}
 -
  
  /**
 - * Find a translated vertex program that corresponds to stvp and
 - * has outputs matched to stfp's inputs.
 - * This performs vertex and fragment translation (to TGSI) when needed.
 + * Translate fragment program if needed.
   */
 -static struct translated_vertex_program *
 -find_translated_vp(struct st_context *st,
 -                   struct st_vertex_program *stvp,
 -                   struct st_fragment_program *stfp)
 +static void
 +translate_fp(struct st_context *st,
 +             struct st_fragment_program *stfp)
  {
 -   static const GLuint UNUSED = ~0;
 -   struct translated_vertex_program *xvp;
     const GLbitfield fragInputsRead = stfp->Base.Base.InputsRead;
  
 -   /*
 -    * Translate fragment program if needed.
 -    */
     if (!stfp->state.tokens) {
        GLuint inAttr, numIn = 0;
  
Simple merge
Simple merge
index 192d765f45335a9846b3dcbf59fca93972c28857,3aa4b03159a261cd49acdd95c2ce41641f2a811f..398587ac4b1e5af476990c1847143674ea7a26f7
@@@ -52,8 -50,6 +50,7 @@@
  #include "pipe/p_inlines.h"
  #include "pipe/p_state.h"
  #include "pipe/p_defines.h"
- #include "util/u_pack_color.h"
 +#include "util/u_format.h"
  #include "util/u_simple_shaders.h"
  #include "util/u_draw_quad.h"
  
Simple merge
index 10629e92254453e2f2f5a6049195ae1a5a1cce59,5ef7765017fbdc6ff46ad771e54859e493c3a858..2281d10e99960c5b4c3f9f9792dac628a151ffb0
  #include "pipe/p_defines.h"
  #include "st_context.h"
  #include "st_cb_queryobj.h"
- #include "st_public.h"
  
  
 -struct st_query_object
 -{
 -   struct gl_query_object base;
 -   struct pipe_query *pq;
 -};
 -
 -
 -/**
 - * Cast wrapper
 - */
 -static struct st_query_object *
 -st_query_object(struct gl_query_object *q)
 -{
 -   return (struct st_query_object *) q;
 -}
 -
 -
  static struct gl_query_object *
  st_NewQueryObject(GLcontext *ctx, GLuint id)
  {
Simple merge
Simple merge
Simple merge