brw_gs_state.c

Go to the documentation of this file.
00001 /*
00002  Copyright (C) Intel Corp.  2006.  All Rights Reserved.
00003  Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
00004  develop this 3D driver.
00005 
00006  Permission is hereby granted, free of charge, to any person obtaining
00007  a copy of this software and associated documentation files (the
00008  "Software"), to deal in the Software without restriction, including
00009  without limitation the rights to use, copy, modify, merge, publish,
00010  distribute, sublicense, and/or sell copies of the Software, and to
00011  permit persons to whom the Software is furnished to do so, subject to
00012  the following conditions:
00013 
00014  The above copyright notice and this permission notice (including the
00015  next paragraph) shall be included in all copies or substantial
00016  portions of the Software.
00017 
00018  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00019  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00021  IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
00022  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00023  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00024  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00025 
00026  **********************************************************************/
00027  /*
00028   * Authors:
00029   *   Keith Whitwell <keith@tungstengraphics.com>
00030   */
00031 
00032 
00033 
00034 #include "brw_context.h"
00035 #include "brw_state.h"
00036 #include "brw_defines.h"
00037 #include "util/u_math.h"
00038 #include "util/u_memory.h"
00039 
00040 
00041 
00042 static void upload_gs_unit( struct brw_context *brw )
00043 {
00044    struct brw_gs_unit_state gs;
00045 
00046    memset(&gs, 0, sizeof(gs));
00047 
00048    /* CACHE_NEW_GS_PROG */
00049    if (brw->gs.prog_active) {
00050       gs.thread0.grf_reg_count =
00051          align(brw->gs.prog_data->total_grf, 16) / 16 - 1;
00052       gs.thread0.kernel_start_pointer = brw->gs.prog_gs_offset >> 6;
00053       gs.thread3.urb_entry_read_length = brw->gs.prog_data->urb_read_length;
00054    }
00055    else {
00056       gs.thread0.grf_reg_count = 0;
00057       gs.thread0.kernel_start_pointer = 0;
00058       gs.thread3.urb_entry_read_length = 1;
00059    }
00060 
00061    /* BRW_NEW_URB_FENCE */
00062    gs.thread4.nr_urb_entries = brw->urb.nr_gs_entries;
00063    gs.thread4.urb_entry_allocation_size = brw->urb.vsize - 1;
00064 
00065    gs.thread4.max_threads = 0; /* Hardware requirement */
00066 
00067    if (BRW_DEBUG & DEBUG_STATS)
00068       gs.thread4.stats_enable = 1;
00069 
00070    /* CONSTANT */
00071    gs.thread1.floating_point_mode = BRW_FLOATING_POINT_NON_IEEE_754;
00072    gs.thread1.single_program_flow = 1;
00073    gs.thread3.dispatch_grf_start_reg = 1;
00074    gs.thread3.const_urb_entry_read_offset = 0;
00075    gs.thread3.const_urb_entry_read_length = 0;
00076    gs.thread3.urb_entry_read_offset = 0;
00077 
00078 
00079    brw->gs.state_gs_offset = brw_cache_data( &brw->cache[BRW_GS_UNIT], &gs );
00080 }
00081 
00082 
00083 const struct brw_tracked_state brw_gs_unit = {
00084    .dirty = {
00085       .brw   = (BRW_NEW_CURBE_OFFSETS |
00086                 BRW_NEW_URB_FENCE),
00087       .cache = CACHE_NEW_GS_PROG
00088    },
00089    .update = upload_gs_unit
00090 };

Generated on Tue Sep 29 06:25:16 2009 for Gallium3D by  doxygen 1.5.4