The code paths are not tested for a while, and have some known issues.
ilo_3d_pipeline_invalidate(hw3d->pipeline,
ILO_3D_PIPELINE_INVALIDATE_BATCH_BO |
ILO_3D_PIPELINE_INVALIDATE_STATE_BO);
- if (!hw3d->cp->render_ctx) {
- ilo_3d_pipeline_invalidate(hw3d->pipeline,
- ILO_3D_PIPELINE_INVALIDATE_HW);
- }
hw3d->new_batch = true;
}
const int stride = so_info->stride[i] * 4; /* in bytes */
int base = 0;
- /* reset HW write offsets and offset buffer base */
- if (!p->cp->render_ctx) {
- ilo_cp_set_one_off_flags(p->cp, INTEL_EXEC_GEN7_SOL_RESET);
- base += p->state.so_num_vertices * stride;
- }
-
gen7_emit_3DSTATE_SO_BUFFER(p->dev, i, base, stride,
ilo->so.states[i], p->cp);
}
int max_batch_size;
bool has_llc;
bool has_address_swizzling;
+ bool has_logical_context;
bool has_timestamp;
bool has_gen7_sol_reset;
intel_bo_unreference(cp->bo);
}
- if (cp->render_ctx)
- intel_winsys_destroy_context(cp->winsys, cp->render_ctx);
+ intel_winsys_destroy_context(cp->winsys, cp->render_ctx);
FREE(cp->sys);
FREE(cp);
cp->winsys = winsys;
cp->render_ctx = intel_winsys_create_context(winsys);
+ if (!cp->render_ctx) {
+ FREE(cp);
+ return NULL;
+ }
cp->ring = INTEL_RING_RENDER;
cp->no_implicit_flush = false;
dev->max_batch_size = info->max_batch_size;
dev->has_llc = info->has_llc;
dev->has_address_swizzling = info->has_address_swizzling;
+ dev->has_logical_context = info->has_logical_context;
dev->has_timestamp = info->has_timestamp;
dev->has_gen7_sol_reset = info->has_gen7_sol_reset;
+ if (!dev->has_logical_context) {
+ ilo_err("missing hardware logical context support\n");
+ return false;
+ }
+
/*
* From the Sandy Bridge PRM, volume 4 part 2, page 18:
*
/* these are protected by the mutex */
pipe_mutex mutex;
+ drm_intel_context *first_gem_ctx;
struct drm_intel_decode *decode;
};
info->has_llc = val;
info->has_address_swizzling = test_address_swizzling(winsys);
+ winsys->first_gem_ctx = drm_intel_gem_context_create(winsys->bufmgr);
+ info->has_logical_context = (winsys->first_gem_ctx != NULL);
+
/* test TIMESTAMP read */
info->has_timestamp = test_reg_read(winsys, 0x2358);
if (winsys->decode)
drm_intel_decode_context_free(winsys->decode);
+ if (winsys->first_gem_ctx)
+ drm_intel_gem_context_destroy(winsys->first_gem_ctx);
+
pipe_mutex_destroy(winsys->mutex);
drm_intel_bufmgr_destroy(winsys->bufmgr);
FREE(winsys);
struct intel_context *
intel_winsys_create_context(struct intel_winsys *winsys)
{
- return (struct intel_context *)
- drm_intel_gem_context_create(winsys->bufmgr);
+ drm_intel_context *gem_ctx;
+
+ /* try the preallocated context first */
+ pipe_mutex_lock(winsys->mutex);
+ gem_ctx = winsys->first_gem_ctx;
+ winsys->first_gem_ctx = NULL;
+ pipe_mutex_unlock(winsys->mutex);
+
+ if (!gem_ctx)
+ gem_ctx = drm_intel_gem_context_create(winsys->bufmgr);
+
+ return (struct intel_context *) gem_ctx;
}
void
int max_batch_size;
bool has_llc;
bool has_address_swizzling;
+ bool has_logical_context;
/* valid registers for intel_winsys_read_reg() */
bool has_timestamp;