static void ar7240_misc_irq_ack(unsigned int irq) { #if 0 vpk("%s: %u ", __func__, irq); vps("%s\n", __builtin_return_address(0)); #endif ar7240_misc_irq_disable(irq); }
static void ar7240_misc_irq_end(unsigned int irq) { #if 0 vpk("%s: %u ", __func__, irq); vps("%s\n", __builtin_return_address(0)); #endif if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) ar7240_misc_irq_enable(irq); }
static unsigned int ar7240_misc_irq_startup(unsigned int irq) { #if 0 vpk("%s: %u ", __func__, irq); vps("%s\n", __builtin_return_address(0)); #endif ar7240_misc_irq_enable(irq); return 0; }
static void ar7240_misc_irq_disable(unsigned int irq) { #if 0 vpk("%s: %u ", __func__, irq); vps("%s\n", __builtin_return_address(0)); #endif ar7240_reg_rmw_clear(AR7240_MISC_INT_MASK, (1 << (irq - AR7240_MISC_IRQ_BASE))); }
intrusive_ptr<DocumentSourceSort> DocumentSourceSort::create( const intrusive_ptr<ExpressionContext>& pExpCtx, BSONObj sortOrder, long long limit) { intrusive_ptr<DocumentSourceSort> pSort = new DocumentSourceSort(pExpCtx); /* check for then iterate over the sort object */ BSONForEach(keyField, sortOrder) { const char* fieldName = keyField.fieldName(); if (str::equals(fieldName, "$mergePresorted")) { verify(keyField.Bool()); pSort->_mergingPresorted = true; continue; } if (keyField.type() == Object) { BSONObj metaDoc = keyField.Obj(); // this restriction is due to needing to figure out sort direction uassert(17312, "$meta is the only expression supported by $sort right now", metaDoc.firstElement().fieldNameStringData() == "$meta"); VariablesIdGenerator idGen; VariablesParseState vps(&idGen); pSort->vSortKey.push_back(ExpressionMeta::parse(metaDoc.firstElement(), vps)); // If sorting by textScore, sort highest scores first. If sorting by randVal, order // doesn't matter, so just always use descending. pSort->vAscending.push_back(false); continue; } uassert(15974, "$sort key ordering must be specified using a number or {$meta: 'textScore'}", keyField.isNumber()); int sortOrder = keyField.numberInt(); uassert(15975, "$sort key ordering must be 1 (for ascending) or -1 (for descending)", ((sortOrder == 1) || (sortOrder == -1))); pSort->addKey(fieldName, (sortOrder > 0)); } uassert(15976, "$sort stage must have at least one sort key", !pSort->vSortKey.empty()); if (limit > 0) { bool coalesced = pSort->coalesce(DocumentSourceLimit::create(pExpCtx, limit)); verify(coalesced); // should always coalesce verify(pSort->getLimit() == limit); } return pSort; }
intrusive_ptr<DocumentSource> DocumentSourceGroup::createFromBson( BSONElement elem, const intrusive_ptr<ExpressionContext>& pExpCtx) { uassert(15947, "a group's fields must be specified in an object", elem.type() == Object); intrusive_ptr<DocumentSourceGroup> pGroup(DocumentSourceGroup::create(pExpCtx)); BSONObj groupObj(elem.Obj()); BSONObjIterator groupIterator(groupObj); VariablesIdGenerator idGenerator; VariablesParseState vps(&idGenerator); while (groupIterator.more()) { BSONElement groupField(groupIterator.next()); const char* pFieldName = groupField.fieldName(); if (str::equals(pFieldName, "_id")) { uassert( 15948, "a group's _id may only be specified once", pGroup->_idExpressions.empty()); pGroup->parseIdExpression(groupField, vps); invariant(!pGroup->_idExpressions.empty()); } else if (str::equals(pFieldName, "$doingMerge")) { massert(17030, "$doingMerge should be true if present", groupField.Bool()); pGroup->setDoingMerge(true); } else { /* Treat as a projection field with the additional ability to add aggregation operators. */ auto parsedAccumulator = Accumulator::parseAccumulator(groupField, vps); auto fieldName = parsedAccumulator.first.toString(); auto accExpression = parsedAccumulator.second; auto factory = Accumulator::getFactory(groupField.embeddedObject().firstElementFieldName()); pGroup->addAccumulator(fieldName, factory, accExpression); } } uassert(15955, "a group specification must include an _id", !pGroup->_idExpressions.empty()); pGroup->_variables.reset(new Variables(idGenerator.getIdCount())); return pGroup; }
void ViewportSplitter::render(DataContainer& dataContainer) { cgt::vec2 vps(p_viewportSizeProperty->getValue()); cgt::vec2 evps(p_subViewViewportSize.getValue()); cgt::TextureUnit rtUnit, colorUnit, depthUnit; rtUnit.activate(); cgt::Texture* tex = new cgt::Texture(GL_TEXTURE_2D, cgt::ivec3(p_viewportSizeProperty->getValue(), 1), GL_RGBA8, cgt::Texture::LINEAR); tex->setWrapping(cgt::Texture::CLAMP_TO_EDGE); _fbo->activate(); _fbo->attachTexture(tex, GL_COLOR_ATTACHMENT0); glViewport(0, 0, static_cast<GLsizei>(vps.x), static_cast<GLsizei>(vps.y)); _copyShader->activate(); _copyShader->setUniform("_projectionMatrix", cgt::mat4::createOrtho(0, vps.x, vps.y, 0, -1, 1)); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); for (size_t i = 0; i < _numSubViews; ++i) { if (p_inputImageIds[i] != nullptr) { ScopedTypedData<RenderData> rd(dataContainer, p_inputImageIds[i]->getValue()); if (rd != nullptr) { rd->bind(_copyShader, colorUnit, depthUnit); _copyShader->setUniform("_modelMatrix", cgt::mat4::createScale(cgt::vec3(evps.x, evps.y, .5f))); if (_splitMode == HORIZONTAL) _copyShader->setUniform("_viewMatrix", cgt::mat4::createTranslation(cgt::vec3(float(i) * evps.x, 0.f, 0.f))); else if (_splitMode == VERTICAL) _copyShader->setUniform("_viewMatrix", cgt::mat4::createTranslation(cgt::vec3(0.f, float(_numSubViews - i - 1) * evps.y, 0.f))); _quad->render(GL_TRIANGLE_FAN); } } } _copyShader->deactivate(); dataContainer.addData(p_outputImageId.getValue(), new RenderData(_fbo)); _fbo->detachAll(); _fbo->deactivate(); }
intrusive_ptr<DocumentSource> DocumentSourceProject::createFromBson( BSONElement elem, const intrusive_ptr<ExpressionContext> &pExpCtx) { /* validate */ uassert(15969, str::stream() << projectName << " specification must be an object", elem.type() == Object); Expression::ObjectCtx objectCtx( Expression::ObjectCtx::DOCUMENT_OK | Expression::ObjectCtx::TOP_LEVEL | Expression::ObjectCtx::INCLUSION_OK ); VariablesIdGenerator idGenerator; VariablesParseState vps(&idGenerator); intrusive_ptr<Expression> parsed = Expression::parseObject(elem.Obj(), &objectCtx, vps); ExpressionObject* exprObj = dynamic_cast<ExpressionObject*>(parsed.get()); massert(16402, "parseObject() returned wrong type of Expression", exprObj); uassert(16403, "$projection requires at least one output field", exprObj->getFieldCount()); intrusive_ptr<DocumentSourceProject> pProject(new DocumentSourceProject(pExpCtx, exprObj)); pProject->_variables.reset(new Variables(idGenerator.getIdCount())); BSONObj projectObj = elem.Obj(); pProject->_raw = projectObj.getOwned(); #if defined(_DEBUG) if (exprObj->isSimple()) { DepsTracker deps; vector<string> path; exprObj->addDependencies(&deps, &path); pProject->_simpleProjection.init(deps.toProjection()); } #endif return pProject; }
void DocumentSourceSort::addKey(const string& fieldPath, bool ascending) { VariablesIdGenerator idGenerator; VariablesParseState vps(&idGenerator); vSortKey.push_back(ExpressionFieldPath::parse("$$ROOT." + fieldPath, vps)); vAscending.push_back(ascending); }
intrusive_ptr<DocumentSource> DocumentSourceGroup::createFromBson( BSONElement elem, const intrusive_ptr<ExpressionContext> &pExpCtx) { uassert(15947, "a group's fields must be specified in an object", elem.type() == Object); intrusive_ptr<DocumentSourceGroup> pGroup( DocumentSourceGroup::create(pExpCtx)); BSONObj groupObj(elem.Obj()); BSONObjIterator groupIterator(groupObj); VariablesIdGenerator idGenerator; VariablesParseState vps(&idGenerator); while(groupIterator.more()) { BSONElement groupField(groupIterator.next()); const char *pFieldName = groupField.fieldName(); if (str::equals(pFieldName, "_id")) { uassert(15948, "a group's _id may only be specified once", pGroup->_idExpressions.empty()); pGroup->parseIdExpression(groupField, vps); invariant(!pGroup->_idExpressions.empty()); } else if (str::equals(pFieldName, "$doingMerge")) { massert(17030, "$doingMerge should be true if present", groupField.Bool()); pGroup->setDoingMerge(true); } else { /* Treat as a projection field with the additional ability to add aggregation operators. */ uassert(16414, str::stream() << "the group aggregate field name '" << pFieldName << "' cannot be used because $group's field names cannot contain '.'", !str::contains(pFieldName, '.') ); uassert(15950, str::stream() << "the group aggregate field name '" << pFieldName << "' cannot be an operator name", pFieldName[0] != '$'); uassert(15951, str::stream() << "the group aggregate field '" << pFieldName << "' must be defined as an expression inside an object", groupField.type() == Object); BSONObj subField(groupField.Obj()); BSONObjIterator subIterator(subField); size_t subCount = 0; for(; subIterator.more(); ++subCount) { BSONElement subElement(subIterator.next()); /* look for the specified operator */ GroupOpDesc key; key.name = subElement.fieldName(); const GroupOpDesc *pOp = (const GroupOpDesc *)bsearch( &key, GroupOpTable, NGroupOp, sizeof(GroupOpDesc), GroupOpDescCmp); uassert(15952, str::stream() << "unknown group operator '" << key.name << "'", pOp); intrusive_ptr<Expression> pGroupExpr; BSONType elementType = subElement.type(); if (elementType == Object) { Expression::ObjectCtx oCtx(Expression::ObjectCtx::DOCUMENT_OK); pGroupExpr = Expression::parseObject(subElement.Obj(), &oCtx, vps); } else if (elementType == Array) { uasserted(15953, str::stream() << "aggregating group operators are unary (" << key.name << ")"); } else { /* assume its an atomic single operand */ pGroupExpr = Expression::parseOperand(subElement, vps); } pGroup->addAccumulator(pFieldName, pOp->factory, pGroupExpr); } uassert(15954, str::stream() << "the computed aggregate '" << pFieldName << "' must specify exactly one operator", subCount == 1); } } uassert(15955, "a group specification must include an _id", !pGroup->_idExpressions.empty()); pGroup->_variables.reset(new Variables(idGenerator.getIdCount())); return pGroup; }