diff --git a/drivers/gpu/msm/adreno_a2xx.c b/drivers/gpu/msm/adreno_a2xx.c index ea74d4a4efd..662e4608a63 100644 --- a/drivers/gpu/msm/adreno_a2xx.c +++ b/drivers/gpu/msm/adreno_a2xx.c @@ -655,7 +655,7 @@ static unsigned int *build_gmem2sys_cmds(struct adreno_device *adreno_dev, unsigned int addr = shadow->gmemshadow.gpuaddr; unsigned int offset = (addr - (addr & 0xfffff000)) / bytesperpixel; - if (!(drawctxt->flags & CTXT_FLAGS_PREAMBLE)) { + if (!(drawctxt->base.flags & KGSL_CONTEXT_PREAMBLE)) { /* Store TP0_CHICKEN register */ *cmds++ = cp_type3_packet(CP_REG_TO_MEM, 2); *cmds++ = REG_TP0_CHICKEN; @@ -864,7 +864,7 @@ static unsigned int *build_sys2gmem_cmds(struct adreno_device *adreno_dev, unsigned int *cmds = shadow->gmem_restore_commands; unsigned int *start = cmds; - if (!(drawctxt->flags & CTXT_FLAGS_PREAMBLE)) { + if (!(drawctxt->base.flags & KGSL_CONTEXT_PREAMBLE)) { /* Store TP0_CHICKEN register */ *cmds++ = cp_type3_packet(CP_REG_TO_MEM, 2); *cmds++ = REG_TP0_CHICKEN; @@ -1334,8 +1334,6 @@ build_shader_save_restore_cmds(struct adreno_device *adreno_dev, static int a2xx_create_gpustate_shadow(struct adreno_device *adreno_dev, struct adreno_context *drawctxt) { - drawctxt->flags |= CTXT_FLAGS_STATE_SHADOW; - /* build indirect command buffers to save & restore regs/constants */ build_regrestore_cmds(adreno_dev, drawctxt); build_regsave_cmds(adreno_dev, drawctxt); @@ -1361,9 +1359,6 @@ static int a2xx_create_gmem_shadow(struct adreno_device *adreno_dev, if (result) return result; - /* set the gmem shadow flag for the context */ - drawctxt->flags |= CTXT_FLAGS_GMEM_SHADOW; - /* blank out gmem shadow. */ kgsl_sharedmem_set(drawctxt->base.device, &drawctxt->context_gmem_shadow.gmemshadow, 0, 0, @@ -1374,7 +1369,7 @@ static int a2xx_create_gmem_shadow(struct adreno_device *adreno_dev, &tmp_ctx.cmd); /* build TP0_CHICKEN register restore command buffer */ - if (!(drawctxt->flags & CTXT_FLAGS_PREAMBLE)) + if (!(drawctxt->base.flags & KGSL_CONTEXT_PREAMBLE)) tmp_ctx.cmd = build_chicken_restore_cmds(drawctxt); /* build indirect command buffers to save & restore gmem */ @@ -1437,8 +1432,8 @@ static int a2xx_drawctxt_create(struct adreno_device *adreno_dev, { int ret; - if (drawctxt->flags & CTXT_FLAGS_PREAMBLE - && drawctxt->flags & CTXT_FLAGS_NOGMEMALLOC) { + if (drawctxt->base.flags & KGSL_CONTEXT_PREAMBLE + && drawctxt->base.flags & KGSL_CONTEXT_NO_GMEM_ALLOC) { drawctxt->ops = (adreno_is_a225(adreno_dev)) ? &a225_preamble_ctx_ops : &adreno_preamble_ctx_ops; @@ -1467,15 +1462,14 @@ static int a2xx_drawctxt_create(struct adreno_device *adreno_dev, tmp_ctx.cmd = tmp_ctx.start = (unsigned int *)((char *)drawctxt->gpustate.hostptr + CMD_OFFSET); - if (!(drawctxt->flags & CTXT_FLAGS_PREAMBLE)) { + if (!(drawctxt->base.flags & KGSL_CONTEXT_PREAMBLE)) { ret = a2xx_create_gpustate_shadow(adreno_dev, drawctxt); if (ret) goto done; - drawctxt->flags |= CTXT_FLAGS_SHADER_SAVE; } - if (!(drawctxt->flags & CTXT_FLAGS_NOGMEMALLOC)) { + if (!(drawctxt->base.flags & KGSL_CONTEXT_NO_GMEM_ALLOC)) { ret = a2xx_create_gmem_shadow(adreno_dev, drawctxt); if (ret) goto done; @@ -1555,7 +1549,7 @@ static int a2xx_drawctxt_save(struct adreno_device *adreno_dev, struct kgsl_device *device = &adreno_dev->dev; int ret; - if (!(context->flags & CTXT_FLAGS_PREAMBLE)) { + if (!(context->base.flags & KGSL_CONTEXT_PREAMBLE)) { kgsl_cffdump_syncmem(context->base.device, &context->gpustate, context->reg_save[1], context->reg_save[2] << 2, true); @@ -1567,7 +1561,7 @@ static int a2xx_drawctxt_save(struct adreno_device *adreno_dev, if (ret) return ret; - if (context->flags & CTXT_FLAGS_SHADER_SAVE) { + if (test_bit(ADRENO_CONTEXT_SHADER_SAVE, &context->priv)) { kgsl_cffdump_syncmem(context->base.device, &context->gpustate, context->shader_save[1], @@ -1594,12 +1588,11 @@ static int a2xx_drawctxt_save(struct adreno_device *adreno_dev, if (ret) return ret; - context->flags |= CTXT_FLAGS_SHADER_RESTORE; + set_bit(ADRENO_CONTEXT_SHADER_RESTORE, &context->priv); } } - if ((context->flags & CTXT_FLAGS_GMEM_SAVE) && - (context->flags & CTXT_FLAGS_GMEM_SHADOW)) { + if (test_bit(ADRENO_CONTEXT_GMEM_SAVE, &context->priv)) { kgsl_cffdump_syncmem(context->base.device, &context->gpustate, context->context_gmem_shadow.gmem_save[1], context->context_gmem_shadow.gmem_save[2] << 2, true); @@ -1618,7 +1611,7 @@ static int a2xx_drawctxt_save(struct adreno_device *adreno_dev, context->chicken_restore[2] << 2, true); /* Restore TP0_CHICKEN */ - if (!(context->flags & CTXT_FLAGS_PREAMBLE)) { + if (!(context->base.flags & KGSL_CONTEXT_PREAMBLE)) { ret = adreno_ringbuffer_issuecmds(device, context, KGSL_CMD_FLAGS_NONE, context->chicken_restore, 3); @@ -1628,7 +1621,7 @@ static int a2xx_drawctxt_save(struct adreno_device *adreno_dev, } adreno_dev->gpudev->ctx_switches_since_last_draw = 0; - context->flags |= CTXT_FLAGS_GMEM_RESTORE; + set_bit(ADRENO_CONTEXT_GMEM_RESTORE, &context->priv); } else if (adreno_is_a2xx(adreno_dev)) return a2xx_drawctxt_draw_workaround(adreno_dev, context); @@ -1649,7 +1642,7 @@ static int a2xx_drawctxt_restore(struct adreno_device *adreno_dev, * restore gmem. * (note: changes shader. shader must not already be restored.) */ - if (context->flags & CTXT_FLAGS_GMEM_RESTORE) { + if (test_bit(ADRENO_CONTEXT_GMEM_RESTORE, &context->priv)) { kgsl_cffdump_syncmem(context->base.device, &context->gpustate, context->context_gmem_shadow.gmem_restore[1], context->context_gmem_shadow.gmem_restore[2] << 2, @@ -1661,7 +1654,7 @@ static int a2xx_drawctxt_restore(struct adreno_device *adreno_dev, if (ret) return ret; - if (!(context->flags & CTXT_FLAGS_PREAMBLE)) { + if (!(context->base.flags & KGSL_CONTEXT_PREAMBLE)) { kgsl_cffdump_syncmem(context->base.device, &context->gpustate, context->chicken_restore[1], @@ -1674,11 +1667,10 @@ static int a2xx_drawctxt_restore(struct adreno_device *adreno_dev, if (ret) return ret; } - - context->flags &= ~CTXT_FLAGS_GMEM_RESTORE; + clear_bit(ADRENO_CONTEXT_GMEM_RESTORE, &context->priv); } - if (!(context->flags & CTXT_FLAGS_PREAMBLE)) { + if (!(context->base.flags & KGSL_CONTEXT_PREAMBLE)) { kgsl_cffdump_syncmem(context->base.device, &context->gpustate, context->reg_restore[1], context->reg_restore[2] << 2, true); @@ -1690,7 +1682,7 @@ static int a2xx_drawctxt_restore(struct adreno_device *adreno_dev, return ret; /* restore shader instructions & partitioning. */ - if (context->flags & CTXT_FLAGS_SHADER_RESTORE) { + if (test_bit(ADRENO_CONTEXT_SHADER_RESTORE, &context->priv)) { kgsl_cffdump_syncmem(context->base.device, &context->gpustate, context->shader_restore[1], diff --git a/drivers/gpu/msm/adreno_a3xx.c b/drivers/gpu/msm/adreno_a3xx.c index 0a548d51ace..3a1b5634651 100644 --- a/drivers/gpu/msm/adreno_a3xx.c +++ b/drivers/gpu/msm/adreno_a3xx.c @@ -2297,8 +2297,6 @@ static void build_restore_fixup_cmds(struct adreno_device *adreno_dev, static int a3xx_create_gpustate_shadow(struct adreno_device *adreno_dev, struct adreno_context *drawctxt) { - drawctxt->flags |= CTXT_FLAGS_STATE_SHADOW; - build_regrestore_cmds(adreno_dev, drawctxt); build_constantrestore_cmds(adreno_dev, drawctxt); build_hlsqcontrol_restore_cmds(adreno_dev, drawctxt); @@ -2338,8 +2336,6 @@ static int a3xx_create_gmem_shadow(struct adreno_device *adreno_dev, kgsl_cache_range_op(&drawctxt->context_gmem_shadow.gmemshadow, KGSL_CACHE_OP_FLUSH); - drawctxt->flags |= CTXT_FLAGS_GMEM_SHADOW; - return 0; } @@ -2371,8 +2367,8 @@ static int a3xx_drawctxt_create(struct adreno_device *adreno_dev, * Nothing to do here if the context is using preambles and doesn't need * GMEM save/restore */ - if ((drawctxt->flags & CTXT_FLAGS_PREAMBLE) && - (drawctxt->flags & CTXT_FLAGS_NOGMEMALLOC)) { + if ((drawctxt->base.flags & KGSL_CONTEXT_PREAMBLE) && + (drawctxt->base.flags & KGSL_CONTEXT_NO_GMEM_ALLOC)) { drawctxt->ops = &adreno_preamble_ctx_ops; return 0; } @@ -2388,15 +2384,15 @@ static int a3xx_drawctxt_create(struct adreno_device *adreno_dev, CONTEXT_SIZE); tmp_ctx.cmd = drawctxt->gpustate.hostptr + CMD_OFFSET; - if (!(drawctxt->flags & CTXT_FLAGS_PREAMBLE)) { + if (!(drawctxt->base.flags & KGSL_CONTEXT_PREAMBLE)) { ret = a3xx_create_gpustate_shadow(adreno_dev, drawctxt); if (ret) goto done; - drawctxt->flags |= CTXT_FLAGS_SHADER_SAVE; + set_bit(ADRENO_CONTEXT_SHADER_SAVE, &drawctxt->priv); } - if (!(drawctxt->flags & CTXT_FLAGS_NOGMEMALLOC)) + if (!(drawctxt->base.flags & KGSL_CONTEXT_NO_GMEM_ALLOC)) ret = a3xx_create_gmem_shadow(adreno_dev, drawctxt); done: @@ -2415,7 +2411,7 @@ static int a3xx_drawctxt_save(struct adreno_device *adreno_dev, if (context->state == ADRENO_CONTEXT_STATE_INVALID) return 0; - if (!(context->flags & CTXT_FLAGS_PREAMBLE)) { + if (!(context->base.flags & KGSL_CONTEXT_PREAMBLE)) { /* Fixup self modifying IBs for save operations */ ret = adreno_ringbuffer_issuecmds(device, context, KGSL_CMD_FLAGS_NONE, context->save_fixup, 3); @@ -2429,19 +2425,17 @@ static int a3xx_drawctxt_save(struct adreno_device *adreno_dev, if (ret) return ret; - if (context->flags & CTXT_FLAGS_SHADER_SAVE) { + if (test_bit(ADRENO_CONTEXT_SHADER_SAVE, &context->priv)) { /* Save shader instructions */ ret = adreno_ringbuffer_issuecmds(device, context, KGSL_CMD_FLAGS_PMODE, context->shader_save, 3); if (ret) return ret; - - context->flags |= CTXT_FLAGS_SHADER_RESTORE; + set_bit(ADRENO_CONTEXT_SHADER_RESTORE, &context->priv); } } - if ((context->flags & CTXT_FLAGS_GMEM_SAVE) && - (context->flags & CTXT_FLAGS_GMEM_SHADOW)) { + if (test_bit(ADRENO_CONTEXT_GMEM_SAVE, &context->priv)) { /* * Save GMEM (note: changes shader. shader must * already be saved.) @@ -2459,7 +2453,7 @@ static int a3xx_drawctxt_save(struct adreno_device *adreno_dev, if (ret) return ret; - context->flags |= CTXT_FLAGS_GMEM_RESTORE; + set_bit(ADRENO_CONTEXT_GMEM_RESTORE, &context->priv); } return 0; @@ -2481,7 +2475,7 @@ static int a3xx_drawctxt_restore(struct adreno_device *adreno_dev, * Shader must not already be restored.) */ - if (context->flags & CTXT_FLAGS_GMEM_RESTORE) { + if (test_bit(ADRENO_CONTEXT_GMEM_RESTORE, &context->priv)) { kgsl_cffdump_syncmem(context->base.device, &context->gpustate, context->context_gmem_shadow.gmem_restore[1], @@ -2494,10 +2488,10 @@ static int a3xx_drawctxt_restore(struct adreno_device *adreno_dev, gmem_restore, 3); if (ret) return ret; - context->flags &= ~CTXT_FLAGS_GMEM_RESTORE; + clear_bit(ADRENO_CONTEXT_GMEM_RESTORE, &context->priv); } - if (!(context->flags & CTXT_FLAGS_PREAMBLE)) { + if (!(context->base.flags & KGSL_CONTEXT_PREAMBLE)) { ret = adreno_ringbuffer_issuecmds(device, context, KGSL_CMD_FLAGS_NONE, context->reg_restore, 3); if (ret) @@ -2516,12 +2510,13 @@ static int a3xx_drawctxt_restore(struct adreno_device *adreno_dev, if (ret) return ret; - if (context->flags & CTXT_FLAGS_SHADER_RESTORE) + if (test_bit(ADRENO_CONTEXT_SHADER_RESTORE, &context->priv)) { ret = adreno_ringbuffer_issuecmds(device, context, KGSL_CMD_FLAGS_NONE, context->shader_restore, 3); if (ret) return ret; + } /* Restore HLSQ_CONTROL_0 register */ ret = adreno_ringbuffer_issuecmds(device, context, KGSL_CMD_FLAGS_NONE, diff --git a/drivers/gpu/msm/adreno_dispatch.c b/drivers/gpu/msm/adreno_dispatch.c index 1d8f22cf682..cdeb789fbd8 100644 --- a/drivers/gpu/msm/adreno_dispatch.c +++ b/drivers/gpu/msm/adreno_dispatch.c @@ -564,7 +564,7 @@ static int get_timestamp(struct adreno_context *drawctxt, return 0; } - if (drawctxt->flags & CTXT_FLAGS_USER_GENERATED_TS) { + if (drawctxt->base.flags & KGSL_CONTEXT_USER_GENERATED_TS) { /* * User specified timestamps need to be greater than the last * issued timestamp in the context @@ -608,10 +608,8 @@ int adreno_dispatcher_queue_cmd(struct adreno_device *adreno_dev, * to run (if it exists) regardless of the context state. */ - if (drawctxt->flags & CTXT_FLAGS_FORCE_PREAMBLE) { + if (test_and_clear_bit(ADRENO_CONTEXT_FORCE_PREAMBLE, &drawctxt->priv)) set_bit(CMDBATCH_FLAG_FORCE_PREAMBLE, &cmdbatch->priv); - drawctxt->flags &= ~CTXT_FLAGS_FORCE_PREAMBLE; - } /* * If we are waiting for the end of frame and it hasn't appeared yet, @@ -619,7 +617,7 @@ int adreno_dispatcher_queue_cmd(struct adreno_device *adreno_dev, * through the pipeline but it won't actually send any commands */ - if (drawctxt->flags & CTXT_FLAGS_SKIP_EOF) { + if (test_bit(ADRENO_CONTEXT_SKIP_EOF, &drawctxt->priv)) { set_bit(CMDBATCH_FLAG_SKIP, &cmdbatch->priv); /* @@ -628,14 +626,13 @@ int adreno_dispatcher_queue_cmd(struct adreno_device *adreno_dev, */ if (cmdbatch->flags & KGSL_CONTEXT_END_OF_FRAME) { - drawctxt->flags &= ~CTXT_FLAGS_SKIP_EOF; + clear_bit(ADRENO_CONTEXT_SKIP_EOF, &drawctxt->priv); /* * Force the preamble on the next command to ensure that * the state is correct */ - - drawctxt->flags |= CTXT_FLAGS_FORCE_PREAMBLE; + set_bit(ADRENO_CONTEXT_FORCE_PREAMBLE, &drawctxt->priv); } } @@ -681,10 +678,10 @@ int adreno_dispatcher_queue_cmd(struct adreno_device *adreno_dev, /* * Set the fault tolerance policy for the command batch - assuming the - * context hsn't disabled FT use the current device policy + * context hasn't disabled FT use the current device policy */ - if (drawctxt->flags & CTXT_FLAGS_NO_FAULT_TOLERANCE) + if (drawctxt->base.flags & KGSL_CONTEXT_NO_FAULT_TOLERANCE) set_bit(KGSL_FT_DISABLE, &cmdbatch->fault_policy); else cmdbatch->fault_policy = adreno_dev->ft_policy; @@ -776,7 +773,7 @@ static void cmdbatch_skip_frame(struct kgsl_cmdbatch *cmdbatch, */ if (skip && drawctxt) - drawctxt->flags |= CTXT_FLAGS_SKIP_EOF; + set_bit(ADRENO_CONTEXT_SKIP_EOF, &drawctxt->priv); /* * If we did see the EOF flag then force the preamble on for the @@ -784,7 +781,7 @@ static void cmdbatch_skip_frame(struct kgsl_cmdbatch *cmdbatch, */ if (!skip && drawctxt) - drawctxt->flags |= CTXT_FLAGS_FORCE_PREAMBLE; + set_bit(ADRENO_CONTEXT_FORCE_PREAMBLE, &drawctxt->priv); } static void remove_invalidated_cmdbatches(struct kgsl_device *device, @@ -1301,7 +1298,7 @@ static void adreno_dispatcher_work(struct work_struct *work) */ if (!adreno_dev->long_ib_detect || - drawctxt->flags & CTXT_FLAGS_NO_FAULT_TOLERANCE) + drawctxt->base.flags & KGSL_CONTEXT_NO_FAULT_TOLERANCE) break; /* diff --git a/drivers/gpu/msm/adreno_drawctxt.c b/drivers/gpu/msm/adreno_drawctxt.c index e107f22d5a9..3088915ce0c 100644 --- a/drivers/gpu/msm/adreno_drawctxt.c +++ b/drivers/gpu/msm/adreno_drawctxt.c @@ -420,7 +420,7 @@ adreno_drawctxt_create(struct kgsl_device_private *dev_priv, drawctxt->bin_base_offset = 0; drawctxt->timestamp = 0; - *flags &= (KGSL_CONTEXT_PREAMBLE | + drawctxt->base.flags = *flags & (KGSL_CONTEXT_PREAMBLE | KGSL_CONTEXT_NO_GMEM_ALLOC | KGSL_CONTEXT_PER_CONTEXT_TS | KGSL_CONTEXT_USER_GENERATED_TS | @@ -428,17 +428,7 @@ adreno_drawctxt_create(struct kgsl_device_private *dev_priv, KGSL_CONTEXT_TYPE_MASK); /* Always enable per-context timestamps */ - *flags |= KGSL_CONTEXT_PER_CONTEXT_TS; - drawctxt->flags |= CTXT_FLAGS_PER_CONTEXT_TS; - - if (*flags & KGSL_CONTEXT_PREAMBLE) - drawctxt->flags |= CTXT_FLAGS_PREAMBLE; - - if (*flags & KGSL_CONTEXT_NO_GMEM_ALLOC) - drawctxt->flags |= CTXT_FLAGS_NOGMEMALLOC; - - if (*flags & KGSL_CONTEXT_USER_GENERATED_TS) - drawctxt->flags |= CTXT_FLAGS_USER_GENERATED_TS; + drawctxt->base.flags |= KGSL_CONTEXT_PER_CONTEXT_TS; mutex_init(&drawctxt->mutex); init_waitqueue_head(&drawctxt->wq); @@ -452,18 +442,12 @@ adreno_drawctxt_create(struct kgsl_device_private *dev_priv, plist_node_init(&drawctxt->pending, ADRENO_CONTEXT_DEFAULT_PRIORITY); - if (*flags & KGSL_CONTEXT_NO_FAULT_TOLERANCE) - drawctxt->flags |= CTXT_FLAGS_NO_FAULT_TOLERANCE; - - drawctxt->type = - (*flags & KGSL_CONTEXT_TYPE_MASK) >> KGSL_CONTEXT_TYPE_SHIFT; - if (adreno_dev->gpudev->ctxt_create) { ret = adreno_dev->gpudev->ctxt_create(adreno_dev, drawctxt); if (ret) goto err; - } else if ((*flags & KGSL_CONTEXT_PREAMBLE) == 0 || - (*flags & KGSL_CONTEXT_NO_GMEM_ALLOC) == 0) { + } else if ((drawctxt->base.flags & KGSL_CONTEXT_PREAMBLE) == 0 || + (drawctxt->base.flags & KGSL_CONTEXT_NO_GMEM_ALLOC) == 0) { KGSL_DEV_ERR_ONCE(device, "legacy context switch not supported\n"); ret = -EINVAL; @@ -479,7 +463,8 @@ adreno_drawctxt_create(struct kgsl_device_private *dev_priv, kgsl_sharedmem_writel(device, &device->memstore, KGSL_MEMSTORE_OFFSET(drawctxt->base.id, eoptimestamp), 0); - + /* copy back whatever flags we dediced were valid */ + *flags = drawctxt->base.flags; return &drawctxt->base; err: kgsl_context_detach(&drawctxt->base); @@ -699,10 +684,10 @@ int adreno_drawctxt_switch(struct adreno_device *adreno_dev, if (flags & KGSL_CONTEXT_SAVE_GMEM) /* Set the flag in context so that the save is done * when this context is switched out. */ - drawctxt->flags |= CTXT_FLAGS_GMEM_SAVE; + set_bit(ADRENO_CONTEXT_GMEM_SAVE, &drawctxt->priv); else /* Remove GMEM saving flag from the context */ - drawctxt->flags &= ~CTXT_FLAGS_GMEM_SAVE; + clear_bit(ADRENO_CONTEXT_GMEM_SAVE, &drawctxt->priv); } /* already current? */ diff --git a/drivers/gpu/msm/adreno_drawctxt.h b/drivers/gpu/msm/adreno_drawctxt.h index c3ddda1e4af..7656cd546bd 100644 --- a/drivers/gpu/msm/adreno_drawctxt.h +++ b/drivers/gpu/msm/adreno_drawctxt.h @@ -16,44 +16,6 @@ #include "adreno_pm4types.h" #include "a2xx_reg.h" -/* Flags */ - -#define CTXT_FLAGS_NOT_IN_USE 0x00000000 -#define CTXT_FLAGS_IN_USE BIT(0) - -/* state shadow memory allocated */ -#define CTXT_FLAGS_STATE_SHADOW BIT(1) - -/* gmem shadow memory allocated */ -#define CTXT_FLAGS_GMEM_SHADOW BIT(2) -/* gmem must be copied to shadow */ -#define CTXT_FLAGS_GMEM_SAVE BIT(3) -/* gmem can be restored from shadow */ -#define CTXT_FLAGS_GMEM_RESTORE BIT(4) -/* preamble packed in cmdbuffer for context switching */ -#define CTXT_FLAGS_PREAMBLE BIT(5) -/* shader must be copied to shadow */ -#define CTXT_FLAGS_SHADER_SAVE BIT(6) -/* shader can be restored from shadow */ -#define CTXT_FLAGS_SHADER_RESTORE BIT(7) -/* Context has caused a GPU hang */ -#define CTXT_FLAGS_GPU_HANG BIT(8) -/* Specifies there is no need to save GMEM */ -#define CTXT_FLAGS_NOGMEMALLOC BIT(9) -/* Trash state for context */ -#define CTXT_FLAGS_TRASHSTATE BIT(10) -/* per context timestamps enabled */ -#define CTXT_FLAGS_PER_CONTEXT_TS BIT(11) -/* Context has caused a GPU hang and fault tolerance successful */ -#define CTXT_FLAGS_GPU_HANG_FT BIT(12) -/* User mode generated timestamps enabled */ -#define CTXT_FLAGS_USER_GENERATED_TS BIT(14) -/* Context skip till EOF */ -#define CTXT_FLAGS_SKIP_EOF BIT(15) -/* Context no fault tolerance */ -#define CTXT_FLAGS_NO_FAULT_TOLERANCE BIT(16) -/* Force the preamble for the next submission */ -#define CTXT_FLAGS_FORCE_PREAMBLE BIT(17) /* Symbolic table for the adreno draw context type */ #define ADRENO_DRAWCTXT_TYPES \ @@ -136,7 +98,6 @@ extern const struct adreno_context_ops adreno_preamble_ctx_ops; * @internal_timestamp: Global timestamp of the last issued command * NOTE: guarded by device->mutex, not drawctxt->mutex! * @state: Current state of the context - * @flags: Bitfield controlling behavior of the context * @priv: Internal flags * @type: Context type (GL, CL, RS) * @mutex: Mutex to protect the cmdqueue @@ -176,7 +137,6 @@ struct adreno_context { unsigned int timestamp; unsigned int internal_timestamp; int state; - uint32_t flags; unsigned long priv; unsigned int type; struct mutex mutex; @@ -223,10 +183,27 @@ struct adreno_context { /** * enum adreno_context_priv - Private flags for an adreno draw context * @ADRENO_CONTEXT_FAULT - set if the context has faulted (and recovered) + * @ADRENO_CONTEXT_GMEM_SAVE - gmem must be copied to shadow + * @ADRENO_CONTEXT_GMEM_RESTORE - gmem can be restored from shadow + * @ADRENO_CONTEXT_SHADER_SAVE - shader must be copied to shadow + * @ADRENO_CONTEXT_SHADER_RESTORE - shader can be restored from shadow + * @ADRENO_CONTEXT_GPU_HANG - Context has caused a GPU hang + * @ADRENO_CONTEXT_GPU_HANG_FT - Context has caused a GPU hang + * and fault tolerance was successful + * @ADRENO_CONTEXT_SKIP_EOF - Context skip IBs until the next end of frame + * marker. + * @ADRENO_CONTEXT_FORCE_PREAMBLE - Force the preamble for the next submission. */ - enum adreno_context_priv { ADRENO_CONTEXT_FAULT = 0, + ADRENO_CONTEXT_GMEM_SAVE, + ADRENO_CONTEXT_GMEM_RESTORE, + ADRENO_CONTEXT_SHADER_SAVE, + ADRENO_CONTEXT_SHADER_RESTORE, + ADRENO_CONTEXT_GPU_HANG, + ADRENO_CONTEXT_GPU_HANG_FT, + ADRENO_CONTEXT_SKIP_EOF, + ADRENO_CONTEXT_FORCE_PREAMBLE, }; struct kgsl_context *adreno_drawctxt_create(struct kgsl_device_private *, diff --git a/drivers/gpu/msm/adreno_ringbuffer.c b/drivers/gpu/msm/adreno_ringbuffer.c index a27b37bf0cf..44c7f1a1a63 100644 --- a/drivers/gpu/msm/adreno_ringbuffer.c +++ b/drivers/gpu/msm/adreno_ringbuffer.c @@ -1077,7 +1077,7 @@ int adreno_ringbuffer_submitcmd(struct adreno_device *adreno_dev, commands are stored in the first node of the IB chain. We can skip that if a context switch hasn't occured */ - if ((drawctxt->flags & CTXT_FLAGS_PREAMBLE) && + if ((drawctxt->base.flags & KGSL_CONTEXT_PREAMBLE) && !test_bit(CMDBATCH_FLAG_FORCE_PREAMBLE, &cmdbatch->priv) && (adreno_dev->drawctxt_active == drawctxt)) start_index = 1; diff --git a/drivers/gpu/msm/kgsl_device.h b/drivers/gpu/msm/kgsl_device.h index f2d0bed150b..410a32b10aa 100644 --- a/drivers/gpu/msm/kgsl_device.h +++ b/drivers/gpu/msm/kgsl_device.h @@ -342,9 +342,9 @@ struct kgsl_process_private; * @events_list: list node for the list of all contexts that have pending events * @pid: process that owns this context. * @tid: task that created this context. - * @pagefault: flag set if this context caused a pagefault. * @pagefault_ts: global timestamp of the pagefault, if KGSL_CONTEXT_PAGEFAULT * is set. + * @flags: flags from userspace controlling the behavior of this context */ struct kgsl_context { struct kref refcount; @@ -361,6 +361,7 @@ struct kgsl_context { struct list_head events; struct list_head events_list; unsigned int pagefault_ts; + unsigned int flags; }; /**