* This is required for transform feedback buffer offsets, query objects,
* and also allows us to reduce how much state we have to emit.
*/
- intel->hw_ctx = drm_intel_gem_context_create(intel->bufmgr);
+ intel->hw_ctx = drm_intel_gem_context_create(brw->bufmgr);
if (!intel->hw_ctx) {
fprintf(stderr, "Gen6+ requires Kernel 3.6 or later.\n");
} vtbl;
+ dri_bufmgr *bufmgr;
+
/**
* Set if rendering has occured to the drawable's front buffer.
*
/* Allocate a single page for CURBE entries for this batchbuffer.
* They're generally around 64b.
*/
- brw->curbe.curbe_bo = drm_intel_bo_alloc(brw->intel.bufmgr, "CURBE",
+ brw->curbe.curbe_bo = drm_intel_bo_alloc(brw->bufmgr, "CURBE",
4096, 1 << 6);
brw->curbe.curbe_next_offset = 0;
drm_intel_gem_bo_map_gtt(brw->curbe.curbe_bo);
brw_get_scratch_bo(struct brw_context *brw,
drm_intel_bo **scratch_bo, int size)
{
- struct intel_context *intel = &brw->intel;
drm_intel_bo *old_bo = *scratch_bo;
if (old_bo && old_bo->size < size) {
}
if (!old_bo) {
- *scratch_bo = drm_intel_bo_alloc(intel->bufmgr, "scratch bo", size, 4096);
+ *scratch_bo = drm_intel_bo_alloc(brw->bufmgr, "scratch bo", size, 4096);
}
}
void
brw_init_shader_time(struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
-
const int max_entries = 4096;
- brw->shader_time.bo = drm_intel_bo_alloc(intel->bufmgr, "shader time",
+ brw->shader_time.bo = drm_intel_bo_alloc(brw->bufmgr, "shader time",
max_entries * SHADER_TIME_STRIDE,
4096);
brw->shader_time.shader_programs = rzalloc_array(brw, struct gl_shader_program *,
* the system was doing other work, such as running other applications.
*/
drm_intel_bo_unreference(query->bo);
- query->bo = drm_intel_bo_alloc(intel->bufmgr, "timer query", 4096, 4096);
+ query->bo = drm_intel_bo_alloc(brw->bufmgr, "timer query", 4096, 4096);
write_timestamp(brw, query->bo, 0);
break;
static void
ensure_bo_has_space(struct gl_context *ctx, struct brw_query_object *query)
{
+ struct brw_context *brw = brw_context(ctx);
struct intel_context *intel = intel_context(ctx);
assert(intel->gen < 6);
brw_queryobj_get_results(ctx, query);
}
- query->bo = drm_intel_bo_alloc(intel->bufmgr, "query", 4096, 1);
+ query->bo = drm_intel_bo_alloc(brw->bufmgr, "query", 4096, 1);
query->last_index = 0;
}
}
brw_query_counter(struct gl_context *ctx, struct gl_query_object *q)
{
struct brw_context *brw = brw_context(ctx);
- struct intel_context *intel = intel_context(ctx);
struct brw_query_object *query = (struct brw_query_object *) q;
assert(q->Target == GL_TIMESTAMP);
drm_intel_bo_unreference(query->bo);
- query->bo = drm_intel_bo_alloc(intel->bufmgr, "timestamp query", 4096, 4096);
+ query->bo = drm_intel_bo_alloc(brw->bufmgr, "timestamp query", 4096, 4096);
write_timestamp(brw, query->bo, 0);
}
static uint64_t
brw_get_timestamp(struct gl_context *ctx)
{
- struct intel_context *intel = intel_context(ctx);
+ struct brw_context *brw = brw_context(ctx);
uint64_t result = 0;
- drm_intel_reg_read(intel->bufmgr, TIMESTAMP, &result);
+ drm_intel_reg_read(brw->bufmgr, TIMESTAMP, &result);
/* See logic in brw_queryobj_get_results() */
result = result >> 32;
brw_cache_new_bo(struct brw_cache *cache, uint32_t new_size)
{
struct brw_context *brw = cache->brw;
- struct intel_context *intel = &brw->intel;
drm_intel_bo *new_bo;
- new_bo = drm_intel_bo_alloc(intel->bufmgr, "program cache", new_size, 64);
+ new_bo = drm_intel_bo_alloc(brw->bufmgr, "program cache", new_size, 64);
/* Copy any existing data that needs to be saved. */
if (cache->next_offset != 0) {
void
brw_init_caches(struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
struct brw_cache *cache = &brw->cache;
cache->brw = brw;
cache->items =
calloc(1, cache->size * sizeof(struct brw_cache_item *));
- cache->bo = drm_intel_bo_alloc(intel->bufmgr,
+ cache->bo = drm_intel_bo_alloc(brw->bufmgr,
"program cache",
4096, 64);
static void
brw_upload_vs_pull_constants(struct brw_context *brw)
{
- struct intel_context *intel = &brw->intel;
/* BRW_NEW_VERTEX_PROGRAM */
struct brw_vertex_program *vp =
(struct brw_vertex_program *) brw->vertex_program;
/* _NEW_PROGRAM_CONSTANTS */
drm_intel_bo_unreference(brw->vs.const_bo);
uint32_t size = brw->vs.prog_data->base.nr_pull_params * 4;
- brw->vs.const_bo = drm_intel_bo_alloc(intel->bufmgr, "vp_const_buffer",
+ brw->vs.const_bo = drm_intel_bo_alloc(brw->bufmgr, "vp_const_buffer",
size, 64);
drm_intel_gem_bo_map_gtt(brw->vs.const_bo);
}
drm_intel_bo_unreference(brw->wm.const_bo);
- brw->wm.const_bo = drm_intel_bo_alloc(intel->bufmgr, "WM const bo",
+ brw->wm.const_bo = drm_intel_bo_alloc(brw->bufmgr, "WM const bo",
size, 64);
/* _NEW_PROGRAM_CONSTANTS */
gen6_begin_query(struct gl_context *ctx, struct gl_query_object *q)
{
struct brw_context *brw = brw_context(ctx);
- struct intel_context *intel = intel_context(ctx);
struct brw_query_object *query = (struct brw_query_object *)q;
/* Since we're starting a new query, we need to throw away old results. */
drm_intel_bo_unreference(query->bo);
- query->bo = drm_intel_bo_alloc(intel->bufmgr, "query results", 4096, 4096);
+ query->bo = drm_intel_bo_alloc(brw->bufmgr, "query results", 4096, 4096);
switch (query->Base.Target) {
case GL_TIME_ELAPSED:
* the gen6 workaround because it involves actually writing to
* the buffer, and the kernel doesn't let us write to the batch.
*/
- intel->batch.workaround_bo = drm_intel_bo_alloc(intel->bufmgr,
+ intel->batch.workaround_bo = drm_intel_bo_alloc(brw->bufmgr,
"pipe_control workaround",
4096, 4096);
}
clear_cache(brw);
- intel->batch.bo = drm_intel_bo_alloc(intel->bufmgr, "batchbuffer",
+ intel->batch.bo = drm_intel_bo_alloc(brw->bufmgr, "batchbuffer",
BATCH_SZ, 4096);
if (intel->has_llc) {
drm_intel_bo_map(intel->batch.bo, true);
intel_bufferobj_alloc_buffer(struct brw_context *brw,
struct intel_buffer_object *intel_obj)
{
- struct intel_context *intel = &brw->intel;
- intel_obj->buffer = drm_intel_bo_alloc(intel->bufmgr, "bufferobj",
+ intel_obj->buffer = drm_intel_bo_alloc(brw->bufmgr, "bufferobj",
intel_obj->Base.Size, 64);
/* the buffer might be bound as a uniform buffer, need to update it
"glBufferSubData() to a busy buffer object.\n",
(long)size);
drm_intel_bo *temp_bo =
- drm_intel_bo_alloc(intel->bufmgr, "subdata temp", size, 64);
+ drm_intel_bo_alloc(brw->bufmgr, "subdata temp", size, 64);
drm_intel_bo_subdata(temp_bo, 0, size, data);
intel_obj->range_map_buffer = malloc(length);
obj->Pointer = intel_obj->range_map_buffer;
} else {
- intel_obj->range_map_bo = drm_intel_bo_alloc(intel->bufmgr,
+ intel_obj->range_map_bo = drm_intel_bo_alloc(brw->bufmgr,
"range map",
length, 64);
if (!(access & GL_MAP_READ_BIT)) {
struct gl_buffer_object *obj)
{
struct brw_context *brw = brw_context(ctx);
- struct intel_context *intel = intel_context(ctx);
struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
drm_intel_bo *temp_bo;
if (length == 0)
return;
- temp_bo = drm_intel_bo_alloc(intel->bufmgr, "range map flush", length, 64);
+ temp_bo = drm_intel_bo_alloc(brw->bufmgr, "range map flush", length, 64);
drm_intel_bo_subdata(temp_bo, 0, length, intel_obj->range_map_buffer);
if (size < INTEL_UPLOAD_SIZE)
size = INTEL_UPLOAD_SIZE;
- intel->upload.bo = drm_intel_bo_alloc(intel->bufmgr, "upload", size, 0);
+ intel->upload.bo = drm_intel_bo_alloc(brw->bufmgr, "upload", size, 0);
intel->upload.offset = 0;
}
*/
intel->max_gtt_map_object_size = gtt_size / 4;
- intel->bufmgr = intelScreen->bufmgr;
+ brw->bufmgr = intelScreen->bufmgr;
bo_reuse_mode = driQueryOptioni(&brw->optionCache, "bo_reuse");
switch (bo_reuse_mode) {
case DRI_CONF_BO_REUSE_DISABLED:
break;
case DRI_CONF_BO_REUSE_ALL:
- intel_bufmgr_gem_enable_reuse(intel->bufmgr);
+ intel_bufmgr_gem_enable_reuse(brw->bufmgr);
break;
}
INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
if (INTEL_DEBUG & DEBUG_BUFMGR)
- dri_bufmgr_set_debug(intel->bufmgr, true);
+ dri_bufmgr_set_debug(brw->bufmgr, true);
if ((INTEL_DEBUG & DEBUG_SHADER_TIME) && intel->gen < 7) {
fprintf(stderr,
"shader_time debugging requires gen7 (Ivybridge) or better.\n");
intel->perf_debug = true;
if (INTEL_DEBUG & DEBUG_AUB)
- drm_intel_bufmgr_gem_set_aub_dump(intel->bufmgr, true);
+ drm_intel_bufmgr_gem_set_aub_dump(brw->bufmgr, true);
intel_batchbuffer_init(brw);
GLuint NewGLState;
- dri_bufmgr *bufmgr;
-
/**
* Generation number of the hardware: 2 is 8xx, 3 is 9xx pre-965, 4 is 965.
*/
ctx->Extensions.ARB_texture_multisample = true;
/* Test if the kernel has the ioctl. */
- if (drm_intel_reg_read(intel->bufmgr, TIMESTAMP, &dummy) == 0)
+ if (drm_intel_reg_read(brw->bufmgr, TIMESTAMP, &dummy) == 0)
ctx->Extensions.ARB_timer_query = true;
}