Merge remote branch 'origin/master' into pipe-video
[mesa.git] / src / mesa / drivers / dri / i965 / brw_gs_state.c
index ed9d2ffe605e49ee89f9ee007cd058b0afd9bb9b..69a5f7a66674df71d6b8d9916034bc011eb67a2b 100644 (file)
@@ -34,7 +34,6 @@
 #include "brw_context.h"
 #include "brw_state.h"
 #include "brw_defines.h"
-#include "main/macros.h"
 
 struct brw_gs_unit_key {
    unsigned int total_grf;
@@ -69,11 +68,12 @@ gs_unit_populate_key(struct brw_context *brw, struct brw_gs_unit_key *key)
    key->urb_size = brw->urb.vsize;
 }
 
-static dri_bo *
+static drm_intel_bo *
 gs_unit_create_from_key(struct brw_context *brw, struct brw_gs_unit_key *key)
 {
+   struct intel_context *intel = &brw->intel;
    struct brw_gs_unit_state gs;
-   dri_bo *bo;
+   drm_intel_bo *bo;
 
    memset(&gs, 0, sizeof(gs));
 
@@ -98,25 +98,22 @@ gs_unit_create_from_key(struct brw_context *brw, struct brw_gs_unit_key *key)
    else
       gs.thread4.max_threads = 0;
 
-   if (BRW_IS_IGDNG(brw))
+   if (intel->gen == 5)
       gs.thread4.rendering_enable = 1;
 
-   if (INTEL_DEBUG & DEBUG_STATS)
+   if (unlikely(INTEL_DEBUG & DEBUG_STATS))
       gs.thread4.stats_enable = 1;
 
    bo = brw_upload_cache(&brw->cache, BRW_GS_UNIT,
                         key, sizeof(*key),
                         &brw->gs.prog_bo, 1,
-                        &gs, sizeof(gs),
-                        NULL, NULL);
+                        &gs, sizeof(gs));
 
    if (key->prog_active) {
       /* Emit GS program relocation */
-      dri_bo_emit_reloc(bo,
-                       I915_GEM_DOMAIN_INSTRUCTION, 0,
-                       gs.thread0.grf_reg_count << 1,
-                       offsetof(struct brw_gs_unit_state, thread0),
-                       brw->gs.prog_bo);
+      drm_intel_bo_emit_reloc(bo, offsetof(struct brw_gs_unit_state, thread0),
+                             brw->gs.prog_bo, gs.thread0.grf_reg_count << 1,
+                             I915_GEM_DOMAIN_INSTRUCTION, 0);
    }
 
    return bo;
@@ -128,7 +125,7 @@ static void prepare_gs_unit(struct brw_context *brw)
 
    gs_unit_populate_key(brw, &key);
 
-   dri_bo_unreference(brw->gs.state_bo);
+   drm_intel_bo_unreference(brw->gs.state_bo);
    brw->gs.state_bo = brw_search_cache(&brw->cache, BRW_GS_UNIT,
                                       &key, sizeof(key),
                                       &brw->gs.prog_bo, 1,