code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
3
942
language
stringclasses
30 values
license
stringclasses
15 values
size
int32
3
1.05M
/* Copyright 2016 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package rollout import ( "fmt" "io" "k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/kubectl/cmd/templates" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource" "k8s.io/kubernetes/pkg/kubectl/polymorphichelpers" "k8s.io/kubernetes/pkg/kubectl/util/i18n" "github.com/spf13/cobra" ) var ( history_long = templates.LongDesc(` View previous rollout revisions and configurations.`) history_example = templates.Examples(` # View the rollout history of a deployment kubectl rollout history deployment/abc # View the details of daemonset revision 3 kubectl rollout history daemonset/abc --revision=3`) ) func NewCmdRolloutHistory(f cmdutil.Factory, out io.Writer) *cobra.Command { options := &resource.FilenameOptions{} validArgs := []string{"deployment", "daemonset", "statefulset"} cmd := &cobra.Command{ Use: "history (TYPE NAME | TYPE/NAME) [flags]", DisableFlagsInUseLine: true, Short: i18n.T("View rollout history"), Long: history_long, Example: history_example, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(RunHistory(f, cmd, out, args, options)) }, ValidArgs: validArgs, } cmd.Flags().Int64("revision", 0, "See the details, including podTemplate of the revision specified") usage := "identifying the resource to get from a server." cmdutil.AddFilenameOptionFlags(cmd, options, usage) return cmd } func RunHistory(f cmdutil.Factory, cmd *cobra.Command, out io.Writer, args []string, options *resource.FilenameOptions) error { if len(args) == 0 && cmdutil.IsFilenameSliceEmpty(options.Filenames) { return cmdutil.UsageErrorf(cmd, "Required resource not specified.") } revision := cmdutil.GetFlagInt64(cmd, "revision") if revision < 0 { return fmt.Errorf("revision must be a positive integer: %v", revision) } cmdNamespace, enforceNamespace, err := f.ToRawKubeConfigLoader().Namespace() if err != nil { return err } r := f.NewBuilder(). WithScheme(legacyscheme.Scheme). NamespaceParam(cmdNamespace).DefaultNamespace(). FilenameParam(enforceNamespace, options). ResourceTypeOrNameArgs(true, args...). ContinueOnError(). Latest(). Flatten(). Do() err = r.Err() if err != nil { return err } return r.Visit(func(info *resource.Info, err error) error { if err != nil { return err } mapping := info.ResourceMapping() historyViewer, err := polymorphichelpers.HistoryViewerFn(f, mapping) if err != nil { return err } historyInfo, err := historyViewer.ViewHistory(info.Namespace, info.Name, revision) if err != nil { return err } header := fmt.Sprintf("%s %q", mapping.Resource.Resource, info.Name) if revision > 0 { header = fmt.Sprintf("%s with revision #%d", header, revision) } fmt.Fprintf(out, "%s\n", header) fmt.Fprintf(out, "%s\n", historyInfo) return nil }) }
wjiangjay/origin
vendor/k8s.io/kubernetes/pkg/kubectl/cmd/rollout/rollout_history.go
GO
apache-2.0
3,465
import { DependencyMetadata } from '../di/metadata'; import { Type } from '../facade/lang'; /** * Specifies that a constant attribute value should be injected. * * The directive can inject constant string literals of host element attributes. * * ### Example * * Suppose we have an `<input>` element and want to know its `type`. * * ```html * <input type="text"> * ``` * * A decorator can inject string literal `text` like so: * * {@example core/ts/metadata/metadata.ts region='attributeMetadata'} * @ts2dart_const * @stable */ export declare class AttributeMetadata extends DependencyMetadata { attributeName: string; constructor(attributeName: string); token: AttributeMetadata; toString(): string; } /** * Declares an injectable parameter to be a live list of directives or variable * bindings from the content children of a directive. * * ### Example ([live demo](http://plnkr.co/edit/lY9m8HLy7z06vDoUaSN2?p=preview)) * * Assume that `<tabs>` component would like to get a list its children `<pane>` * components as shown in this example: * * ```html * <tabs> * <pane title="Overview">...</pane> * <pane *ngFor="let o of objects" [title]="o.title">{{o.text}}</pane> * </tabs> * ``` * * The preferred solution is to query for `Pane` directives using this decorator. * * ```javascript * @Component({ * selector: 'pane', * inputs: ['title'] * }) * class Pane { * title:string; * } * * @Component({ * selector: 'tabs', * template: ` * <ul> * <li *ngFor="let pane of panes">{{pane.title}}</li> * </ul> * <ng-content></ng-content> * ` * }) * class Tabs { * panes: QueryList<Pane>; * constructor(@Query(Pane) panes:QueryList<Pane>) { * this.panes = panes; * } * } * ``` * * A query can look for variable bindings by passing in a string with desired binding symbol. * * ### Example ([live demo](http://plnkr.co/edit/sT2j25cH1dURAyBRCKx1?p=preview)) * ```html * <seeker> * <div #findme>...</div> * </seeker> * * @Component({ selector: 'seeker' }) * class Seeker { * constructor(@Query('findme') elList: QueryList<ElementRef>) {...} * } * ``` * * In this case the object that is injected depend on the type of the variable * binding. It can be an ElementRef, a directive or a component. * * Passing in a comma separated list of variable bindings will query for all of them. * * ```html * <seeker> * <div #find-me>...</div> * <div #find-me-too>...</div> * </seeker> * * @Component({ * selector: 'seeker' * }) * class Seeker { * constructor(@Query('findMe, findMeToo') elList: QueryList<ElementRef>) {...} * } * ``` * * Configure whether query looks for direct children or all descendants * of the querying element, by using the `descendants` parameter. * It is set to `false` by default. * * ### Example ([live demo](http://plnkr.co/edit/wtGeB977bv7qvA5FTYl9?p=preview)) * ```html * <container #first> * <item>a</item> * <item>b</item> * <container #second> * <item>c</item> * </container> * </container> * ``` * * When querying for items, the first container will see only `a` and `b` by default, * but with `Query(TextDirective, {descendants: true})` it will see `c` too. * * The queried directives are kept in a depth-first pre-order with respect to their * positions in the DOM. * * Query does not look deep into any subcomponent views. * * Query is updated as part of the change-detection cycle. Since change detection * happens after construction of a directive, QueryList will always be empty when observed in the * constructor. * * The injected object is an unmodifiable live list. * See {@link QueryList} for more details. * @ts2dart_const * @deprecated */ export declare class QueryMetadata extends DependencyMetadata { private _selector; /** * whether we want to query only direct children (false) or all * children (true). */ descendants: boolean; first: boolean; /** * The DI token to read from an element that matches the selector. */ read: any; constructor(_selector: Type | string, {descendants, first, read}?: { descendants?: boolean; first?: boolean; read?: any; }); /** * always `false` to differentiate it with {@link ViewQueryMetadata}. */ isViewQuery: boolean; /** * what this is querying for. */ selector: any; /** * whether this is querying for a variable binding or a directive. */ isVarBindingQuery: boolean; /** * returns a list of variable bindings this is querying for. * Only applicable if this is a variable bindings query. */ varBindings: string[]; toString(): string; } /** * Configures a content query. * * Content queries are set before the `ngAfterContentInit` callback is called. * * ### Example * * ``` * @Directive({ * selector: 'someDir' * }) * class SomeDir { * @ContentChildren(ChildDirective) contentChildren: QueryList<ChildDirective>; * * ngAfterContentInit() { * // contentChildren is set * } * } * ``` * @ts2dart_const * @stable */ export declare class ContentChildrenMetadata extends QueryMetadata { constructor(_selector: Type | string, {descendants, read}?: { descendants?: boolean; read?: any; }); } /** * Configures a content query. * * Content queries are set before the `ngAfterContentInit` callback is called. * * ### Example * * ``` * @Directive({ * selector: 'someDir' * }) * class SomeDir { * @ContentChild(ChildDirective) contentChild; * * ngAfterContentInit() { * // contentChild is set * } * } * ``` * @ts2dart_const * @stable */ export declare class ContentChildMetadata extends QueryMetadata { constructor(_selector: Type | string, {read}?: { read?: any; }); } /** * Similar to {@link QueryMetadata}, but querying the component view, instead of * the content children. * * ### Example ([live demo](http://plnkr.co/edit/eNsFHDf7YjyM6IzKxM1j?p=preview)) * * ```javascript * @Component({ * ..., * template: ` * <item> a </item> * <item> b </item> * <item> c </item> * ` * }) * class MyComponent { * shown: boolean; * * constructor(private @ViewQuery(Item) items:QueryList<Item>) { * items.changes.subscribe(() => console.log(items.length)); * } * } * ``` * * Supports the same querying parameters as {@link QueryMetadata}, except * `descendants`. This always queries the whole view. * * As `shown` is flipped between true and false, items will contain zero of one * items. * * Specifies that a {@link QueryList} should be injected. * * The injected object is an iterable and observable live list. * See {@link QueryList} for more details. * @ts2dart_const * @deprecated */ export declare class ViewQueryMetadata extends QueryMetadata { constructor(_selector: Type | string, {descendants, first, read}?: { descendants?: boolean; first?: boolean; read?: any; }); /** * always `true` to differentiate it with {@link QueryMetadata}. */ isViewQuery: boolean; toString(): string; } /** * Declares a list of child element references. * * Angular automatically updates the list when the DOM is updated. * * `ViewChildren` takes an argument to select elements. * * - If the argument is a type, directives or components with the type will be bound. * * - If the argument is a string, the string is interpreted as a list of comma-separated selectors. * For each selector, an element containing the matching template variable (e.g. `#child`) will be * bound. * * View children are set before the `ngAfterViewInit` callback is called. * * ### Example * * With type selector: * * ``` * @Component({ * selector: 'child-cmp', * template: '<p>child</p>' * }) * class ChildCmp { * doSomething() {} * } * * @Component({ * selector: 'some-cmp', * template: ` * <child-cmp></child-cmp> * <child-cmp></child-cmp> * <child-cmp></child-cmp> * `, * directives: [ChildCmp] * }) * class SomeCmp { * @ViewChildren(ChildCmp) children:QueryList<ChildCmp>; * * ngAfterViewInit() { * // children are set * this.children.toArray().forEach((child)=>child.doSomething()); * } * } * ``` * * With string selector: * * ``` * @Component({ * selector: 'child-cmp', * template: '<p>child</p>' * }) * class ChildCmp { * doSomething() {} * } * * @Component({ * selector: 'some-cmp', * template: ` * <child-cmp #child1></child-cmp> * <child-cmp #child2></child-cmp> * <child-cmp #child3></child-cmp> * `, * directives: [ChildCmp] * }) * class SomeCmp { * @ViewChildren('child1,child2,child3') children:QueryList<ChildCmp>; * * ngAfterViewInit() { * // children are set * this.children.toArray().forEach((child)=>child.doSomething()); * } * } * ``` * @ts2dart_const * @stable */ export declare class ViewChildrenMetadata extends ViewQueryMetadata { constructor(_selector: Type | string, {read}?: { read?: any; }); } /** * * Declares a reference of child element. * * `ViewChildren` takes an argument to select elements. * * - If the argument is a type, a directive or a component with the type will be bound. * If the argument is a string, the string is interpreted as a selector. An element containing the matching template variable (e.g. `#child`) will be bound. * * In either case, `@ViewChild()` assigns the first (looking from above) element if there are multiple matches. * * View child is set before the `ngAfterViewInit` callback is called. * * ### Example * * With type selector: * * ``` * @Component({ * selector: 'child-cmp', * template: '<p>child</p>' * }) * class ChildCmp { * doSomething() {} * } * * @Component({ * selector: 'some-cmp', * template: '<child-cmp></child-cmp>', * directives: [ChildCmp] * }) * class SomeCmp { * @ViewChild(ChildCmp) child:ChildCmp; * * ngAfterViewInit() { * // child is set * this.child.doSomething(); * } * } * ``` * * With string selector: * * ``` * @Component({ * selector: 'child-cmp', * template: '<p>child</p>' * }) * class ChildCmp { * doSomething() {} * } * * @Component({ * selector: 'some-cmp', * template: '<child-cmp #child></child-cmp>', * directives: [ChildCmp] * }) * class SomeCmp { * @ViewChild('child') child:ChildCmp; * * ngAfterViewInit() { * // child is set * this.child.doSomething(); * } * } * ``` * @ts2dart_const * @stable */ export declare class ViewChildMetadata extends ViewQueryMetadata { constructor(_selector: Type | string, {read}?: { read?: any; }); }
evandor/skysail-webconsole
webconsole.client/client/dist/lib/@angular/core/src/metadata/di.d.ts
TypeScript
apache-2.0
10,841
/* * Copyright (C) 2008 Atmel Corporation * * Backlight driver using Atmel PWM peripheral. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #include <linux/init.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/fb.h> #include <linux/clk.h> #include <linux/gpio.h> #include <linux/backlight.h> #include <linux/atmel_pwm.h> #include <linux/atmel-pwm-bl.h> #include <linux/slab.h> struct atmel_pwm_bl { const struct atmel_pwm_bl_platform_data *pdata; struct backlight_device *bldev; struct platform_device *pdev; struct pwm_channel pwmc; int gpio_on; }; static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) { struct atmel_pwm_bl *pwmbl = bl_get_data(bd); int intensity = bd->props.brightness; int pwm_duty; if (bd->props.power != FB_BLANK_UNBLANK) intensity = 0; if (bd->props.fb_blank != FB_BLANK_UNBLANK) intensity = 0; if (pwmbl->pdata->pwm_active_low) pwm_duty = pwmbl->pdata->pwm_duty_min + intensity; else pwm_duty = pwmbl->pdata->pwm_duty_max - intensity; if (pwm_duty > pwmbl->pdata->pwm_duty_max) pwm_duty = pwmbl->pdata->pwm_duty_max; if (pwm_duty < pwmbl->pdata->pwm_duty_min) pwm_duty = pwmbl->pdata->pwm_duty_min; if (!intensity) { if (pwmbl->gpio_on != -1) { gpio_set_value(pwmbl->gpio_on, 0 ^ pwmbl->pdata->on_active_low); } pwm_channel_writel(&pwmbl->pwmc, PWM_CUPD, pwm_duty); pwm_channel_disable(&pwmbl->pwmc); } else { pwm_channel_enable(&pwmbl->pwmc); pwm_channel_writel(&pwmbl->pwmc, PWM_CUPD, pwm_duty); if (pwmbl->gpio_on != -1) { gpio_set_value(pwmbl->gpio_on, 1 ^ pwmbl->pdata->on_active_low); } } return 0; } static int atmel_pwm_bl_get_intensity(struct backlight_device *bd) { struct atmel_pwm_bl *pwmbl = bl_get_data(bd); u8 intensity; if (pwmbl->pdata->pwm_active_low) { intensity = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY) - pwmbl->pdata->pwm_duty_min; } else { intensity = pwmbl->pdata->pwm_duty_max - pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY); } return intensity; } static int atmel_pwm_bl_init_pwm(struct atmel_pwm_bl *pwmbl) { unsigned long pwm_rate = pwmbl->pwmc.mck; unsigned long prescale = DIV_ROUND_UP(pwm_rate, (pwmbl->pdata->pwm_frequency * pwmbl->pdata->pwm_compare_max)) - 1; /* * Prescale must be power of two and maximum 0xf in size because of * hardware limit. PWM speed will be: * PWM module clock speed / (2 ^ prescale). */ prescale = fls(prescale); if (prescale > 0xf) prescale = 0xf; pwm_channel_writel(&pwmbl->pwmc, PWM_CMR, prescale); pwm_channel_writel(&pwmbl->pwmc, PWM_CDTY, pwmbl->pdata->pwm_duty_min + pwmbl->bldev->props.brightness); pwm_channel_writel(&pwmbl->pwmc, PWM_CPRD, pwmbl->pdata->pwm_compare_max); dev_info(&pwmbl->pdev->dev, "Atmel PWM backlight driver (%lu Hz)\n", pwmbl->pwmc.mck / pwmbl->pdata->pwm_compare_max / (1 << prescale)); return pwm_channel_enable(&pwmbl->pwmc); } static const struct backlight_ops atmel_pwm_bl_ops = { .get_brightness = atmel_pwm_bl_get_intensity, .update_status = atmel_pwm_bl_set_intensity, }; static int __init atmel_pwm_bl_probe(struct platform_device *pdev) { struct backlight_properties props; const struct atmel_pwm_bl_platform_data *pdata; struct backlight_device *bldev; struct atmel_pwm_bl *pwmbl; int retval; pwmbl = devm_kzalloc(&pdev->dev, sizeof(struct atmel_pwm_bl), GFP_KERNEL); if (!pwmbl) return -ENOMEM; pwmbl->pdev = pdev; pdata = pdev->dev.platform_data; if (!pdata) { retval = -ENODEV; goto err_free_mem; } if (pdata->pwm_compare_max < pdata->pwm_duty_max || pdata->pwm_duty_min > pdata->pwm_duty_max || pdata->pwm_frequency == 0) { retval = -EINVAL; goto err_free_mem; } pwmbl->pdata = pdata; pwmbl->gpio_on = pdata->gpio_on; retval = pwm_channel_alloc(pdata->pwm_channel, &pwmbl->pwmc); if (retval) goto err_free_mem; if (pwmbl->gpio_on != -1) { retval = devm_gpio_request(&pdev->dev, pwmbl->gpio_on, "gpio_atmel_pwm_bl"); if (retval) { pwmbl->gpio_on = -1; goto err_free_pwm; } /* Turn display off by default. */ retval = gpio_direction_output(pwmbl->gpio_on, 0 ^ pdata->on_active_low); if (retval) goto err_free_pwm; } memset(&props, 0, sizeof(struct backlight_properties)); props.type = BACKLIGHT_RAW; props.max_brightness = pdata->pwm_duty_max - pdata->pwm_duty_min; bldev = backlight_device_register("atmel-pwm-bl", &pdev->dev, pwmbl, &atmel_pwm_bl_ops, &props); if (IS_ERR(bldev)) { retval = PTR_ERR(bldev); goto err_free_pwm; } pwmbl->bldev = bldev; platform_set_drvdata(pdev, pwmbl); /* Power up the backlight by default at middle intesity. */ bldev->props.power = FB_BLANK_UNBLANK; bldev->props.brightness = bldev->props.max_brightness / 2; retval = atmel_pwm_bl_init_pwm(pwmbl); if (retval) goto err_free_bl_dev; atmel_pwm_bl_set_intensity(bldev); return 0; err_free_bl_dev: platform_set_drvdata(pdev, NULL); backlight_device_unregister(bldev); err_free_pwm: pwm_channel_free(&pwmbl->pwmc); err_free_mem: return retval; } static int __exit atmel_pwm_bl_remove(struct platform_device *pdev) { struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev); if (pwmbl->gpio_on != -1) gpio_set_value(pwmbl->gpio_on, 0); pwm_channel_disable(&pwmbl->pwmc); pwm_channel_free(&pwmbl->pwmc); backlight_device_unregister(pwmbl->bldev); platform_set_drvdata(pdev, NULL); return 0; } static struct platform_driver atmel_pwm_bl_driver = { .driver = { .name = "atmel-pwm-bl", }, /* REVISIT add suspend() and resume() */ .remove = __exit_p(atmel_pwm_bl_remove), }; module_platform_driver_probe(atmel_pwm_bl_driver, atmel_pwm_bl_probe); MODULE_AUTHOR("Hans-Christian egtvedt <[email protected]>"); MODULE_DESCRIPTION("Atmel PWM backlight driver"); MODULE_LICENSE("GPL");
Carlstark/SAMA5D4-XULT
linux-at91-linux-3.10/drivers/video/backlight/atmel-pwm-bl.c
C
gpl-2.0
6,002
<?php /** * PHPUnit * * Copyright (c) 2010-2014, Sebastian Bergmann <[email protected]>. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of Sebastian Bergmann nor the names of his * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * @package PHPUnit_MockObject * @author Sebastian Bergmann <[email protected]> * @copyright 2010-2014 Sebastian Bergmann <[email protected]> * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License * @link http://github.com/sebastianbergmann/phpunit-mock-objects * @since File available since Release 1.0.0 */ /** * An object that stubs the process of a normal method for a mock object. * * The stub object will replace the code for the stubbed method and return a * specific value instead of the original value. * * @package PHPUnit_MockObject * @author Sebastian Bergmann <[email protected]> * @copyright 2010-2014 Sebastian Bergmann <[email protected]> * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License * @version Release: @package_version@ * @link http://github.com/sebastianbergmann/phpunit-mock-objects * @since Interface available since Release 1.0.0 */ interface PHPUnit_Framework_MockObject_Stub extends PHPUnit_Framework_SelfDescribing { /** * Fakes the processing of the invocation $invocation by returning a * specific value. * * @param PHPUnit_Framework_MockObject_Invocation $invocation * The invocation which was mocked and matched by the current method * and argument matchers. * @return mixed */ public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation); }
CE-KMITL-CLOUD-2014/Foodshare
your-project-name/vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub.php
PHP
apache-2.0
3,261
/* * ad525x_dpot: Driver for the Analog Devices digital potentiometers * Copyright (c) 2009-2010 Analog Devices, Inc. * Author: Michael Hennerich <[email protected]> * * DEVID #Wipers #Positions Resistor Options (kOhm) * AD5258 1 64 1, 10, 50, 100 * AD5259 1 256 5, 10, 50, 100 * AD5251 2 64 1, 10, 50, 100 * AD5252 2 256 1, 10, 50, 100 * AD5255 3 512 25, 250 * AD5253 4 64 1, 10, 50, 100 * AD5254 4 256 1, 10, 50, 100 * AD5160 1 256 5, 10, 50, 100 * AD5161 1 256 5, 10, 50, 100 * AD5162 2 256 2.5, 10, 50, 100 * AD5165 1 256 100 * AD5200 1 256 10, 50 * AD5201 1 33 10, 50 * AD5203 4 64 10, 100 * AD5204 4 256 10, 50, 100 * AD5206 6 256 10, 50, 100 * AD5207 2 256 10, 50, 100 * AD5231 1 1024 10, 50, 100 * AD5232 2 256 10, 50, 100 * AD5233 4 64 10, 50, 100 * AD5235 2 1024 25, 250 * AD5260 1 256 20, 50, 200 * AD5262 2 256 20, 50, 200 * AD5263 4 256 20, 50, 200 * AD5290 1 256 10, 50, 100 * AD5291 1 256 20, 50, 100 (20-TP) * AD5292 1 1024 20, 50, 100 (20-TP) * AD5293 1 1024 20, 50, 100 * AD7376 1 128 10, 50, 100, 1M * AD8400 1 256 1, 10, 50, 100 * AD8402 2 256 1, 10, 50, 100 * AD8403 4 256 1, 10, 50, 100 * ADN2850 3 512 25, 250 * AD5241 1 256 10, 100, 1M * AD5246 1 128 5, 10, 50, 100 * AD5247 1 128 5, 10, 50, 100 * AD5245 1 256 5, 10, 50, 100 * AD5243 2 256 2.5, 10, 50, 100 * AD5248 2 256 2.5, 10, 50, 100 * AD5242 2 256 20, 50, 200 * AD5280 1 256 20, 50, 200 * AD5282 2 256 20, 50, 200 * ADN2860 3 512 25, 250 * AD5273 1 64 1, 10, 50, 100 (OTP) * AD5171 1 64 5, 10, 50, 100 (OTP) * AD5170 1 256 2.5, 10, 50, 100 (OTP) * AD5172 2 256 2.5, 10, 50, 100 (OTP) * AD5173 2 256 2.5, 10, 50, 100 (OTP) * AD5270 1 1024 20, 50, 100 (50-TP) * AD5271 1 256 20, 50, 100 (50-TP) * AD5272 1 1024 20, 50, 100 (50-TP) * AD5274 1 256 20, 50, 100 (50-TP) * * See Documentation/misc-devices/ad525x_dpot.txt for more info. * * derived from ad5258.c * Copyright (c) 2009 Cyber Switching, Inc. * Author: Chris Verges <[email protected]> * * derived from ad5252.c * Copyright (c) 2006-2011 Michael Hennerich <[email protected]> * * Licensed under the GPL-2 or later. */ #include <linux/module.h> #include <linux/device.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/delay.h> #include <linux/slab.h> #include "ad525x_dpot.h" /* * Client data (each client gets its own) */ struct dpot_data { struct ad_dpot_bus_data bdata; struct mutex update_lock; unsigned rdac_mask; unsigned max_pos; unsigned long devid; unsigned uid; unsigned feat; unsigned wipers; u16 rdac_cache[MAX_RDACS]; DECLARE_BITMAP(otp_en_mask, MAX_RDACS); }; static inline int dpot_read_d8(struct dpot_data *dpot) { return dpot->bdata.bops->read_d8(dpot->bdata.client); } static inline int dpot_read_r8d8(struct dpot_data *dpot, u8 reg) { return dpot->bdata.bops->read_r8d8(dpot->bdata.client, reg); } static inline int dpot_read_r8d16(struct dpot_data *dpot, u8 reg) { return dpot->bdata.bops->read_r8d16(dpot->bdata.client, reg); } static inline int dpot_write_d8(struct dpot_data *dpot, u8 val) { return dpot->bdata.bops->write_d8(dpot->bdata.client, val); } static inline int dpot_write_r8d8(struct dpot_data *dpot, u8 reg, u16 val) { return dpot->bdata.bops->write_r8d8(dpot->bdata.client, reg, val); } static inline int dpot_write_r8d16(struct dpot_data *dpot, u8 reg, u16 val) { return dpot->bdata.bops->write_r8d16(dpot->bdata.client, reg, val); } static s32 dpot_read_spi(struct dpot_data *dpot, u8 reg) { unsigned ctrl = 0; int value; if (!(reg & (DPOT_ADDR_EEPROM | DPOT_ADDR_CMD))) { if (dpot->feat & F_RDACS_WONLY) return dpot->rdac_cache[reg & DPOT_RDAC_MASK]; if (dpot->uid == DPOT_UID(AD5291_ID) || dpot->uid == DPOT_UID(AD5292_ID) || dpot->uid == DPOT_UID(AD5293_ID)) { value = dpot_read_r8d8(dpot, DPOT_AD5291_READ_RDAC << 2); if (dpot->uid == DPOT_UID(AD5291_ID)) value = value >> 2; return value; } else if (dpot->uid == DPOT_UID(AD5270_ID) || dpot->uid == DPOT_UID(AD5271_ID)) { value = dpot_read_r8d8(dpot, DPOT_AD5270_1_2_4_READ_RDAC << 2); if (value < 0) return value; if (dpot->uid == DPOT_UID(AD5271_ID)) value = value >> 2; return value; } ctrl = DPOT_SPI_READ_RDAC; } else if (reg & DPOT_ADDR_EEPROM) { ctrl = DPOT_SPI_READ_EEPROM; } if (dpot->feat & F_SPI_16BIT) return dpot_read_r8d8(dpot, ctrl); else if (dpot->feat & F_SPI_24BIT) return dpot_read_r8d16(dpot, ctrl); return -EFAULT; } static s32 dpot_read_i2c(struct dpot_data *dpot, u8 reg) { int value; unsigned ctrl = 0; switch (dpot->uid) { case DPOT_UID(AD5246_ID): case DPOT_UID(AD5247_ID): return dpot_read_d8(dpot); case DPOT_UID(AD5245_ID): case DPOT_UID(AD5241_ID): case DPOT_UID(AD5242_ID): case DPOT_UID(AD5243_ID): case DPOT_UID(AD5248_ID): case DPOT_UID(AD5280_ID): case DPOT_UID(AD5282_ID): ctrl = ((reg & DPOT_RDAC_MASK) == DPOT_RDAC0) ? 0 : DPOT_AD5282_RDAC_AB; return dpot_read_r8d8(dpot, ctrl); case DPOT_UID(AD5170_ID): case DPOT_UID(AD5171_ID): case DPOT_UID(AD5273_ID): return dpot_read_d8(dpot); case DPOT_UID(AD5172_ID): case DPOT_UID(AD5173_ID): ctrl = ((reg & DPOT_RDAC_MASK) == DPOT_RDAC0) ? 0 : DPOT_AD5172_3_A0; return dpot_read_r8d8(dpot, ctrl); case DPOT_UID(AD5272_ID): case DPOT_UID(AD5274_ID): dpot_write_r8d8(dpot, (DPOT_AD5270_1_2_4_READ_RDAC << 2), 0); value = dpot_read_r8d16(dpot, DPOT_AD5270_1_2_4_RDAC << 2); if (value < 0) return value; /* * AD5272/AD5274 returns high byte first, however * underling smbus expects low byte first. */ value = swab16(value); if (dpot->uid == DPOT_UID(AD5271_ID)) value = value >> 2; return value; default: if ((reg & DPOT_REG_TOL) || (dpot->max_pos > 256)) return dpot_read_r8d16(dpot, (reg & 0xF8) | ((reg & 0x7) << 1)); else return dpot_read_r8d8(dpot, reg); } } static s32 dpot_read(struct dpot_data *dpot, u8 reg) { if (dpot->feat & F_SPI) return dpot_read_spi(dpot, reg); else return dpot_read_i2c(dpot, reg); } static s32 dpot_write_spi(struct dpot_data *dpot, u8 reg, u16 value) { unsigned val = 0; if (!(reg & (DPOT_ADDR_EEPROM | DPOT_ADDR_CMD | DPOT_ADDR_OTP))) { if (dpot->feat & F_RDACS_WONLY) dpot->rdac_cache[reg & DPOT_RDAC_MASK] = value; if (dpot->feat & F_AD_APPDATA) { if (dpot->feat & F_SPI_8BIT) { val = ((reg & DPOT_RDAC_MASK) << DPOT_MAX_POS(dpot->devid)) | value; return dpot_write_d8(dpot, val); } else if (dpot->feat & F_SPI_16BIT) { val = ((reg & DPOT_RDAC_MASK) << DPOT_MAX_POS(dpot->devid)) | value; return dpot_write_r8d8(dpot, val >> 8, val & 0xFF); } else BUG(); } else { if (dpot->uid == DPOT_UID(AD5291_ID) || dpot->uid == DPOT_UID(AD5292_ID) || dpot->uid == DPOT_UID(AD5293_ID)) { dpot_write_r8d8(dpot, DPOT_AD5291_CTRLREG << 2, DPOT_AD5291_UNLOCK_CMD); if (dpot->uid == DPOT_UID(AD5291_ID)) value = value << 2; return dpot_write_r8d8(dpot, (DPOT_AD5291_RDAC << 2) | (value >> 8), value & 0xFF); } else if (dpot->uid == DPOT_UID(AD5270_ID) || dpot->uid == DPOT_UID(AD5271_ID)) { dpot_write_r8d8(dpot, DPOT_AD5270_1_2_4_CTRLREG << 2, DPOT_AD5270_1_2_4_UNLOCK_CMD); if (dpot->uid == DPOT_UID(AD5271_ID)) value = value << 2; return dpot_write_r8d8(dpot, (DPOT_AD5270_1_2_4_RDAC << 2) | (value >> 8), value & 0xFF); } val = DPOT_SPI_RDAC | (reg & DPOT_RDAC_MASK); } } else if (reg & DPOT_ADDR_EEPROM) { val = DPOT_SPI_EEPROM | (reg & DPOT_RDAC_MASK); } else if (reg & DPOT_ADDR_CMD) { switch (reg) { case DPOT_DEC_ALL_6DB: val = DPOT_SPI_DEC_ALL_6DB; break; case DPOT_INC_ALL_6DB: val = DPOT_SPI_INC_ALL_6DB; break; case DPOT_DEC_ALL: val = DPOT_SPI_DEC_ALL; break; case DPOT_INC_ALL: val = DPOT_SPI_INC_ALL; break; } } else if (reg & DPOT_ADDR_OTP) { if (dpot->uid == DPOT_UID(AD5291_ID) || dpot->uid == DPOT_UID(AD5292_ID)) { return dpot_write_r8d8(dpot, DPOT_AD5291_STORE_XTPM << 2, 0); } else if (dpot->uid == DPOT_UID(AD5270_ID) || dpot->uid == DPOT_UID(AD5271_ID)) { return dpot_write_r8d8(dpot, DPOT_AD5270_1_2_4_STORE_XTPM << 2, 0); } } else BUG(); if (dpot->feat & F_SPI_16BIT) return dpot_write_r8d8(dpot, val, value); else if (dpot->feat & F_SPI_24BIT) return dpot_write_r8d16(dpot, val, value); return -EFAULT; } static s32 dpot_write_i2c(struct dpot_data *dpot, u8 reg, u16 value) { /* Only write the instruction byte for certain commands */ unsigned tmp = 0, ctrl = 0; switch (dpot->uid) { case DPOT_UID(AD5246_ID): case DPOT_UID(AD5247_ID): return dpot_write_d8(dpot, value); break; case DPOT_UID(AD5245_ID): case DPOT_UID(AD5241_ID): case DPOT_UID(AD5242_ID): case DPOT_UID(AD5243_ID): case DPOT_UID(AD5248_ID): case DPOT_UID(AD5280_ID): case DPOT_UID(AD5282_ID): ctrl = ((reg & DPOT_RDAC_MASK) == DPOT_RDAC0) ? 0 : DPOT_AD5282_RDAC_AB; return dpot_write_r8d8(dpot, ctrl, value); break; case DPOT_UID(AD5171_ID): case DPOT_UID(AD5273_ID): if (reg & DPOT_ADDR_OTP) { tmp = dpot_read_d8(dpot); if (tmp >> 6) /* Ready to Program? */ return -EFAULT; ctrl = DPOT_AD5273_FUSE; } return dpot_write_r8d8(dpot, ctrl, value); break; case DPOT_UID(AD5172_ID): case DPOT_UID(AD5173_ID): ctrl = ((reg & DPOT_RDAC_MASK) == DPOT_RDAC0) ? 0 : DPOT_AD5172_3_A0; if (reg & DPOT_ADDR_OTP) { tmp = dpot_read_r8d16(dpot, ctrl); if (tmp >> 14) /* Ready to Program? */ return -EFAULT; ctrl |= DPOT_AD5170_2_3_FUSE; } return dpot_write_r8d8(dpot, ctrl, value); break; case DPOT_UID(AD5170_ID): if (reg & DPOT_ADDR_OTP) { tmp = dpot_read_r8d16(dpot, tmp); if (tmp >> 14) /* Ready to Program? */ return -EFAULT; ctrl = DPOT_AD5170_2_3_FUSE; } return dpot_write_r8d8(dpot, ctrl, value); break; case DPOT_UID(AD5272_ID): case DPOT_UID(AD5274_ID): dpot_write_r8d8(dpot, DPOT_AD5270_1_2_4_CTRLREG << 2, DPOT_AD5270_1_2_4_UNLOCK_CMD); if (reg & DPOT_ADDR_OTP) return dpot_write_r8d8(dpot, DPOT_AD5270_1_2_4_STORE_XTPM << 2, 0); if (dpot->uid == DPOT_UID(AD5274_ID)) value = value << 2; return dpot_write_r8d8(dpot, (DPOT_AD5270_1_2_4_RDAC << 2) | (value >> 8), value & 0xFF); break; default: if (reg & DPOT_ADDR_CMD) return dpot_write_d8(dpot, reg); if (dpot->max_pos > 256) return dpot_write_r8d16(dpot, (reg & 0xF8) | ((reg & 0x7) << 1), value); else /* All other registers require instruction + data bytes */ return dpot_write_r8d8(dpot, reg, value); } } static s32 dpot_write(struct dpot_data *dpot, u8 reg, u16 value) { if (dpot->feat & F_SPI) return dpot_write_spi(dpot, reg, value); else return dpot_write_i2c(dpot, reg, value); } /* sysfs functions */ static ssize_t sysfs_show_reg(struct device *dev, struct device_attribute *attr, char *buf, u32 reg) { struct dpot_data *data = dev_get_drvdata(dev); s32 value; if (reg & DPOT_ADDR_OTP_EN) return sprintf(buf, "%s\n", test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask) ? "enabled" : "disabled"); mutex_lock(&data->update_lock); value = dpot_read(data, reg); mutex_unlock(&data->update_lock); if (value < 0) return -EINVAL; /* * Let someone else deal with converting this ... * the tolerance is a two-byte value where the MSB * is a sign + integer value, and the LSB is a * decimal value. See page 18 of the AD5258 * datasheet (Rev. A) for more details. */ if (reg & DPOT_REG_TOL) return sprintf(buf, "0x%04x\n", value & 0xFFFF); else return sprintf(buf, "%u\n", value & data->rdac_mask); } static ssize_t sysfs_set_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count, u32 reg) { struct dpot_data *data = dev_get_drvdata(dev); unsigned long value; int err; if (reg & DPOT_ADDR_OTP_EN) { if (!strncmp(buf, "enabled", sizeof("enabled"))) set_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask); else clear_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask); return count; } if ((reg & DPOT_ADDR_OTP) && !test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask)) return -EPERM; err = strict_strtoul(buf, 10, &value); if (err) return err; if (value > data->rdac_mask) value = data->rdac_mask; mutex_lock(&data->update_lock); dpot_write(data, reg, value); if (reg & DPOT_ADDR_EEPROM) msleep(26); /* Sleep while the EEPROM updates */ else if (reg & DPOT_ADDR_OTP) msleep(400); /* Sleep while the OTP updates */ mutex_unlock(&data->update_lock); return count; } static ssize_t sysfs_do_cmd(struct device *dev, struct device_attribute *attr, const char *buf, size_t count, u32 reg) { struct dpot_data *data = dev_get_drvdata(dev); mutex_lock(&data->update_lock); dpot_write(data, reg, 0); mutex_unlock(&data->update_lock); return count; } /* ------------------------------------------------------------------------- */ #define DPOT_DEVICE_SHOW(_name, _reg) static ssize_t \ show_##_name(struct device *dev, \ struct device_attribute *attr, char *buf) \ { \ return sysfs_show_reg(dev, attr, buf, _reg); \ } #define DPOT_DEVICE_SET(_name, _reg) static ssize_t \ set_##_name(struct device *dev, \ struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return sysfs_set_reg(dev, attr, buf, count, _reg); \ } #define DPOT_DEVICE_SHOW_SET(name, reg) \ DPOT_DEVICE_SHOW(name, reg) \ DPOT_DEVICE_SET(name, reg) \ static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, show_##name, set_##name); #define DPOT_DEVICE_SHOW_ONLY(name, reg) \ DPOT_DEVICE_SHOW(name, reg) \ static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, show_##name, NULL); DPOT_DEVICE_SHOW_SET(rdac0, DPOT_ADDR_RDAC | DPOT_RDAC0); DPOT_DEVICE_SHOW_SET(eeprom0, DPOT_ADDR_EEPROM | DPOT_RDAC0); DPOT_DEVICE_SHOW_ONLY(tolerance0, DPOT_ADDR_EEPROM | DPOT_TOL_RDAC0); DPOT_DEVICE_SHOW_SET(otp0, DPOT_ADDR_OTP | DPOT_RDAC0); DPOT_DEVICE_SHOW_SET(otp0en, DPOT_ADDR_OTP_EN | DPOT_RDAC0); DPOT_DEVICE_SHOW_SET(rdac1, DPOT_ADDR_RDAC | DPOT_RDAC1); DPOT_DEVICE_SHOW_SET(eeprom1, DPOT_ADDR_EEPROM | DPOT_RDAC1); DPOT_DEVICE_SHOW_ONLY(tolerance1, DPOT_ADDR_EEPROM | DPOT_TOL_RDAC1); DPOT_DEVICE_SHOW_SET(otp1, DPOT_ADDR_OTP | DPOT_RDAC1); DPOT_DEVICE_SHOW_SET(otp1en, DPOT_ADDR_OTP_EN | DPOT_RDAC1); DPOT_DEVICE_SHOW_SET(rdac2, DPOT_ADDR_RDAC | DPOT_RDAC2); DPOT_DEVICE_SHOW_SET(eeprom2, DPOT_ADDR_EEPROM | DPOT_RDAC2); DPOT_DEVICE_SHOW_ONLY(tolerance2, DPOT_ADDR_EEPROM | DPOT_TOL_RDAC2); DPOT_DEVICE_SHOW_SET(otp2, DPOT_ADDR_OTP | DPOT_RDAC2); DPOT_DEVICE_SHOW_SET(otp2en, DPOT_ADDR_OTP_EN | DPOT_RDAC2); DPOT_DEVICE_SHOW_SET(rdac3, DPOT_ADDR_RDAC | DPOT_RDAC3); DPOT_DEVICE_SHOW_SET(eeprom3, DPOT_ADDR_EEPROM | DPOT_RDAC3); DPOT_DEVICE_SHOW_ONLY(tolerance3, DPOT_ADDR_EEPROM | DPOT_TOL_RDAC3); DPOT_DEVICE_SHOW_SET(otp3, DPOT_ADDR_OTP | DPOT_RDAC3); DPOT_DEVICE_SHOW_SET(otp3en, DPOT_ADDR_OTP_EN | DPOT_RDAC3); DPOT_DEVICE_SHOW_SET(rdac4, DPOT_ADDR_RDAC | DPOT_RDAC4); DPOT_DEVICE_SHOW_SET(eeprom4, DPOT_ADDR_EEPROM | DPOT_RDAC4); DPOT_DEVICE_SHOW_ONLY(tolerance4, DPOT_ADDR_EEPROM | DPOT_TOL_RDAC4); DPOT_DEVICE_SHOW_SET(otp4, DPOT_ADDR_OTP | DPOT_RDAC4); DPOT_DEVICE_SHOW_SET(otp4en, DPOT_ADDR_OTP_EN | DPOT_RDAC4); DPOT_DEVICE_SHOW_SET(rdac5, DPOT_ADDR_RDAC | DPOT_RDAC5); DPOT_DEVICE_SHOW_SET(eeprom5, DPOT_ADDR_EEPROM | DPOT_RDAC5); DPOT_DEVICE_SHOW_ONLY(tolerance5, DPOT_ADDR_EEPROM | DPOT_TOL_RDAC5); DPOT_DEVICE_SHOW_SET(otp5, DPOT_ADDR_OTP | DPOT_RDAC5); DPOT_DEVICE_SHOW_SET(otp5en, DPOT_ADDR_OTP_EN | DPOT_RDAC5); static const struct attribute *dpot_attrib_wipers[] = { &dev_attr_rdac0.attr, &dev_attr_rdac1.attr, &dev_attr_rdac2.attr, &dev_attr_rdac3.attr, &dev_attr_rdac4.attr, &dev_attr_rdac5.attr, NULL }; static const struct attribute *dpot_attrib_eeprom[] = { &dev_attr_eeprom0.attr, &dev_attr_eeprom1.attr, &dev_attr_eeprom2.attr, &dev_attr_eeprom3.attr, &dev_attr_eeprom4.attr, &dev_attr_eeprom5.attr, NULL }; static const struct attribute *dpot_attrib_otp[] = { &dev_attr_otp0.attr, &dev_attr_otp1.attr, &dev_attr_otp2.attr, &dev_attr_otp3.attr, &dev_attr_otp4.attr, &dev_attr_otp5.attr, NULL }; static const struct attribute *dpot_attrib_otp_en[] = { &dev_attr_otp0en.attr, &dev_attr_otp1en.attr, &dev_attr_otp2en.attr, &dev_attr_otp3en.attr, &dev_attr_otp4en.attr, &dev_attr_otp5en.attr, NULL }; static const struct attribute *dpot_attrib_tolerance[] = { &dev_attr_tolerance0.attr, &dev_attr_tolerance1.attr, &dev_attr_tolerance2.attr, &dev_attr_tolerance3.attr, &dev_attr_tolerance4.attr, &dev_attr_tolerance5.attr, NULL }; /* ------------------------------------------------------------------------- */ #define DPOT_DEVICE_DO_CMD(_name, _cmd) static ssize_t \ set_##_name(struct device *dev, \ struct device_attribute *attr, \ const char *buf, size_t count) \ { \ return sysfs_do_cmd(dev, attr, buf, count, _cmd); \ } \ static DEVICE_ATTR(_name, S_IWUSR | S_IRUGO, NULL, set_##_name); DPOT_DEVICE_DO_CMD(inc_all, DPOT_INC_ALL); DPOT_DEVICE_DO_CMD(dec_all, DPOT_DEC_ALL); DPOT_DEVICE_DO_CMD(inc_all_6db, DPOT_INC_ALL_6DB); DPOT_DEVICE_DO_CMD(dec_all_6db, DPOT_DEC_ALL_6DB); static struct attribute *ad525x_attributes_commands[] = { &dev_attr_inc_all.attr, &dev_attr_dec_all.attr, &dev_attr_inc_all_6db.attr, &dev_attr_dec_all_6db.attr, NULL }; static const struct attribute_group ad525x_group_commands = { .attrs = ad525x_attributes_commands, }; __devinit int ad_dpot_add_files(struct device *dev, unsigned features, unsigned rdac) { int err = sysfs_create_file(&dev->kobj, dpot_attrib_wipers[rdac]); if (features & F_CMD_EEP) err |= sysfs_create_file(&dev->kobj, dpot_attrib_eeprom[rdac]); if (features & F_CMD_TOL) err |= sysfs_create_file(&dev->kobj, dpot_attrib_tolerance[rdac]); if (features & F_CMD_OTP) { err |= sysfs_create_file(&dev->kobj, dpot_attrib_otp_en[rdac]); err |= sysfs_create_file(&dev->kobj, dpot_attrib_otp[rdac]); } if (err) dev_err(dev, "failed to register sysfs hooks for RDAC%d\n", rdac); return err; } inline void ad_dpot_remove_files(struct device *dev, unsigned features, unsigned rdac) { sysfs_remove_file(&dev->kobj, dpot_attrib_wipers[rdac]); if (features & F_CMD_EEP) sysfs_remove_file(&dev->kobj, dpot_attrib_eeprom[rdac]); if (features & F_CMD_TOL) sysfs_remove_file(&dev->kobj, dpot_attrib_tolerance[rdac]); if (features & F_CMD_OTP) { sysfs_remove_file(&dev->kobj, dpot_attrib_otp_en[rdac]); sysfs_remove_file(&dev->kobj, dpot_attrib_otp[rdac]); } } int __devinit ad_dpot_probe(struct device *dev, struct ad_dpot_bus_data *bdata, unsigned long devid, const char *name) { struct dpot_data *data; int i, err = 0; data = kzalloc(sizeof(struct dpot_data), GFP_KERNEL); if (!data) { err = -ENOMEM; goto exit; } dev_set_drvdata(dev, data); mutex_init(&data->update_lock); data->bdata = *bdata; data->devid = devid; data->max_pos = 1 << DPOT_MAX_POS(devid); data->rdac_mask = data->max_pos - 1; data->feat = DPOT_FEAT(devid); data->uid = DPOT_UID(devid); data->wipers = DPOT_WIPERS(devid); for (i = DPOT_RDAC0; i < MAX_RDACS; i++) if (data->wipers & (1 << i)) { err = ad_dpot_add_files(dev, data->feat, i); if (err) goto exit_remove_files; /* power-up midscale */ if (data->feat & F_RDACS_WONLY) data->rdac_cache[i] = data->max_pos / 2; } if (data->feat & F_CMD_INC) err = sysfs_create_group(&dev->kobj, &ad525x_group_commands); if (err) { dev_err(dev, "failed to register sysfs hooks\n"); goto exit_free; } dev_info(dev, "%s %d-Position Digital Potentiometer registered\n", name, data->max_pos); return 0; exit_remove_files: for (i = DPOT_RDAC0; i < MAX_RDACS; i++) if (data->wipers & (1 << i)) ad_dpot_remove_files(dev, data->feat, i); exit_free: kfree(data); dev_set_drvdata(dev, NULL); exit: dev_err(dev, "failed to create client for %s ID 0x%lX\n", name, devid); return err; } EXPORT_SYMBOL(ad_dpot_probe); __devexit int ad_dpot_remove(struct device *dev) { struct dpot_data *data = dev_get_drvdata(dev); int i; for (i = DPOT_RDAC0; i < MAX_RDACS; i++) if (data->wipers & (1 << i)) ad_dpot_remove_files(dev, data->feat, i); kfree(data); return 0; } EXPORT_SYMBOL(ad_dpot_remove); MODULE_AUTHOR("Chris Verges <[email protected]>, " "Michael Hennerich <[email protected]>"); MODULE_DESCRIPTION("Digital potentiometer driver"); MODULE_LICENSE("GPL");
talnoah/android_kernel_htc_dlx
virt/drivers/misc/ad525x_dpot.c
C
gpl-2.0
20,710
# encoding: utf-8 require 'helper' class TestFakerIdentificationES < Test::Unit::TestCase def setup @tester = Faker::IdentificationES end def test_gender assert_match /(Hombre|Mujer)/, @tester.gender end end
matthewlehner/ffaker
test/test_identification_es.rb
Ruby
mit
227
/** * Select2 Hungarian translation */ (function ($) { "use strict"; $.extend($.fn.select2.defaults, { formatNoMatches: function () { return "Nincs találat."; }, formatInputTooShort: function (input, min) { var n = min - input.length; return "Túl rövid. Még " + n + " karakter hiányzik."; }, formatInputTooLong: function (input, max) { var n = input.length - max; return "Túl hosszú. " + n + " kerekterrel több mint kellene."; }, formatSelectionTooBig: function (limit) { return "Csak " + limit + " elemet lehet kiválasztani."; }, formatLoadMore: function (pageNumber) { return "Töltés…"; }, formatSearching: function () { return "Keresés…"; } }); })(jQuery);
pkapollo/phongkhamapollo.com
wlm-apollo/js/select2/select2_locale_hu.js
JavaScript
mit
739
/* * Copyright (C) 1995, 1996, 2001 Ralf Baechle * Copyright (C) 2001, 2004 MIPS Technologies, Inc. * Copyright (C) 2004 Maciej W. Rozycki */ #include <linux/delay.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/seq_file.h> #include <asm/bootinfo.h> #include <asm/cpu.h> #include <asm/cpu-features.h> #include <asm/mipsregs.h> #include <asm/processor.h> #include <asm/mips_machine.h> unsigned int vced_count, vcei_count; static int show_cpuinfo(struct seq_file *m, void *v) { unsigned long n = (unsigned long) v - 1; unsigned int version = cpu_data[n].processor_id; unsigned int fp_vers = cpu_data[n].fpu_id; char fmt [64]; int i; #ifdef CONFIG_SMP if (!cpu_online(n)) return 0; #endif if (n == 0) { seq_printf(m, "system type\t\t: %s\n", get_system_type()); if (mips_get_machine_name()) seq_printf(m, "machine\t\t\t: %s\n", mips_get_machine_name()); } seq_printf(m, "processor\t\t: %ld\n", n); sprintf(fmt, "cpu model\t\t: %%s V%%d.%%d%s\n", cpu_data[n].options & MIPS_CPU_FPU ? " FPU V%d.%d" : ""); seq_printf(m, fmt, __cpu_name[n], (version >> 4) & 0x0f, version & 0x0f, (fp_vers >> 4) & 0x0f, fp_vers & 0x0f); seq_printf(m, "BogoMIPS\t\t: %u.%02u\n", cpu_data[n].udelay_val / (500000/HZ), (cpu_data[n].udelay_val / (5000/HZ)) % 100); seq_printf(m, "wait instruction\t: %s\n", cpu_wait ? "yes" : "no"); seq_printf(m, "microsecond timers\t: %s\n", cpu_has_counter ? "yes" : "no"); seq_printf(m, "tlb_entries\t\t: %d\n", cpu_data[n].tlbsize); seq_printf(m, "extra interrupt vector\t: %s\n", cpu_has_divec ? "yes" : "no"); seq_printf(m, "hardware watchpoint\t: %s", cpu_has_watch ? "yes, " : "no\n"); if (cpu_has_watch) { seq_printf(m, "count: %d, address/irw mask: [", cpu_data[n].watch_reg_count); for (i = 0; i < cpu_data[n].watch_reg_count; i++) seq_printf(m, "%s0x%04x", i ? ", " : "" , cpu_data[n].watch_reg_masks[i]); seq_printf(m, "]\n"); } seq_printf(m, "ASEs implemented\t:%s%s%s%s%s%s\n", cpu_has_mips16 ? " mips16" : "", cpu_has_mdmx ? " mdmx" : "", cpu_has_mips3d ? " mips3d" : "", cpu_has_smartmips ? " smartmips" : "", cpu_has_dsp ? " dsp" : "", cpu_has_mipsmt ? " mt" : "" ); seq_printf(m, "shadow register sets\t: %d\n", cpu_data[n].srsets); seq_printf(m, "kscratch registers\t: %d\n", hweight8(cpu_data[n].kscratch_mask)); seq_printf(m, "core\t\t\t: %d\n", cpu_data[n].core); sprintf(fmt, "VCE%%c exceptions\t\t: %s\n", cpu_has_vce ? "%u" : "not available"); seq_printf(m, fmt, 'D', vced_count); seq_printf(m, fmt, 'I', vcei_count); seq_printf(m, "\n"); return 0; } static void *c_start(struct seq_file *m, loff_t *pos) { unsigned long i = *pos; return i < NR_CPUS ? (void *) (i + 1) : NULL; } static void *c_next(struct seq_file *m, void *v, loff_t *pos) { ++*pos; return c_start(m, pos); } static void c_stop(struct seq_file *m, void *v) { } const struct seq_operations cpuinfo_op = { .start = c_start, .next = c_next, .stop = c_stop, .show = show_cpuinfo, };
jameshilliard/m8-3.4.0-gb1fa77f
arch/mips/kernel/proc.c
C
gpl-2.0
3,202
<!-- @file Project Page --> # Bootstrap > Sleek, intuitive, and powerful mobile first front-end framework for faster and > easier web development. Bootstrap has become one of the most popular front-end > frameworks and open source projects in the world. This base theme bridges the gap between Drupal and the [Bootstrap Framework]. ### Features - [jsDelivr CDN](https://www.jsdelivr.com) for "out-of-the-box" styling and faster page load times. - [Bootswatch](http://bootswatch.com) theme support, if using the CDN. - Glyphicons support via [Icon API](https://www.drupal.org/project/icon). - Extensive integration and template/preprocessor overrides for most of the [Bootstrap Framework] CSS, Components and JavaScript - Theme settings to further enhance the Drupal Bootstrap integration: - [Breadcrumbs](https://getbootstrap.com/docs/3.4/components/#breadcrumbs) - [Navbar](https://getbootstrap.com/docs/3.4/components/#navbar) - [Popovers](https://getbootstrap.com/docs/3.4/javascript/#popovers) - [Tooltips](https://getbootstrap.com/docs/3.4/javascript/#tooltips) - [Wells](https://getbootstrap.com/docs/3.4/components/#wells) (per region) ### Documentation Visit the project's [official documentation site](https://drupal-bootstrap.org) or the markdown files inside the `./docs` folder. [Bootstrap Framework]: https://getbootstrap.com/docs/3.4/
elteb/xarxanet
sites/nonprofit.xarxanet.org/themes/bootstrap/README.md
Markdown
gpl-2.0
1,368
<?php if (!function_exists('getCarouselSliderArray')){ function getCarouselSliderArray() { $carousel_output = array("" => ""); $terms = get_terms('carousels_category'); $count = count($terms); if ( $count > 0 ): foreach ( $terms as $term ): $carousel_output[$term->name] = $term->slug; endforeach; endif; return $carousel_output; } } add_action('init', 'getCarouselSliderArray',1); ?>
comc49/a2f_bridge_theme
wp-content/themes_bak/bridge/includes/qode_carousel/qode-carousel.php
PHP
gpl-2.0
440
#ifndef _ASM_SCORE_BITOPS_H #define _ASM_SCORE_BITOPS_H #include <asm/byteorder.h> #define smp_mb__before_clear_bit() barrier() #define smp_mb__after_clear_bit() barrier() #include <asm-generic/bitops.h> #include <asm-generic/bitops/__fls.h> #endif
jameshilliard/m8-3.4.0-gb1fa77f
arch/score/include/asm/bitops.h
C
gpl-2.0
255
/* * arch/arm/mach-mv78xx0/addr-map.c * * Address map functions for Marvell MV78xx0 SoCs * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any * warranty of any kind, whether express or implied. */ #include <linux/kernel.h> #include <linux/init.h> #include <linux/mbus.h> #include <linux/io.h> #include <plat/addr-map.h> #include "common.h" #define TARGET_DEV_BUS 1 #define TARGET_PCIE0 4 #define TARGET_PCIE1 8 #define TARGET_PCIE(i) ((i) ? TARGET_PCIE1 : TARGET_PCIE0) #define ATTR_DEV_SPI_ROM 0x1f #define ATTR_DEV_BOOT 0x2f #define ATTR_DEV_CS3 0x37 #define ATTR_DEV_CS2 0x3b #define ATTR_DEV_CS1 0x3d #define ATTR_DEV_CS0 0x3e #define ATTR_PCIE_IO(l) (0xf0 & ~(0x10 << (l))) #define ATTR_PCIE_MEM(l) (0xf8 & ~(0x10 << (l))) #define WIN0_OFF(n) (BRIDGE_VIRT_BASE + 0x0000 + ((n) << 4)) #define WIN8_OFF(n) (BRIDGE_VIRT_BASE + 0x0900 + (((n) - 8) << 4)) static void __init __iomem *win_cfg_base(int win) { return (void __iomem *)((win < 8) ? WIN0_OFF(win) : WIN8_OFF(win)); } static struct __initdata orion_addr_map_cfg addr_map_cfg = { .num_wins = 14, .remappable_wins = 8, .win_cfg_base = win_cfg_base, }; void __init mv78xx0_setup_cpu_mbus(void) { orion_config_wins(&addr_map_cfg, NULL); if (mv78xx0_core_index() == 0) orion_setup_cpu_mbus_target(&addr_map_cfg, DDR_WINDOW_CPU0_BASE); else orion_setup_cpu_mbus_target(&addr_map_cfg, DDR_WINDOW_CPU1_BASE); } void __init mv78xx0_setup_pcie_io_win(int window, u32 base, u32 size, int maj, int min) { orion_setup_cpu_win(&addr_map_cfg, window, base, size, TARGET_PCIE(maj), ATTR_PCIE_IO(min), -1); } void __init mv78xx0_setup_pcie_mem_win(int window, u32 base, u32 size, int maj, int min) { orion_setup_cpu_win(&addr_map_cfg, window, base, size, TARGET_PCIE(maj), ATTR_PCIE_MEM(min), -1); }
jameshilliard/m8-3.4.0-gb1fa77f
arch/arm/mach-mv78xx0/addr-map.c
C
gpl-2.0
1,921
#include <linux/types.h> #include <linux/init.h> #include <linux/delay.h> #include <linux/slab.h> #include <linux/console.h> #include <asm/hvsi.h> #include "hvc_console.h" static int hvsi_send_packet(struct hvsi_priv *pv, struct hvsi_header *packet) { packet->seqno = atomic_inc_return(&pv->seqno); return pv->put_chars(pv->termno, (char *)packet, packet->len); } static void hvsi_start_handshake(struct hvsi_priv *pv) { struct hvsi_query q; pv->established = 0; atomic_set(&pv->seqno, 0); pr_devel("HVSI@%x: Handshaking started\n", pv->termno); q.hdr.type = VS_QUERY_PACKET_HEADER; q.hdr.len = sizeof(struct hvsi_query); q.verb = VSV_SEND_VERSION_NUMBER; hvsi_send_packet(pv, &q.hdr); } static int hvsi_send_close(struct hvsi_priv *pv) { struct hvsi_control ctrl; pv->established = 0; ctrl.hdr.type = VS_CONTROL_PACKET_HEADER; ctrl.hdr.len = sizeof(struct hvsi_control); ctrl.verb = VSV_CLOSE_PROTOCOL; return hvsi_send_packet(pv, &ctrl.hdr); } static void hvsi_cd_change(struct hvsi_priv *pv, int cd) { if (cd) pv->mctrl |= TIOCM_CD; else { pv->mctrl &= ~TIOCM_CD; if (!pv->is_console && pv->opened) { pr_devel("HVSI@%x Carrier lost, hanging up !\n", pv->termno); hvsi_send_close(pv); } } } static void hvsi_got_control(struct hvsi_priv *pv) { struct hvsi_control *pkt = (struct hvsi_control *)pv->inbuf; switch (pkt->verb) { case VSV_CLOSE_PROTOCOL: hvsi_start_handshake(pv); break; case VSV_MODEM_CTL_UPDATE: hvsi_cd_change(pv, pkt->word & HVSI_TSCD); break; } } static void hvsi_got_query(struct hvsi_priv *pv) { struct hvsi_query *pkt = (struct hvsi_query *)pv->inbuf; struct hvsi_query_response r; if (pkt->verb != VSV_SEND_VERSION_NUMBER) return; pr_devel("HVSI@%x: Got version query, sending response...\n", pv->termno); r.hdr.type = VS_QUERY_RESPONSE_PACKET_HEADER; r.hdr.len = sizeof(struct hvsi_query_response); r.verb = VSV_SEND_VERSION_NUMBER; r.u.version = HVSI_VERSION; r.query_seqno = pkt->hdr.seqno; hvsi_send_packet(pv, &r.hdr); pv->established = 1; } static void hvsi_got_response(struct hvsi_priv *pv) { struct hvsi_query_response *r = (struct hvsi_query_response *)pv->inbuf; switch(r->verb) { case VSV_SEND_MODEM_CTL_STATUS: hvsi_cd_change(pv, r->u.mctrl_word & HVSI_TSCD); pv->mctrl_update = 1; break; } } static int hvsi_check_packet(struct hvsi_priv *pv) { u8 len, type; if (pv->inbuf[0] < 0xfc) { pv->inbuf_len = pv->inbuf_pktlen = 0; return 0; } type = pv->inbuf[0]; len = pv->inbuf[1]; if (pv->inbuf_len < len) return 0; pr_devel("HVSI@%x: Got packet type %x len %d bytes:\n", pv->termno, type, len); switch(type) { case VS_DATA_PACKET_HEADER: pv->inbuf_pktlen = len - 4; pv->inbuf_cur = 4; return 1; case VS_CONTROL_PACKET_HEADER: hvsi_got_control(pv); break; case VS_QUERY_PACKET_HEADER: hvsi_got_query(pv); break; case VS_QUERY_RESPONSE_PACKET_HEADER: hvsi_got_response(pv); break; } pv->inbuf_len -= len; memmove(pv->inbuf, &pv->inbuf[len], pv->inbuf_len); return 1; } static int hvsi_get_packet(struct hvsi_priv *pv) { if (pv->inbuf_len < HVSI_INBUF_SIZE) pv->inbuf_len += pv->get_chars(pv->termno, &pv->inbuf[pv->inbuf_len], HVSI_INBUF_SIZE - pv->inbuf_len); if (pv->inbuf_len >= 4) return hvsi_check_packet(pv); return 0; } int hvsilib_get_chars(struct hvsi_priv *pv, char *buf, int count) { unsigned int tries, read = 0; if (WARN_ON(!pv)) return -ENXIO; if (!pv->opened) return 0; for (tries = 1; count && tries < 2; tries++) { if (pv->inbuf_pktlen) { unsigned int l = min(count, (int)pv->inbuf_pktlen); memcpy(&buf[read], &pv->inbuf[pv->inbuf_cur], l); pv->inbuf_cur += l; pv->inbuf_pktlen -= l; count -= l; read += l; } if (count == 0) break; if (pv->inbuf_cur) { pv->inbuf_len -= pv->inbuf_cur; memmove(pv->inbuf, &pv->inbuf[pv->inbuf_cur], pv->inbuf_len); pv->inbuf_cur = 0; } if (hvsi_get_packet(pv)) tries--; } if (!pv->established) { pr_devel("HVSI@%x: returning -EPIPE\n", pv->termno); return -EPIPE; } return read; } int hvsilib_put_chars(struct hvsi_priv *pv, const char *buf, int count) { struct hvsi_data dp; int rc, adjcount = min(count, HVSI_MAX_OUTGOING_DATA); if (WARN_ON(!pv)) return -ENODEV; dp.hdr.type = VS_DATA_PACKET_HEADER; dp.hdr.len = adjcount + sizeof(struct hvsi_header); memcpy(dp.data, buf, adjcount); rc = hvsi_send_packet(pv, &dp.hdr); if (rc <= 0) return rc; return adjcount; } static void maybe_msleep(unsigned long ms) { if (irqs_disabled()) mdelay(ms); else msleep(ms); } int hvsilib_read_mctrl(struct hvsi_priv *pv) { struct hvsi_query q; int rc, timeout; pr_devel("HVSI@%x: Querying modem control status...\n", pv->termno); pv->mctrl_update = 0; q.hdr.type = VS_QUERY_PACKET_HEADER; q.hdr.len = sizeof(struct hvsi_query); q.hdr.seqno = atomic_inc_return(&pv->seqno); q.verb = VSV_SEND_MODEM_CTL_STATUS; rc = hvsi_send_packet(pv, &q.hdr); if (rc <= 0) { pr_devel("HVSI@%x: Error %d...\n", pv->termno, rc); return rc; } for (timeout = 0; timeout < 20; timeout++) { if (!pv->established) return -ENXIO; if (pv->mctrl_update) return 0; if (!hvsi_get_packet(pv)) maybe_msleep(10); } return -EIO; } int hvsilib_write_mctrl(struct hvsi_priv *pv, int dtr) { struct hvsi_control ctrl; unsigned short mctrl; mctrl = pv->mctrl; if (dtr) mctrl |= TIOCM_DTR; else mctrl &= ~TIOCM_DTR; if (mctrl == pv->mctrl) return 0; pv->mctrl = mctrl; pr_devel("HVSI@%x: %s DTR...\n", pv->termno, dtr ? "Setting" : "Clearing"); ctrl.hdr.type = VS_CONTROL_PACKET_HEADER, ctrl.hdr.len = sizeof(struct hvsi_control); ctrl.verb = VSV_SET_MODEM_CTL; ctrl.mask = HVSI_TSDTR; ctrl.word = dtr ? HVSI_TSDTR : 0; return hvsi_send_packet(pv, &ctrl.hdr); } void hvsilib_establish(struct hvsi_priv *pv) { int timeout; pr_devel("HVSI@%x: Establishing...\n", pv->termno); for (timeout = 0; timeout < 20; timeout++) { if (pv->established) goto established; if (!hvsi_get_packet(pv)) maybe_msleep(10); } pr_devel("HVSI@%x: ... sending close\n", pv->termno); hvsi_send_close(pv); pr_devel("HVSI@%x: ... restarting handshake\n", pv->termno); hvsi_start_handshake(pv); pr_devel("HVSI@%x: ... waiting handshake\n", pv->termno); for (timeout = 0; timeout < 20; timeout++) { if (pv->established) goto established; if (!hvsi_get_packet(pv)) maybe_msleep(10); } if (!pv->established) { pr_devel("HVSI@%x: Timeout handshaking, giving up !\n", pv->termno); return; } established: pr_devel("HVSI@%x: ... established, reading mctrl\n", pv->termno); hvsilib_read_mctrl(pv); pr_devel("HVSI@%x: ... setting mctrl\n", pv->termno); hvsilib_write_mctrl(pv, 1); wmb(); pv->opened = 1; } int hvsilib_open(struct hvsi_priv *pv, struct hvc_struct *hp) { pr_devel("HVSI@%x: open !\n", pv->termno); pv->tty = tty_kref_get(hp->tty); hvsilib_establish(pv); return 0; } void hvsilib_close(struct hvsi_priv *pv, struct hvc_struct *hp) { unsigned long flags; pr_devel("HVSI@%x: close !\n", pv->termno); if (!pv->is_console) { pr_devel("HVSI@%x: Not a console, tearing down\n", pv->termno); spin_lock_irqsave(&hp->lock, flags); pv->opened = 0; spin_unlock_irqrestore(&hp->lock, flags); if (!pv->tty || (pv->tty->termios->c_cflag & HUPCL)) hvsilib_write_mctrl(pv, 0); hvsi_send_close(pv); } if (pv->tty) tty_kref_put(pv->tty); pv->tty = NULL; } void hvsilib_init(struct hvsi_priv *pv, int (*get_chars)(uint32_t termno, char *buf, int count), int (*put_chars)(uint32_t termno, const char *buf, int count), int termno, int is_console) { memset(pv, 0, sizeof(*pv)); pv->get_chars = get_chars; pv->put_chars = put_chars; pv->termno = termno; pv->is_console = is_console; }
jameshilliard/m8-3.4.0-gb1fa77f
drivers/tty/hvc/hvsi_lib.c
C
gpl-2.0
7,908
/* * linux/arch/unicore32/kernel/gpio.c * * Code specific to PKUnity SoC and UniCore ISA * * Maintained by GUAN Xue-tao <[email protected]> * Copyright (C) 2001-2010 Guan Xuetao * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/init.h> #include <linux/module.h> #include <linux/gpio.h> #include <mach/hardware.h> #ifdef CONFIG_LEDS #include <linux/leds.h> #include <linux/platform_device.h> static const struct gpio_led puv3_gpio_leds[] = { { .name = "cpuhealth", .gpio = GPO_CPU_HEALTH, .active_low = 0, .default_trigger = "heartbeat", }, { .name = "hdd_led", .gpio = GPO_HDD_LED, .active_low = 1, .default_trigger = "ide-disk", }, }; static const struct gpio_led_platform_data puv3_gpio_led_data = { .num_leds = ARRAY_SIZE(puv3_gpio_leds), .leds = (void *) puv3_gpio_leds, }; static struct platform_device puv3_gpio_gpio_leds = { .name = "leds-gpio", .id = -1, .dev = { .platform_data = (void *) &puv3_gpio_led_data, } }; static int __init puv3_gpio_leds_init(void) { platform_device_register(&puv3_gpio_gpio_leds); return 0; } device_initcall(puv3_gpio_leds_init); #endif static int puv3_gpio_get(struct gpio_chip *chip, unsigned offset) { return readl(GPIO_GPLR) & GPIO_GPIO(offset); } static void puv3_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { if (value) writel(GPIO_GPIO(offset), GPIO_GPSR); else writel(GPIO_GPIO(offset), GPIO_GPCR); } static int puv3_direction_input(struct gpio_chip *chip, unsigned offset) { unsigned long flags; local_irq_save(flags); writel(readl(GPIO_GPDR) & ~GPIO_GPIO(offset), GPIO_GPDR); local_irq_restore(flags); return 0; } static int puv3_direction_output(struct gpio_chip *chip, unsigned offset, int value) { unsigned long flags; local_irq_save(flags); puv3_gpio_set(chip, offset, value); writel(readl(GPIO_GPDR) | GPIO_GPIO(offset), GPIO_GPDR); local_irq_restore(flags); return 0; } static struct gpio_chip puv3_gpio_chip = { .label = "gpio", .direction_input = puv3_direction_input, .direction_output = puv3_direction_output, .set = puv3_gpio_set, .get = puv3_gpio_get, .base = 0, .ngpio = GPIO_MAX + 1, }; void __init puv3_init_gpio(void) { writel(GPIO_DIR, GPIO_GPDR); #if defined(CONFIG_PUV3_NB0916) || defined(CONFIG_PUV3_SMW0919) \ || defined(CONFIG_PUV3_DB0913) gpio_set_value(GPO_WIFI_EN, 1); gpio_set_value(GPO_HDD_LED, 1); gpio_set_value(GPO_VGA_EN, 1); gpio_set_value(GPO_LCD_EN, 1); gpio_set_value(GPO_CAM_PWR_EN, 0); gpio_set_value(GPO_LCD_VCC_EN, 1); gpio_set_value(GPO_SOFT_OFF, 1); gpio_set_value(GPO_BT_EN, 1); gpio_set_value(GPO_FAN_ON, 0); gpio_set_value(GPO_SPKR, 0); gpio_set_value(GPO_CPU_HEALTH, 1); gpio_set_value(GPO_LAN_SEL, 1); #endif gpiochip_add(&puv3_gpio_chip); }
jameshilliard/m8-3.4.0-gb1fa77f
arch/unicore32/kernel/gpio.c
C
gpl-2.0
2,907
/* Verify that simple virtual calls are inlined even without early inlining. */ /* { dg-do run } */ /* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp" } */ extern "C" void abort (void); class A { public: int data; virtual int foo (int i); }; class B : public A { public: virtual int foo (int i); }; class C : public A { public: virtual int foo (int i); }; int A::foo (int i) { return i + 1; } int B::foo (int i) { return i + 2; } int C::foo (int i) { return i + 3; } int middleman (class A *obj, int i) { return obj->foo (i); } int __attribute__ ((noinline,noclone)) get_input(void) { return 1; } int main (int argc, char *argv[]) { class B b; int i; for (i = 0; i < get_input (); i++) if (middleman (&b, get_input ()) != 3) abort (); return 0; } /* { dg-final { scan-ipa-dump "B::foo\[^\\n\]*inline copy in int main" "inline" } } */ /* { dg-final { cleanup-ipa-dump "inline" } } */
SanDisk-Open-Source/SSD_Dashboard
uefi/gcc/gcc-4.6.3/gcc/testsuite/g++.dg/ipa/ivinline-1.C
C++
gpl-2.0
959
/***********************license start*************** * Author: Cavium Networks * * Contact: [email protected] * This file is part of the OCTEON SDK * * Copyright (c) 2003-2010 Cavium Networks * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, as * published by the Free Software Foundation. * * This file is distributed in the hope that it will be useful, but * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or * NONINFRINGEMENT. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License * along with this file; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * or visit http://www.gnu.org/licenses/. * * This file may also be available under a different license from Cavium. * Contact Cavium Networks for more information ***********************license end**************************************/ #ifndef __OCTEON_MODEL_H__ #define __OCTEON_MODEL_H__ #define OCTEON_FAMILY_MASK 0x00ffff00 #define OM_IGNORE_REVISION 0x01000000 #define OM_CHECK_SUBMODEL 0x02000000 #define OM_MATCH_PREVIOUS_MODELS 0x04000000 #define OM_IGNORE_MINOR_REVISION 0x08000000 #define OM_FLAG_MASK 0xff000000 #define OM_MATCH_5XXX_FAMILY_MODELS 0x20000000 #define OM_MATCH_6XXX_FAMILY_MODELS 0x40000000 #define OCTEON_CN68XX_PASS1_0 0x000d9100 #define OCTEON_CN68XX_PASS1_1 0x000d9101 #define OCTEON_CN68XX_PASS1_2 0x000d9102 #define OCTEON_CN68XX_PASS2_0 0x000d9108 #define OCTEON_CN68XX (OCTEON_CN68XX_PASS2_0 | OM_IGNORE_REVISION) #define OCTEON_CN68XX_PASS1_X (OCTEON_CN68XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) #define OCTEON_CN68XX_PASS2_X (OCTEON_CN68XX_PASS2_0 | OM_IGNORE_MINOR_REVISION) #define OCTEON_CN68XX_PASS1 OCTEON_CN68XX_PASS1_X #define OCTEON_CN68XX_PASS2 OCTEON_CN68XX_PASS2_X #define OCTEON_CN66XX_PASS1_0 0x000d9200 #define OCTEON_CN66XX_PASS1_2 0x000d9202 #define OCTEON_CN66XX (OCTEON_CN66XX_PASS1_0 | OM_IGNORE_REVISION) #define OCTEON_CN66XX_PASS1_X (OCTEON_CN66XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) #define OCTEON_CN63XX_PASS1_0 0x000d9000 #define OCTEON_CN63XX_PASS1_1 0x000d9001 #define OCTEON_CN63XX_PASS1_2 0x000d9002 #define OCTEON_CN63XX_PASS2_0 0x000d9008 #define OCTEON_CN63XX_PASS2_1 0x000d9009 #define OCTEON_CN63XX_PASS2_2 0x000d900a #define OCTEON_CN63XX (OCTEON_CN63XX_PASS2_0 | OM_IGNORE_REVISION) #define OCTEON_CN63XX_PASS1_X (OCTEON_CN63XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) #define OCTEON_CN63XX_PASS2_X (OCTEON_CN63XX_PASS2_0 | OM_IGNORE_MINOR_REVISION) #define OCTEON_CN61XX_PASS1_0 0x000d9300 #define OCTEON_CN61XX (OCTEON_CN61XX_PASS1_0 | OM_IGNORE_REVISION) #define OCTEON_CN61XX_PASS1_X (OCTEON_CN61XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) #define OCTEON_CN58XX_PASS1_0 0x000d0300 #define OCTEON_CN58XX_PASS1_1 0x000d0301 #define OCTEON_CN58XX_PASS1_2 0x000d0303 #define OCTEON_CN58XX_PASS2_0 0x000d0308 #define OCTEON_CN58XX_PASS2_1 0x000d0309 #define OCTEON_CN58XX_PASS2_2 0x000d030a #define OCTEON_CN58XX_PASS2_3 0x000d030b #define OCTEON_CN58XX (OCTEON_CN58XX_PASS1_0 | OM_IGNORE_REVISION) #define OCTEON_CN58XX_PASS1_X (OCTEON_CN58XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) #define OCTEON_CN58XX_PASS2_X (OCTEON_CN58XX_PASS2_0 | OM_IGNORE_MINOR_REVISION) #define OCTEON_CN58XX_PASS1 OCTEON_CN58XX_PASS1_X #define OCTEON_CN58XX_PASS2 OCTEON_CN58XX_PASS2_X #define OCTEON_CN56XX_PASS1_0 0x000d0400 #define OCTEON_CN56XX_PASS1_1 0x000d0401 #define OCTEON_CN56XX_PASS2_0 0x000d0408 #define OCTEON_CN56XX_PASS2_1 0x000d0409 #define OCTEON_CN56XX (OCTEON_CN56XX_PASS2_0 | OM_IGNORE_REVISION) #define OCTEON_CN56XX_PASS1_X (OCTEON_CN56XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) #define OCTEON_CN56XX_PASS2_X (OCTEON_CN56XX_PASS2_0 | OM_IGNORE_MINOR_REVISION) #define OCTEON_CN56XX_PASS1 OCTEON_CN56XX_PASS1_X #define OCTEON_CN56XX_PASS2 OCTEON_CN56XX_PASS2_X #define OCTEON_CN57XX OCTEON_CN56XX #define OCTEON_CN57XX_PASS1 OCTEON_CN56XX_PASS1 #define OCTEON_CN57XX_PASS2 OCTEON_CN56XX_PASS2 #define OCTEON_CN55XX OCTEON_CN56XX #define OCTEON_CN55XX_PASS1 OCTEON_CN56XX_PASS1 #define OCTEON_CN55XX_PASS2 OCTEON_CN56XX_PASS2 #define OCTEON_CN54XX OCTEON_CN56XX #define OCTEON_CN54XX_PASS1 OCTEON_CN56XX_PASS1 #define OCTEON_CN54XX_PASS2 OCTEON_CN56XX_PASS2 #define OCTEON_CN50XX_PASS1_0 0x000d0600 #define OCTEON_CN50XX (OCTEON_CN50XX_PASS1_0 | OM_IGNORE_REVISION) #define OCTEON_CN50XX_PASS1_X (OCTEON_CN50XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) #define OCTEON_CN50XX_PASS1 OCTEON_CN50XX_PASS1_X #define OCTEON_CN52XX_PASS1_0 0x000d0700 #define OCTEON_CN52XX_PASS2_0 0x000d0708 #define OCTEON_CN52XX (OCTEON_CN52XX_PASS2_0 | OM_IGNORE_REVISION) #define OCTEON_CN52XX_PASS1_X (OCTEON_CN52XX_PASS1_0 | OM_IGNORE_MINOR_REVISION) #define OCTEON_CN52XX_PASS2_X (OCTEON_CN52XX_PASS2_0 | OM_IGNORE_MINOR_REVISION) #define OCTEON_CN52XX_PASS1 OCTEON_CN52XX_PASS1_X #define OCTEON_CN52XX_PASS2 OCTEON_CN52XX_PASS2_X #define OCTEON_CN38XX_PASS1 0x000d0000 #define OCTEON_CN38XX_PASS2 0x000d0001 #define OCTEON_CN38XX_PASS3 0x000d0003 #define OCTEON_CN38XX (OCTEON_CN38XX_PASS3 | OM_IGNORE_REVISION) #define OCTEON_CN36XX OCTEON_CN38XX #define OCTEON_CN36XX_PASS2 OCTEON_CN38XX_PASS2 #define OCTEON_CN36XX_PASS3 OCTEON_CN38XX_PASS3 #define OCTEON_CN31XX_PASS1 0x000d0100 #define OCTEON_CN31XX_PASS1_1 0x000d0102 #define OCTEON_CN31XX (OCTEON_CN31XX_PASS1 | OM_IGNORE_REVISION) #define OCTEON_CN30XX_PASS1 0x000d0200 #define OCTEON_CN30XX_PASS1_1 0x000d0202 #define OCTEON_CN30XX (OCTEON_CN30XX_PASS1 | OM_IGNORE_REVISION) #define OCTEON_CN3005_PASS1 (0x000d0210 | OM_CHECK_SUBMODEL) #define OCTEON_CN3005_PASS1_0 (0x000d0210 | OM_CHECK_SUBMODEL) #define OCTEON_CN3005_PASS1_1 (0x000d0212 | OM_CHECK_SUBMODEL) #define OCTEON_CN3005 (OCTEON_CN3005_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL) #define OCTEON_CN3010_PASS1 (0x000d0200 | OM_CHECK_SUBMODEL) #define OCTEON_CN3010_PASS1_0 (0x000d0200 | OM_CHECK_SUBMODEL) #define OCTEON_CN3010_PASS1_1 (0x000d0202 | OM_CHECK_SUBMODEL) #define OCTEON_CN3010 (OCTEON_CN3010_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL) #define OCTEON_CN3020_PASS1 (0x000d0110 | OM_CHECK_SUBMODEL) #define OCTEON_CN3020_PASS1_0 (0x000d0110 | OM_CHECK_SUBMODEL) #define OCTEON_CN3020_PASS1_1 (0x000d0112 | OM_CHECK_SUBMODEL) #define OCTEON_CN3020 (OCTEON_CN3020_PASS1 | OM_IGNORE_REVISION | OM_CHECK_SUBMODEL) #define OCTEON_CN3XXX (OCTEON_CN58XX_PASS1_0 | OM_MATCH_PREVIOUS_MODELS | OM_IGNORE_REVISION) #define OCTEON_CN5XXX (OCTEON_CN58XX_PASS1_0 | OM_MATCH_5XXX_FAMILY_MODELS) #define OCTEON_CN6XXX (OCTEON_CN63XX_PASS1_0 | OM_MATCH_6XXX_FAMILY_MODELS) #define OCTEON_38XX_FAMILY_MASK 0x00ffff00 #define OCTEON_38XX_FAMILY_REV_MASK 0x00ffff0f #define OCTEON_38XX_MODEL_MASK 0x00ffff10 #define OCTEON_38XX_MODEL_REV_MASK (OCTEON_38XX_FAMILY_REV_MASK | OCTEON_38XX_MODEL_MASK) #define OCTEON_58XX_FAMILY_MASK OCTEON_38XX_FAMILY_MASK #define OCTEON_58XX_FAMILY_REV_MASK 0x00ffff3f #define OCTEON_58XX_MODEL_MASK 0x00ffffc0 #define OCTEON_58XX_MODEL_REV_MASK (OCTEON_58XX_FAMILY_REV_MASK | OCTEON_58XX_MODEL_MASK) #define OCTEON_58XX_MODEL_MINOR_REV_MASK (OCTEON_58XX_MODEL_REV_MASK & 0x00fffff8) #define OCTEON_5XXX_MODEL_MASK 0x00ff0fc0 static inline uint32_t cvmx_get_proc_id(void) __attribute__ ((pure)); static inline uint64_t cvmx_read_csr(uint64_t csr_addr); #define __OCTEON_MATCH_MASK__(x, y, z) (((x) & (z)) == ((y) & (z))) #define __OCTEON_IS_MODEL_COMPILE__(arg_model, chip_model) \ ((((arg_model & OCTEON_38XX_FAMILY_MASK) < OCTEON_CN58XX_PASS1_0) && ( \ ((((arg_model) & (OM_FLAG_MASK)) == (OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)) \ && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_MODEL_MASK)) || \ ((((arg_model) & (OM_FLAG_MASK)) == 0) \ && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_FAMILY_REV_MASK)) || \ ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_REVISION) \ && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_FAMILY_MASK)) || \ ((((arg_model) & (OM_FLAG_MASK)) == OM_CHECK_SUBMODEL) \ && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_38XX_MODEL_REV_MASK)) || \ ((((arg_model) & (OM_MATCH_PREVIOUS_MODELS)) == OM_MATCH_PREVIOUS_MODELS) \ && (((chip_model) & OCTEON_38XX_MODEL_MASK) < ((arg_model) & OCTEON_38XX_MODEL_MASK))) \ )) || \ (((arg_model & OCTEON_38XX_FAMILY_MASK) >= OCTEON_CN58XX_PASS1_0) && ( \ ((((arg_model) & (OM_FLAG_MASK)) == (OM_IGNORE_REVISION | OM_CHECK_SUBMODEL)) \ && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MASK)) || \ ((((arg_model) & (OM_FLAG_MASK)) == 0) \ && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_FAMILY_REV_MASK)) || \ ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_MINOR_REVISION) \ && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_MINOR_REV_MASK)) || \ ((((arg_model) & (OM_FLAG_MASK)) == OM_IGNORE_REVISION) \ && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_FAMILY_MASK)) || \ ((((arg_model) & (OM_FLAG_MASK)) == OM_CHECK_SUBMODEL) \ && __OCTEON_MATCH_MASK__((chip_model), (arg_model), OCTEON_58XX_MODEL_REV_MASK)) || \ ((((arg_model) & (OM_MATCH_5XXX_FAMILY_MODELS)) == OM_MATCH_5XXX_FAMILY_MODELS) \ && ((chip_model) >= OCTEON_CN58XX_PASS1_0) && ((chip_model) < OCTEON_CN63XX_PASS1_0)) || \ ((((arg_model) & (OM_MATCH_6XXX_FAMILY_MODELS)) == OM_MATCH_6XXX_FAMILY_MODELS) \ && ((chip_model) >= OCTEON_CN63XX_PASS1_0)) || \ ((((arg_model) & (OM_MATCH_PREVIOUS_MODELS)) == OM_MATCH_PREVIOUS_MODELS) \ && (((chip_model) & OCTEON_58XX_MODEL_MASK) < ((arg_model) & OCTEON_58XX_MODEL_MASK))) \ ))) static inline int __octeon_is_model_runtime__(uint32_t model) { uint32_t cpuid = cvmx_get_proc_id(); if ((model & OM_CHECK_SUBMODEL) == OM_CHECK_SUBMODEL) { if (cpuid == OCTEON_CN3010_PASS1 && (cvmx_read_csr(0x80011800800007B8ull) & (1ull << 34))) cpuid |= 0x10; } return __OCTEON_IS_MODEL_COMPILE__(model, cpuid); } #define OCTEON_IS_MODEL(x) __octeon_is_model_runtime__(x) #define OCTEON_IS_COMMON_BINARY() 1 #undef OCTEON_MODEL const char *octeon_model_get_string(uint32_t chip_id); const char *octeon_model_get_string_buffer(uint32_t chip_id, char *buffer); #include "octeon-feature.h" #endif
jameshilliard/m8-3.4.0-gb1fa77f
arch/mips/include/asm/octeon/octeon-model.h
C
gpl-2.0
10,865
-- -- Copyright (c) 2008--2014 Red Hat, Inc. -- -- This software is licensed to you under the GNU General Public License, -- version 2 (GPLv2). There is NO WARRANTY for this software, express or -- implied, including the implied warranties of MERCHANTABILITY or FITNESS -- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 -- along with this software; if not, see -- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. -- -- Red Hat trademarks are not licensed under GPLv2. No permission is -- granted to use or replicate Red Hat trademarks that are incorporated -- in this software or its documentation. -- create or replace view rhnWebContactEnabled as select wcon.id, wcon.org_id, wcon.login, wcon.login_uc, wcon.password, wcon.oracle_contact_id, wcon.created, wcon.modified, wcon.ignore_flag, wcon.read_only from web_contact wcon left join rhnWebContactDisabled wcond on wcond.id = wcon.id where wcond.id is null;
xkollar/spacewalk
schema/spacewalk/upgrade/spacewalk-schema-2.2-to-spacewalk-schema-2.3/011-rhnWebContactEnabled.sql
SQL
gpl-2.0
974
/* -*- c-basic-offset: 2 -*- */ /* Copyright(C) 2011 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef GRN_DAT_CURSOR_HPP_ #define GRN_DAT_CURSOR_HPP_ #include "key.hpp" namespace grn { namespace dat { class GRN_DAT_API Cursor { public: Cursor() {} virtual ~Cursor() {} virtual void close() = 0; virtual const Key &next() = 0; virtual UInt32 offset() const = 0; virtual UInt32 limit() const = 0; virtual UInt32 flags() const = 0; private: // Disallows copy and assignment. Cursor(const Cursor &); Cursor &operator=(const Cursor &); }; } // namespace dat } // namespace grn #endif // GRN_DAT_CURSOR_HPP_
ChengXiaoZ/MariaDBserver
storage/mroonga/vendor/groonga/lib/dat/cursor.hpp
C++
gpl-2.0
1,269
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>commit_all (Git::Base)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> <pre><span class="ruby-comment cmt"># File lib/git/base.rb, line 183</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">commit_all</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">opts</span> = {}) <span class="ruby-identifier">opts</span> = {<span class="ruby-identifier">:add_all</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>}.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">opts</span>) <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">lib</span>.<span class="ruby-identifier">commit</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">opts</span>) <span class="ruby-keyword kw">end</span></pre> </body> </html>
fcoury/gitorious
vendor/ruby-git/doc/classes/Git/Base.src/M000104.html
HTML
agpl-3.0
1,260
//----------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs" company="Akka.NET Project"> // Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com> // Copyright (C) 2013-2015 Akka.NET project <https://github.com/akkadotnet/akka.net> // </copyright> //----------------------------------------------------------------------- using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Akka.PersistenceExtension")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("Akka.PersistenceExtension")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("e3bcba88-003c-4cda-8a60-f0c2553fe3c8")]
thelegendofando/akka.net
src/core/Akka.Persistence/Properties/AssemblyInfo.cs
C#
apache-2.0
1,249
; Licensed to the .NET Foundation under one or more agreements. ; The .NET Foundation licenses this file to you under the MIT license. ; See the LICENSE file in the project root for more information. ; ==++== ; ; ; ==--== ifdef FEATURE_COMINTEROP include AsmMacros.inc include asmconstants.inc CTPMethodTable__s_pThunkTable equ ?s_pThunkTable@CTPMethodTable@@0PEAVMethodTable@@EA InstantiatedMethodDesc__IMD_GetComPlusCallInfo equ ?IMD_GetComPlusCallInfo@InstantiatedMethodDesc@@QEAAPEAUComPlusCallInfo@@XZ ifdef FEATURE_REMOTING extern CRemotingServices__DispatchInterfaceCall:proc extern CTPMethodTable__s_pThunkTable:qword extern InstantiatedMethodDesc__IMD_GetComPlusCallInfo:proc endif extern CLRToCOMWorker:proc extern ProcessCLRException:proc ifdef FEATURE_REMOTING ; ; in: ; r10: MethodDesc* ; rcx: 'this' object ; ; out: ; METHODDESC_REGISTER (r10) = MethodDesc* (for IL stubs) ; LEAF_ENTRY GenericComPlusCallStub, _TEXT ; ; check for a null 'this' pointer and ; then see if this is a TransparentProxy ; test rcx, rcx jz do_com_call mov rax, [CTPMethodTable__s_pThunkTable] cmp [rcx], rax jne do_com_call ; ; 'this' is a TransparentProxy ; jmp CRemotingServices__DispatchInterfaceCall do_com_call: ; ; Check if the call is being made on an InstantiatedMethodDesc. ; mov ax, [r10 + OFFSETOF__MethodDesc__m_wFlags] and ax, MethodDescClassification__mdcClassification cmp ax, MethodDescClassification__mcInstantiated je GenericComPlusCallWorkerInstantiated ; ; Check if there is an IL stub. ; mov rax, [r10 + OFFSETOF__ComPlusCallMethodDesc__m_pComPlusCallInfo] mov rax, [rax + OFFSETOF__ComPlusCallInfo__m_pILStub] test rax, rax jz GenericComPlusCallStubSlow TAILJMP_RAX LEAF_END GenericComPlusCallStub, _TEXT ; We could inline IMD_GetComPlusCallInfo here but it would be ugly. NESTED_ENTRY GenericComPlusCallWorkerInstantiated, _TEXT, ProcessCLRException alloc_stack 68h save_reg_postrsp r10, 60h SAVE_ARGUMENT_REGISTERS 70h SAVE_FLOAT_ARGUMENT_REGISTERS 20h END_PROLOGUE mov rcx, r10 call InstantiatedMethodDesc__IMD_GetComPlusCallInfo RESTORE_FLOAT_ARGUMENT_REGISTERS 20h RESTORE_ARGUMENT_REGISTERS 70h mov r10, [rsp + 60h] mov rax, [rax + OFFSETOF__ComPlusCallInfo__m_pILStub] add rsp, 68h TAILJMP_RAX NESTED_END GenericComPlusCallWorkerInstantiated, _TEXT endif ifdef FEATURE_REMOTING NESTED_ENTRY GenericComPlusCallStubSlow, _TEXT, ProcessCLRException else NESTED_ENTRY GenericComPlusCallStub, _TEXT, ProcessCLRException endif PROLOG_WITH_TRANSITION_BLOCK 8 ; ; Call CLRToCOMWorker. ; lea rcx, [rsp + __PWTB_TransitionBlock] ; pTransitionBlock mov rdx, r10 ; MethodDesc * call CLRToCOMWorker ; handle FP return values lea rcx, [rsp + __PWTB_FloatArgumentRegisters - 8] cmp rax, 4 jne @F movss xmm0, real4 ptr [rcx] @@: cmp rax, 8 jne @F movsd xmm0, real8 ptr [rcx] @@: ; load return value mov rax, [rcx] EPILOG_WITH_TRANSITION_BLOCK_RETURN ifdef FEATURE_REMOTING NESTED_END GenericComPlusCallStubSlow, _TEXT else NESTED_END GenericComPlusCallStub, _TEXT endif endif ; FEATURE_COMINTEROP end
sejongoh/coreclr
src/vm/amd64/GenericComPlusCallStubs.asm
Assembly
mit
3,943
require File.dirname(__FILE__) + '/../../spec_helper.rb' class LiarLiarPantsOnFire def respond_to?(sym) true end def self.respond_to?(sym) true end end describe 'should_receive' do before(:each) do @liar = LiarLiarPantsOnFire.new end it "should work when object lies about responding to a method" do @liar.should_receive(:something) @liar.something end it 'should work when class lies about responding to a method' do LiarLiarPantsOnFire.should_receive(:something) LiarLiarPantsOnFire.something end it 'should cleanup after itself' do LiarLiarPantsOnFire.metaclass.instance_methods.should_not include("something") end end
schacon/github-services
vendor/rspec-1.1.3/spec/spec/mocks/bug_report_11545_spec.rb
Ruby
mit
692
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ // vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4: #ident "$Id$" /*====== This file is part of PerconaFT. Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. PerconaFT is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. PerconaFT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. ---------------------------------------- PerconaFT is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. PerconaFT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. ======= */ #ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved." #include "test.h" // Verify that a commit of a prepared txn in recovery retains a db created by it. // A checkpoint is taken between the db creation and the txn prepare. // Verify that an abort of a prepared txn in recovery discards the rows that were inserted. // A checkpoint is taken after the rows are inserted and before and the txn prepare. const int test_nrows = 1000000; static void create_foo(DB_ENV *env, DB_TXN *txn) { int r; DB *db = nullptr; r = db_create(&db, env, 0); CKERR(r); r = db->open(db, txn, "foo.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = db->close(db, 0); CKERR(r); } static void populate_foo(DB_ENV *env, DB_TXN *txn) { int r; DB *db = nullptr; r = db_create(&db, env, 0); CKERR(r); r = db->open(db, txn, "foo.db", 0, DB_BTREE, 0, 0); CKERR(r); for (int i = 0; i < test_nrows; i++) { int k = htonl(i); DBT key = { .data = &k, .size = sizeof k }; DBT val = { .data = &i, .size = sizeof i }; r = db->put(db, txn, &key, &val, 0); CKERR(r); } r = db->close(db, 0); CKERR(r); } static void check_foo(DB_ENV *env, DB_TXN *txn) { int r; DB *db; r = db_create(&db, env, 0); CKERR(r); r = db->open(db, txn, "foo.db", 0, DB_BTREE, 0, 0); CKERR(r); DBC *c = nullptr; r = db->cursor(db, txn, &c, 0); CKERR(r); DBT key = {}; key.flags = DB_DBT_REALLOC; DBT val = {}; val.flags = DB_DBT_REALLOC; int i; for (i = 0; 1; i++) { r = c->c_get(c, &key, &val, DB_NEXT); if (r != 0) break; int k, v; assert(key.size == sizeof k); memcpy(&k, key.data, key.size); assert(k == (int) htonl(i)); assert(val.size == sizeof v); memcpy(&v, val.data, val.size); assert(v == i); } assert(i == 0); // no rows found toku_free(key.data); toku_free(val.data); r = c->c_close(c); CKERR(r); r = db->close(db, 0); CKERR(r); } static void create_prepared_txn(void) { int r; DB_ENV *env = nullptr; r = db_env_create(&env, 0); CKERR(r); r = env->open(env, TOKU_TEST_FILENAME, DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); DB_TXN *txn = nullptr; r = env->txn_begin(env, nullptr, &txn, 0); CKERR(r); create_foo(env, txn); r = txn->commit(txn, 0); CKERR(r); r = env->txn_begin(env, nullptr, &txn, 0); CKERR(r); populate_foo(env, txn); r = env->txn_checkpoint(env, 0, 0, 0); CKERR(r); TOKU_XA_XID xid = { 0x1234, 8, 9 }; for (int i = 0; i < 8+9; i++) { xid.data[i] = i; } r = txn->xa_prepare(txn, &xid, 0); CKERR(r); // discard the txn so that we can close the env and run xa recovery later r = txn->discard(txn, 0); CKERR(r); r = env->close(env, TOKUFT_DIRTY_SHUTDOWN); CKERR(r); } static void run_xa_recovery(void) { int r; DB_ENV *env; r = db_env_create(&env, 0); CKERR(r); r = env->open(env, TOKU_TEST_FILENAME, DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE | DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); // get prepared xid long count; TOKU_XA_XID xid; r = env->txn_xa_recover(env, &xid, 1, &count, DB_FIRST); CKERR(r); // abort it DB_TXN *txn = nullptr; r = env->get_txn_from_xid(env, &xid, &txn); CKERR(r); r = txn->abort(txn); CKERR(r); r = env->txn_begin(env, nullptr, &txn, 0); CKERR(r); check_foo(env, txn); r = txn->commit(txn, 0); CKERR(r); r = env->close(env, 0); CKERR(r); } int test_main (int argc, char *const argv[]) { default_parse_args(argc, argv); // init the env directory toku_os_recursive_delete(TOKU_TEST_FILENAME); int r = toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); // run the test create_prepared_txn(); run_xa_recovery(); return 0; }
ChengXiaoZ/MariaDBserver
storage/tokudb/PerconaFT/src/tests/xa-bigtxn-discard-abort.cc
C++
gpl-2.0
5,730
jQuery(document).ready(function(){function e(e){if(e.hasOwnProperty("id"))return"<span class='elusive'><i class='"+e.id+"'></i>"+"&nbsp;&nbsp;"+e.id.toUpperCase()+"</span>"}jQuery(".redux-select-item").each(function(){jQuery(this).hasClass("elusive-icons")?jQuery(this).select2({width:"resolve",triggerChange:!0,allowClear:!0,formatResult:e,formatSelection:e,escapeMarkup:function(e){return e}}):jQuery(this).select2({width:"resolve",triggerChange:!0,allowClear:!0})})});
nhathuynhvan908/coretheme
wp-content/themes/twentyfifteen/themeoption/inc/fields/select/field_select.min.js
JavaScript
gpl-2.0
471
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include <linux/slab.h> #include <linux/workqueue.h> #include <linux/interrupt.h> #include <linux/io.h> #include <linux/delay.h> #include <linux/of.h> #include <linux/iommu.h> #include <linux/qcom_iommu.h> #include <linux/regulator/consumer.h> #include <linux/iopoll.h> #include <linux/coresight-stm.h> #include <soc/qcom/subsystem_restart.h> #include <soc/qcom/scm.h> #include <soc/qcom/smem.h> #include <asm/memory.h> #include "hfi_packetization.h" #include "venus_hfi.h" #include "vidc_hfi_io.h" #include "msm_vidc_debug.h" #define FIRMWARE_SIZE 0X00A00000 #define REG_ADDR_OFFSET_BITMASK 0x000FFFFF #define SHARED_QSIZE 0x1000000 static struct hal_device_data hal_ctxt; static const u32 venus_qdss_entries[][2] = { {0xFC307000, 0x1000}, {0xFC322000, 0x1000}, {0xFC319000, 0x1000}, {0xFC31A000, 0x1000}, {0xFC31B000, 0x1000}, {0xFC321000, 0x1000}, {0xFA180000, 0x1000}, {0xFA181000, 0x1000}, }; #define TZBSP_MEM_PROTECT_VIDEO_VAR 0x8 struct tzbsp_memprot { u32 cp_start; u32 cp_size; u32 cp_nonpixel_start; u32 cp_nonpixel_size; }; struct tzbsp_resp { int ret; }; #define TZBSP_VIDEO_SET_STATE 0xa /* Poll interval in uS */ #define POLL_INTERVAL_US 50 enum tzbsp_video_state { TZBSP_VIDEO_STATE_SUSPEND = 0, TZBSP_VIDEO_STATE_RESUME }; struct tzbsp_video_set_state_req { u32 state; /*shoud be tzbsp_video_state enum value*/ u32 spare; /*reserved for future, should be zero*/ }; static void venus_hfi_pm_hndlr(struct work_struct *work); static DECLARE_DELAYED_WORK(venus_hfi_pm_work, venus_hfi_pm_hndlr); static int venus_hfi_power_enable(void *dev); static inline int venus_hfi_power_on( struct venus_hfi_device *device); static int venus_hfi_disable_regulators(struct venus_hfi_device *device); static int venus_hfi_enable_regulators(struct venus_hfi_device *device); static inline int venus_hfi_prepare_enable_clks( struct venus_hfi_device *device); static inline void venus_hfi_disable_unprepare_clks( struct venus_hfi_device *device); static inline void venus_hfi_set_state(struct venus_hfi_device *device, enum venus_hfi_state state) { mutex_lock(&device->write_lock); mutex_lock(&device->read_lock); device->state = state; mutex_unlock(&device->write_lock); mutex_unlock(&device->read_lock); } static inline bool venus_hfi_core_in_valid_state( struct venus_hfi_device *device) { return device->state != VENUS_STATE_DEINIT; } static void venus_hfi_dump_packet(u8 *packet) { u32 c = 0, packet_size = *(u32 *)packet; const int row_size = 32; /* row must contain enough for 0xdeadbaad * 8 to be converted into * "de ad ba ab " * 8 + '\0' */ char row[3 * row_size]; for (c = 0; c * row_size < packet_size; ++c) { int bytes_to_read = ((c + 1) * row_size > packet_size) ? packet_size % row_size : row_size; hex_dump_to_buffer(packet + c * row_size, bytes_to_read, row_size, 4, row, sizeof(row), false); dprintk(VIDC_PKT, "%s\n", row); } } static void venus_hfi_sim_modify_cmd_packet(u8 *packet, struct venus_hfi_device *device) { struct hfi_cmd_sys_session_init_packet *sys_init; struct hal_session *session = NULL; u8 i; phys_addr_t fw_bias = 0; if (!device || !packet) { dprintk(VIDC_ERR, "Invalid Param\n"); return; } else if (device->hal_data->firmware_base == 0 || is_iommu_present(device->res)) { return; } fw_bias = device->hal_data->firmware_base; sys_init = (struct hfi_cmd_sys_session_init_packet *)packet; if (&device->session_lock) { mutex_lock(&device->session_lock); session = hfi_process_get_session( &device->sess_head, sys_init->session_id); mutex_unlock(&device->session_lock); } if (!session) { dprintk(VIDC_DBG, "%s :Invalid session id : %x\n", __func__, sys_init->session_id); return; } switch (sys_init->packet_type) { case HFI_CMD_SESSION_EMPTY_BUFFER: if (session->is_decoder) { struct hfi_cmd_session_empty_buffer_compressed_packet *pkt = (struct hfi_cmd_session_empty_buffer_compressed_packet *) packet; pkt->packet_buffer -= fw_bias; } else { struct hfi_cmd_session_empty_buffer_uncompressed_plane0_packet *pkt = (struct hfi_cmd_session_empty_buffer_uncompressed_plane0_packet *) packet; pkt->packet_buffer -= fw_bias; } break; case HFI_CMD_SESSION_FILL_BUFFER: { struct hfi_cmd_session_fill_buffer_packet *pkt = (struct hfi_cmd_session_fill_buffer_packet *)packet; pkt->packet_buffer -= fw_bias; break; } case HFI_CMD_SESSION_SET_BUFFERS: { struct hfi_cmd_session_set_buffers_packet *pkt = (struct hfi_cmd_session_set_buffers_packet *)packet; if ((pkt->buffer_type == HFI_BUFFER_OUTPUT) || (pkt->buffer_type == HFI_BUFFER_OUTPUT2)) { struct hfi_buffer_info *buff; buff = (struct hfi_buffer_info *) pkt->rg_buffer_info; buff->buffer_addr -= fw_bias; if (buff->extra_data_addr >= fw_bias) buff->extra_data_addr -= fw_bias; } else { for (i = 0; i < pkt->num_buffers; i++) pkt->rg_buffer_info[i] -= fw_bias; } break; } case HFI_CMD_SESSION_RELEASE_BUFFERS: { struct hfi_cmd_session_release_buffer_packet *pkt = (struct hfi_cmd_session_release_buffer_packet *)packet; if ((pkt->buffer_type == HFI_BUFFER_OUTPUT) || (pkt->buffer_type == HFI_BUFFER_OUTPUT2)) { struct hfi_buffer_info *buff; buff = (struct hfi_buffer_info *) pkt->rg_buffer_info; buff->buffer_addr -= fw_bias; buff->extra_data_addr -= fw_bias; } else { for (i = 0; i < pkt->num_buffers; i++) pkt->rg_buffer_info[i] -= fw_bias; } break; } case HFI_CMD_SESSION_PARSE_SEQUENCE_HEADER: { struct hfi_cmd_session_parse_sequence_header_packet *pkt = (struct hfi_cmd_session_parse_sequence_header_packet *) packet; pkt->packet_buffer -= fw_bias; break; } case HFI_CMD_SESSION_GET_SEQUENCE_HEADER: { struct hfi_cmd_session_get_sequence_header_packet *pkt = (struct hfi_cmd_session_get_sequence_header_packet *) packet; pkt->packet_buffer -= fw_bias; break; } default: break; } } /* Read as "for each 'thing' in a set of 'thingies'" */ #define venus_hfi_for_each_thing(__device, __thing, __thingy) \ for (__thing = &(__device)->res->__thingy##_set.__thingy##_tbl[0]; \ __thing < &(__device)->res->__thingy##_set.__thingy##_tbl[0] + \ (__device)->res->__thingy##_set.count; \ ++__thing) \ #define venus_hfi_for_each_regulator(__device, __rinfo) \ venus_hfi_for_each_thing(__device, __rinfo, regulator) #define venus_hfi_for_each_clock(__device, __cinfo) \ venus_hfi_for_each_thing(__device, __cinfo, clock) #define venus_hfi_for_each_bus(__device, __binfo) \ venus_hfi_for_each_thing(__device, __binfo, bus) static int venus_hfi_acquire_regulator(struct regulator_info *rinfo) { int rc = 0; dprintk(VIDC_DBG, "Acquire regulator control from HW: %s\n", rinfo->name); if (rinfo->has_hw_power_collapse) { rc = regulator_set_mode(rinfo->regulator, REGULATOR_MODE_NORMAL); if (rc) { /* * This is somewhat fatal, but nothing we can do * about it. We can't disable the regulator w/o * getting it back under s/w control */ dprintk(VIDC_WARN, "Failed to acquire regulator control : %s\n", rinfo->name); } } WARN_ON(!regulator_is_enabled(rinfo->regulator)); return rc; } static int venus_hfi_hand_off_regulator(struct regulator_info *rinfo) { int rc = 0; dprintk(VIDC_DBG, "Hand off regulator control to HW: %s\n", rinfo->name); if (rinfo->has_hw_power_collapse) { rc = regulator_set_mode(rinfo->regulator, REGULATOR_MODE_FAST); if (rc) dprintk(VIDC_WARN, "Failed to hand off regulator control : %s\n", rinfo->name); } return rc; } static int venus_hfi_hand_off_regulators(struct venus_hfi_device *device) { struct regulator_info *rinfo; int rc = 0, c = 0; venus_hfi_for_each_regulator(device, rinfo) { rc = venus_hfi_hand_off_regulator(rinfo); /* * If one regulator hand off failed, driver should take * the control for other regulators back. */ if (rc) goto err_reg_handoff_failed; c++; } return rc; err_reg_handoff_failed: venus_hfi_for_each_regulator(device, rinfo) { if (!c) break; venus_hfi_acquire_regulator(rinfo); --c; } return rc; } static int venus_hfi_acquire_regulators(struct venus_hfi_device *device) { int rc = 0; struct regulator_info *rinfo; dprintk(VIDC_DBG, "Enabling regulators\n"); venus_hfi_for_each_regulator(device, rinfo) { if (rinfo->has_hw_power_collapse) { /* * Once driver has the control, it restores the * previous state of regulator. Hence driver no * need to call regulator_enable for these. */ rc = venus_hfi_acquire_regulator(rinfo); if (rc) { dprintk(VIDC_WARN, "Failed: Aqcuire control: %s\n", rinfo->name); break; } } } return rc; } static int venus_hfi_write_queue(void *info, u8 *packet, u32 *rx_req_is_set) { struct hfi_queue_header *queue; u32 packet_size_in_words, new_write_idx; struct vidc_iface_q_info *qinfo; u32 empty_space, read_idx; u32 *write_ptr; if (!info || !packet || !rx_req_is_set) { dprintk(VIDC_ERR, "Invalid Params\n"); return -EINVAL; } qinfo = (struct vidc_iface_q_info *) info; if (!qinfo || !qinfo->q_array.align_virtual_addr) { dprintk(VIDC_WARN, "Queues have already been freed\n"); return -EINVAL; } queue = (struct hfi_queue_header *) qinfo->q_hdr; if (!queue) { dprintk(VIDC_ERR, "queue not present\n"); return -ENOENT; } if (msm_vidc_debug & VIDC_PKT) { dprintk(VIDC_PKT, "%s: %p\n", __func__, qinfo); venus_hfi_dump_packet(packet); } packet_size_in_words = (*(u32 *)packet) >> 2; if (packet_size_in_words == 0) { dprintk(VIDC_ERR, "Zero packet size\n"); return -ENODATA; } read_idx = queue->qhdr_read_idx; empty_space = (queue->qhdr_write_idx >= read_idx) ? (queue->qhdr_q_size - (queue->qhdr_write_idx - read_idx)) : (read_idx - queue->qhdr_write_idx); if (empty_space <= packet_size_in_words) { queue->qhdr_tx_req = 1; dprintk(VIDC_ERR, "Insufficient size (%d) to write (%d)\n", empty_space, packet_size_in_words); return -ENOTEMPTY; } queue->qhdr_tx_req = 0; new_write_idx = (queue->qhdr_write_idx + packet_size_in_words); write_ptr = (u32 *)((qinfo->q_array.align_virtual_addr) + (queue->qhdr_write_idx << 2)); if (new_write_idx < queue->qhdr_q_size) { memcpy(write_ptr, packet, packet_size_in_words << 2); } else { new_write_idx -= queue->qhdr_q_size; memcpy(write_ptr, packet, (packet_size_in_words - new_write_idx) << 2); memcpy((void *)qinfo->q_array.align_virtual_addr, packet + ((packet_size_in_words - new_write_idx) << 2), new_write_idx << 2); } /* Memory barrier to make sure packet is written before updating the * write index */ mb(); queue->qhdr_write_idx = new_write_idx; *rx_req_is_set = (1 == queue->qhdr_rx_req) ? 1 : 0; /*Memory barrier to make sure write index is updated before an * interupt is raised on venus.*/ mb(); return 0; } static void venus_hfi_hal_sim_modify_msg_packet(u8 *packet, struct venus_hfi_device *device) { struct hfi_msg_sys_session_init_done_packet *sys_idle; struct hal_session *session = NULL; phys_addr_t fw_bias = 0; if (!device || !packet) { dprintk(VIDC_ERR, "Invalid Param\n"); return; } else if (device->hal_data->firmware_base == 0 || is_iommu_present(device->res)) { return; } fw_bias = device->hal_data->firmware_base; sys_idle = (struct hfi_msg_sys_session_init_done_packet *)packet; if (&device->session_lock) { mutex_lock(&device->session_lock); session = hfi_process_get_session( &device->sess_head, sys_idle->session_id); mutex_unlock(&device->session_lock); } if (!session) { dprintk(VIDC_DBG, "%s: Invalid session id : %x\n", __func__, sys_idle->session_id); return; } switch (sys_idle->packet_type) { case HFI_MSG_SESSION_FILL_BUFFER_DONE: if (session->is_decoder) { struct hfi_msg_session_fbd_uncompressed_plane0_packet *pkt_uc = (struct hfi_msg_session_fbd_uncompressed_plane0_packet *) packet; pkt_uc->packet_buffer += fw_bias; } else { struct hfi_msg_session_fill_buffer_done_compressed_packet *pkt = (struct hfi_msg_session_fill_buffer_done_compressed_packet *) packet; pkt->packet_buffer += fw_bias; } break; case HFI_MSG_SESSION_EMPTY_BUFFER_DONE: { struct hfi_msg_session_empty_buffer_done_packet *pkt = (struct hfi_msg_session_empty_buffer_done_packet *)packet; pkt->packet_buffer += fw_bias; break; } case HFI_MSG_SESSION_GET_SEQUENCE_HEADER_DONE: { struct hfi_msg_session_get_sequence_header_done_packet *pkt = (struct hfi_msg_session_get_sequence_header_done_packet *) packet; pkt->sequence_header += fw_bias; break; } default: break; } } static int venus_hfi_read_queue(void *info, u8 *packet, u32 *pb_tx_req_is_set) { struct hfi_queue_header *queue; u32 packet_size_in_words, new_read_idx; u32 *read_ptr; u32 receive_request = 0; struct vidc_iface_q_info *qinfo; int rc = 0; if (!info || !packet || !pb_tx_req_is_set) { dprintk(VIDC_ERR, "Invalid Params\n"); return -EINVAL; } qinfo = (struct vidc_iface_q_info *) info; if (!qinfo || !qinfo->q_array.align_virtual_addr) { dprintk(VIDC_WARN, "Queues have already been freed\n"); return -EINVAL; } /*Memory barrier to make sure data is valid before *reading it*/ mb(); queue = (struct hfi_queue_header *) qinfo->q_hdr; if (!queue) { dprintk(VIDC_ERR, "Queue memory is not allocated\n"); return -ENOMEM; } /* * Do not set receive request for debug queue, if set, * Venus generates interrupt for debug messages even * when there is no response message available. * In general debug queue will not become full as it * is being emptied out for every interrupt from Venus. * Venus will anyway generates interrupt if it is full. */ if (queue->qhdr_type & HFI_Q_ID_CTRL_TO_HOST_MSG_Q) receive_request = 1; if (queue->qhdr_read_idx == queue->qhdr_write_idx) { queue->qhdr_rx_req = receive_request; *pb_tx_req_is_set = 0; dprintk(VIDC_DBG, "%s queue is empty, rx_req = %u, tx_req = %u, read_idx = %u\n", receive_request ? "message" : "debug", queue->qhdr_rx_req, queue->qhdr_tx_req, queue->qhdr_read_idx); return -ENODATA; } read_ptr = (u32 *)((qinfo->q_array.align_virtual_addr) + (queue->qhdr_read_idx << 2)); packet_size_in_words = (*read_ptr) >> 2; if (packet_size_in_words == 0) { dprintk(VIDC_ERR, "Zero packet size\n"); return -ENODATA; } new_read_idx = queue->qhdr_read_idx + packet_size_in_words; if (((packet_size_in_words << 2) <= VIDC_IFACEQ_VAR_HUGE_PKT_SIZE) && queue->qhdr_read_idx <= queue->qhdr_q_size) { if (new_read_idx < queue->qhdr_q_size) { memcpy(packet, read_ptr, packet_size_in_words << 2); } else { new_read_idx -= queue->qhdr_q_size; memcpy(packet, read_ptr, (packet_size_in_words - new_read_idx) << 2); memcpy(packet + ((packet_size_in_words - new_read_idx) << 2), (u8 *)qinfo->q_array.align_virtual_addr, new_read_idx << 2); } } else { dprintk(VIDC_WARN, "BAD packet received, read_idx: 0x%x, pkt_size: %d\n", queue->qhdr_read_idx, packet_size_in_words << 2); dprintk(VIDC_WARN, "Dropping this packet\n"); new_read_idx = queue->qhdr_write_idx; rc = -ENODATA; } queue->qhdr_read_idx = new_read_idx; if (queue->qhdr_read_idx != queue->qhdr_write_idx) queue->qhdr_rx_req = 0; else queue->qhdr_rx_req = receive_request; *pb_tx_req_is_set = (1 == queue->qhdr_tx_req) ? 1 : 0; if (msm_vidc_debug & VIDC_PKT) { dprintk(VIDC_PKT, "%s: %p\n", __func__, qinfo); venus_hfi_dump_packet(packet); } return rc; } static int venus_hfi_alloc(struct venus_hfi_device *dev, void *mem, u32 size, u32 align, u32 flags, u32 usage) { struct vidc_mem_addr *vmem = NULL; struct msm_smem *alloc = NULL; int rc = 0; if (!dev || !dev->hal_client || !mem || !size) { dprintk(VIDC_ERR, "Invalid Params\n"); return -EINVAL; } vmem = (struct vidc_mem_addr *)mem; dprintk(VIDC_INFO, "start to alloc: size:%d, Flags: %d\n", size, flags); venus_hfi_power_enable(dev); alloc = msm_smem_alloc(dev->hal_client, size, align, flags, usage, 1); dprintk(VIDC_DBG, "Alloc done\n"); if (!alloc) { dprintk(VIDC_ERR, "Alloc failed\n"); rc = -ENOMEM; goto fail_smem_alloc; } dprintk(VIDC_DBG, "venus_hfi_alloc: ptr = %p, size = %d\n", alloc->kvaddr, size); rc = msm_smem_cache_operations(dev->hal_client, alloc, SMEM_CACHE_CLEAN); if (rc) { dprintk(VIDC_WARN, "Failed to clean cache\n"); dprintk(VIDC_WARN, "This may result in undefined behavior\n"); } vmem->mem_size = alloc->size; vmem->mem_data = alloc; vmem->align_virtual_addr = alloc->kvaddr; vmem->align_device_addr = alloc->device_addr; return rc; fail_smem_alloc: return rc; } static void venus_hfi_free(struct venus_hfi_device *dev, struct msm_smem *mem) { if (!dev || !mem) { dprintk(VIDC_ERR, "invalid param %p %p\n", dev, mem); return; } if (venus_hfi_power_on(dev)) dprintk(VIDC_ERR, "%s: Power on failed\n", __func__); msm_smem_free(dev->hal_client, mem); } static void venus_hfi_write_register( struct venus_hfi_device *device, u32 reg, u32 value) { u32 hwiosymaddr = reg; u8 *base_addr; if (!device) { dprintk(VIDC_ERR, "Invalid params: %p\n", device); return; } if (device->clk_state != ENABLED_PREPARED) { dprintk(VIDC_WARN, "HFI Write register failed : Clocks are OFF\n"); return; } base_addr = device->hal_data->register_base; dprintk(VIDC_DBG, "Base addr: 0x%p, written to: 0x%x, Value: 0x%x...\n", base_addr, hwiosymaddr, value); base_addr += hwiosymaddr; writel_relaxed(value, base_addr); wmb(); } static int venus_hfi_read_register(struct venus_hfi_device *device, u32 reg) { int rc = 0; u8 *base_addr; if (!device) { dprintk(VIDC_ERR, "Invalid params: %p\n", device); return -EINVAL; } if (device->clk_state != ENABLED_PREPARED) { dprintk(VIDC_WARN, "HFI Read register failed : Clocks are OFF\n"); return -EINVAL; } base_addr = device->hal_data->register_base; rc = readl_relaxed(base_addr + reg); rmb(); dprintk(VIDC_DBG, "Base addr: 0x%p, read from: 0x%x, value: 0x%x...\n", base_addr, reg, rc); return rc; } static void venus_hfi_set_registers(struct venus_hfi_device *device) { struct reg_set *reg_set; int i; if (!device->res) { dprintk(VIDC_ERR, "device resources null, cannot set registers\n"); return; } reg_set = &device->res->reg_set; for (i = 0; i < reg_set->count; i++) { venus_hfi_write_register(device, reg_set->reg_tbl[i].reg, reg_set->reg_tbl[i].value); } } static int venus_hfi_core_start_cpu(struct venus_hfi_device *device) { u32 ctrl_status = 0, count = 0, rc = 0; int max_tries = 100; venus_hfi_write_register(device, VIDC_WRAPPER_INTR_MASK, VIDC_WRAPPER_INTR_MASK_A2HVCODEC_BMSK); venus_hfi_write_register(device, VIDC_CPU_CS_SCIACMDARG3, 1); while (!ctrl_status && count < max_tries) { ctrl_status = venus_hfi_read_register( device, VIDC_CPU_CS_SCIACMDARG0); if ((ctrl_status & 0xFE) == 0x4) { dprintk(VIDC_ERR, "invalid setting for UC_REGION\n"); break; } usleep_range(500, 1000); count++; } if (count >= max_tries) rc = -ETIME; return rc; } static int venus_hfi_iommu_attach(struct venus_hfi_device *device) { int rc = 0; struct iommu_domain *domain; int i; struct iommu_set *iommu_group_set; struct iommu_group *group; struct iommu_info *iommu_map; if (!device || !device->res) return -EINVAL; iommu_group_set = &device->res->iommu_group_set; for (i = 0; i < iommu_group_set->count; i++) { iommu_map = &iommu_group_set->iommu_maps[i]; group = iommu_map->group; domain = msm_get_iommu_domain(iommu_map->domain); if (IS_ERR_OR_NULL(domain)) { dprintk(VIDC_ERR, "Failed to get domain: %s\n", iommu_map->name); rc = PTR_ERR(domain) ?: -EINVAL; break; } rc = iommu_attach_group(domain, group); if (rc) { dprintk(VIDC_ERR, "IOMMU attach failed: %s\n", iommu_map->name); break; } } if (i < iommu_group_set->count) { i--; for (; i >= 0; i--) { iommu_map = &iommu_group_set->iommu_maps[i]; group = iommu_map->group; domain = msm_get_iommu_domain(iommu_map->domain); if (group && domain) iommu_detach_group(domain, group); } } return rc; } static void venus_hfi_iommu_detach(struct venus_hfi_device *device) { struct iommu_group *group; struct iommu_domain *domain; struct iommu_set *iommu_group_set; struct iommu_info *iommu_map; int i; if (!device || !device->res) { dprintk(VIDC_ERR, "Invalid paramter: %p\n", device); return; } iommu_group_set = &device->res->iommu_group_set; for (i = 0; i < iommu_group_set->count; i++) { iommu_map = &iommu_group_set->iommu_maps[i]; group = iommu_map->group; domain = msm_get_iommu_domain(iommu_map->domain); if (group && domain) iommu_detach_group(domain, group); } } #define BUS_LOAD(__w, __h, __fps) (\ /* Something's fishy if the width & height aren't macroblock aligned */\ BUILD_BUG_ON_ZERO(!IS_ALIGNED(__h, 16) || !IS_ALIGNED(__w, 16)) ?: \ (__h >> 4) * (__w >> 4) * __fps) static const u32 venus_hfi_bus_table[] = { BUS_LOAD(0, 0, 0), BUS_LOAD(640, 480, 30), BUS_LOAD(640, 480, 60), BUS_LOAD(1280, 736, 30), BUS_LOAD(1280, 736, 60), BUS_LOAD(1920, 1088, 30), BUS_LOAD(1920, 1088, 60), BUS_LOAD(3840, 2176, 24), BUS_LOAD(4096, 2176, 24), BUS_LOAD(3840, 2176, 30), }; static int venus_hfi_get_bus_vector(struct venus_hfi_device *device, struct bus_info *bus, int load) { int num_rows = ARRAY_SIZE(venus_hfi_bus_table); int i, j; for (i = 0; i < num_rows; i++) { if (load <= venus_hfi_bus_table[i]) break; } j = clamp(i, 0, num_rows - 1); /* Ensure bus index remains within the supported range, * as specified in the device dtsi file */ j = clamp(j, 0, bus->pdata->num_usecases - 1); dprintk(VIDC_DBG, "Required bus = %d\n", j); return j; } static bool venus_hfi_is_session_supported(unsigned long sessions_supported, enum vidc_bus_vote_data_session session_type) { bool same_codec, same_session_type; int codec_bit, session_type_bit; unsigned long session = session_type; if (!sessions_supported || !session) return false; /* ffs returns a 1 indexed, test_bit takes a 0 indexed...index */ codec_bit = ffs(session) - 1; session_type_bit = codec_bit + 1; same_codec = test_bit(codec_bit, &sessions_supported) == test_bit(codec_bit, &session); same_session_type = test_bit(session_type_bit, &sessions_supported) == test_bit(session_type_bit, &session); return same_codec && same_session_type; } static int venus_hfi_vote_buses(void *dev, struct vidc_bus_vote_data *data, int num_data, int requested_level) { struct { struct bus_info *bus; int load; } *aggregate_load_table; int rc = 0, i = 0, num_bus = 0; struct venus_hfi_device *device = dev; struct bus_info *bus = NULL; struct vidc_bus_vote_data *cached_vote_data = NULL; if (!dev) { dprintk(VIDC_ERR, "Invalid device\n"); return -EINVAL; } else if (!num_data) { /* Meh nothing to do */ return 0; } else if (!data) { dprintk(VIDC_ERR, "Invalid voting data\n"); return -EINVAL; } /* (Re-)alloc memory to store the new votes (in case we internally * re-vote after power collapse, which is transparent to client) */ cached_vote_data = krealloc(device->bus_load.vote_data, num_data * sizeof(*cached_vote_data), GFP_KERNEL); if (!cached_vote_data) { dprintk(VIDC_ERR, "Can't alloc memory to cache bus votes\n"); rc = -ENOMEM; goto err_no_mem; } /* Alloc & init the load table */ num_bus = device->res->bus_set.count; aggregate_load_table = kzalloc(sizeof(*aggregate_load_table) * num_bus, GFP_TEMPORARY); if (!aggregate_load_table) { dprintk(VIDC_ERR, "The world is ending (no more memory)\n"); rc = -ENOMEM; goto err_no_mem; } i = 0; venus_hfi_for_each_bus(device, bus) aggregate_load_table[i++].bus = bus; /* Aggregate the loads for each bus */ for (i = 0; i < num_data; ++i) { int j = 0; for (j = 0; j < num_bus; ++j) { bool matches = venus_hfi_is_session_supported( aggregate_load_table[j].bus-> sessions_supported, data[i].session); if (matches) { aggregate_load_table[j].load += data[i].load; } } } /* Now vote for each bus */ for (i = 0; i < num_bus; ++i) { int bus_vector = 0; struct bus_info *bus = aggregate_load_table[i].bus; int load = aggregate_load_table[i].load; /* Let's avoid voting for ocmem if allocation failed. * There's no clean way presently to check which buses are * associated with ocmem. So do a crude check for the bus name, * which relies on the buses being named appropriately. */ if (!device->resources.ocmem.buf && strnstr(bus->pdata->name, "ocmem", strlen(bus->pdata->name))) { dprintk(VIDC_DBG, "Skipping voting for %s (no ocmem)\n", bus->pdata->name); continue; } bus_vector = venus_hfi_get_bus_vector(device, bus, load); /* * Annoying little hack here: if the bus vector for ocmem is 0, * we end up unvoting for ocmem bandwidth. This ends up * resetting the ocmem core on some targets, due to some ocmem * clock being tied to the virtual ocmem noc clk. As a result, * just lower our ocmem vote to the lowest level. */ if (strnstr(bus->pdata->name, "ocmem", strlen(bus->pdata->name)) || device->res->minimum_vote) bus_vector = bus_vector ?: 1; rc = msm_bus_scale_client_update_request(bus->priv, bus_vector); if (rc) { dprintk(VIDC_ERR, "Failed voting for bus %s @ %d: %d\n", bus->pdata->name, bus_vector, rc); /* Ignore error and try to vote for the rest */ rc = 0; } else { dprintk(VIDC_PROF, "Voting bus %s to vector %d with load %d\n", bus->pdata->name, bus_vector, load); } } /* Cache the votes */ for (i = 0; i < num_data; ++i) cached_vote_data[i] = data[i]; device->bus_load.vote_data = cached_vote_data; device->bus_load.vote_data_count = num_data; kfree(aggregate_load_table); err_no_mem: return rc; } static int venus_hfi_unvote_buses(void *dev) { struct venus_hfi_device *device = dev; struct bus_info *bus = NULL; int rc = 0; if (!device) { dprintk(VIDC_ERR, "%s invalid parameters\n", __func__); return -EINVAL; } venus_hfi_for_each_bus(device, bus) { int bus_vector = 0; int local_rc = 0; bus_vector = venus_hfi_get_bus_vector(device, bus, 0); local_rc = msm_bus_scale_client_update_request(bus->priv, bus_vector); if (local_rc) { rc = rc ?: local_rc; dprintk(VIDC_ERR, "Failed unvoting bus %s @ %d: %d\n", bus->pdata->name, bus_vector, rc); } else { dprintk(VIDC_PROF, "Unvoting bus %s to vector %d\n", bus->pdata->name, bus_vector); } } return rc; } static int venus_hfi_iface_cmdq_write_nolock(struct venus_hfi_device *device, void *pkt); static int venus_hfi_iface_cmdq_write(struct venus_hfi_device *device, void *pkt) { int result = -EPERM; if (!device || !pkt) { dprintk(VIDC_ERR, "Invalid Params"); return -EINVAL; } mutex_lock(&device->write_lock); result = venus_hfi_iface_cmdq_write_nolock(device, pkt); mutex_unlock(&device->write_lock); return result; } static int venus_hfi_core_set_resource(void *device, struct vidc_resource_hdr *resource_hdr, void *resource_value, bool locked) { struct hfi_cmd_sys_set_resource_packet *pkt; u8 packet[VIDC_IFACEQ_VAR_SMALL_PKT_SIZE]; int rc = 0; struct venus_hfi_device *dev; if (!device || !resource_hdr || !resource_value) { dprintk(VIDC_ERR, "set_res: Invalid Params\n"); return -EINVAL; } else { dev = device; } pkt = (struct hfi_cmd_sys_set_resource_packet *) packet; rc = create_pkt_set_cmd_sys_resource(pkt, resource_hdr, resource_value); if (rc) { dprintk(VIDC_ERR, "set_res: failed to create packet\n"); goto err_create_pkt; } rc = locked ? venus_hfi_iface_cmdq_write(dev, pkt) : venus_hfi_iface_cmdq_write_nolock(dev, pkt); if (rc) rc = -ENOTEMPTY; err_create_pkt: return rc; } static int venus_hfi_core_release_resource(void *device, struct vidc_resource_hdr *resource_hdr) { struct hfi_cmd_sys_release_resource_packet pkt; int rc = 0; struct venus_hfi_device *dev; if (!device || !resource_hdr) { dprintk(VIDC_ERR, "Inv-Params in rel_res\n"); return -EINVAL; } else { dev = device; } rc = create_pkt_cmd_sys_release_resource(&pkt, resource_hdr); if (rc) { dprintk(VIDC_ERR, "release_res: failed to create packet\n"); goto err_create_pkt; } if (venus_hfi_iface_cmdq_write(dev, &pkt)) rc = -ENOTEMPTY; err_create_pkt: return rc; } static DECLARE_COMPLETION(pc_prep_done); static DECLARE_COMPLETION(release_resources_done); static int __alloc_ocmem(struct venus_hfi_device *device) { int rc = 0; struct ocmem_buf *ocmem_buffer; unsigned long size; if (!device || !device->res) { dprintk(VIDC_ERR, "%s Invalid param, device: 0x%p\n", __func__, device); return -EINVAL; } size = device->res->ocmem_size; if (!size) return rc; ocmem_buffer = device->resources.ocmem.buf; if (!ocmem_buffer || ocmem_buffer->len < size) { ocmem_buffer = ocmem_allocate(OCMEM_VIDEO, size); if (IS_ERR_OR_NULL(ocmem_buffer)) { dprintk(VIDC_ERR, "ocmem_allocate failed: %lu\n", (unsigned long)ocmem_buffer); rc = -ENOMEM; device->resources.ocmem.buf = NULL; goto ocmem_alloc_failed; } device->resources.ocmem.buf = ocmem_buffer; } else { dprintk(VIDC_DBG, "OCMEM is enough. reqd: %lu, available: %lu\n", size, ocmem_buffer->len); } ocmem_alloc_failed: return rc; } static int __free_ocmem(struct venus_hfi_device *device) { int rc = 0; if (!device || !device->res) { dprintk(VIDC_ERR, "%s Invalid param, device: 0x%p\n", __func__, device); return -EINVAL; } if (!device->res->ocmem_size) return rc; if (device->resources.ocmem.buf) { rc = ocmem_free(OCMEM_VIDEO, device->resources.ocmem.buf); if (rc) dprintk(VIDC_ERR, "Failed to free ocmem\n"); device->resources.ocmem.buf = NULL; } return rc; } static int __set_ocmem(struct venus_hfi_device *device, bool locked) { struct vidc_resource_hdr rhdr; int rc = 0; struct on_chip_mem *ocmem; if (!device) { dprintk(VIDC_ERR, "%s Invalid param, device: 0x%p\n", __func__, device); return -EINVAL; } ocmem = &device->resources.ocmem; if (!ocmem->buf) { dprintk(VIDC_ERR, "Invalid params, ocmem_buffer: 0x%p\n", ocmem->buf); return -EINVAL; } rhdr.resource_id = VIDC_RESOURCE_OCMEM; /* * This handle is just used as a cookie and not(cannot be) * accessed by fw */ rhdr.resource_handle = (u32)(unsigned long)ocmem; rhdr.size = ocmem->buf->len; rc = venus_hfi_core_set_resource(device, &rhdr, ocmem->buf, locked); if (rc) { dprintk(VIDC_ERR, "Failed to set OCMEM on driver\n"); goto ocmem_set_failed; } dprintk(VIDC_DBG, "OCMEM set, addr = %lx, size: %ld\n", ocmem->buf->addr, ocmem->buf->len); ocmem_set_failed: return rc; } static int __unset_ocmem(struct venus_hfi_device *device) { struct vidc_resource_hdr rhdr; int rc = 0; if (!device) { dprintk(VIDC_ERR, "%s Invalid param, device: 0x%p\n", __func__, device); rc = -EINVAL; goto ocmem_unset_failed; } if (!device->resources.ocmem.buf) { dprintk(VIDC_INFO, "%s Trying to unset OCMEM which is not allocated\n", __func__); rc = -EINVAL; goto ocmem_unset_failed; } rhdr.resource_id = VIDC_RESOURCE_OCMEM; /* * This handle is just used as a cookie and not(cannot be) * accessed by fw */ rhdr.resource_handle = (u32)(unsigned long)&device->resources.ocmem; rc = venus_hfi_core_release_resource(device, &rhdr); if (rc) dprintk(VIDC_ERR, "Failed to unset OCMEM on driver\n"); ocmem_unset_failed: return rc; } static int __alloc_set_ocmem(struct venus_hfi_device *device, bool locked) { int rc = 0; if (!device || !device->res) { dprintk(VIDC_ERR, "%s Invalid param, device: 0x%p\n", __func__, device); return -EINVAL; } if (!device->res->ocmem_size) return rc; rc = __alloc_ocmem(device); if (rc) { dprintk(VIDC_ERR, "Failed to allocate ocmem: %d\n", rc); goto ocmem_alloc_failed; } rc = venus_hfi_vote_buses(device, device->bus_load.vote_data, device->bus_load.vote_data_count, 0); if (rc) { dprintk(VIDC_ERR, "Failed to scale buses after setting ocmem: %d\n", rc); goto ocmem_set_failed; } rc = __set_ocmem(device, locked); if (rc) { dprintk(VIDC_ERR, "Failed to set ocmem: %d\n", rc); goto ocmem_set_failed; } return rc; ocmem_set_failed: __free_ocmem(device); ocmem_alloc_failed: return rc; } static int __unset_free_ocmem(struct venus_hfi_device *device) { int rc = 0; if (!device || !device->res) { dprintk(VIDC_ERR, "%s Invalid param, device: 0x%p\n", __func__, device); return -EINVAL; } if (!device->res->ocmem_size) return rc; mutex_lock(&device->write_lock); mutex_lock(&device->read_lock); rc = venus_hfi_core_in_valid_state(device); mutex_unlock(&device->read_lock); mutex_unlock(&device->write_lock); if (!rc) { dprintk(VIDC_WARN, "Core is in bad state, Skipping unset OCMEM\n"); goto core_in_bad_state; } init_completion(&release_resources_done); rc = __unset_ocmem(device); if (rc) { dprintk(VIDC_ERR, "Failed to unset OCMEM during PC %d\n", rc); goto ocmem_unset_failed; } rc = wait_for_completion_timeout(&release_resources_done, msecs_to_jiffies(msm_vidc_hw_rsp_timeout)); if (!rc) { dprintk(VIDC_ERR, "Wait interrupted or timeout for RELEASE_RESOURCES: %d\n", rc); rc = -EIO; goto release_resources_failed; } core_in_bad_state: rc = __free_ocmem(device); if (rc) { dprintk(VIDC_ERR, "Failed to free OCMEM during PC\n"); goto ocmem_free_failed; } return rc; ocmem_free_failed: __set_ocmem(device, true); release_resources_failed: ocmem_unset_failed: return rc; } static inline int venus_hfi_tzbsp_set_video_state(enum tzbsp_video_state state) { struct tzbsp_video_set_state_req cmd = {0}; int tzbsp_rsp = 0; int rc = 0; struct scm_desc desc = {0}; desc.args[0] = cmd.state = state; desc.args[1] = cmd.spare = 0; desc.arginfo = SCM_ARGS(2); if (!is_scm_armv8()) { rc = scm_call(SCM_SVC_BOOT, TZBSP_VIDEO_SET_STATE, &cmd, sizeof(cmd), &tzbsp_rsp, sizeof(tzbsp_rsp)); } else { rc = scm_call2(SCM_SIP_FNID(SCM_SVC_BOOT, TZBSP_VIDEO_SET_STATE), &desc); tzbsp_rsp = desc.ret[0]; } if (rc) { dprintk(VIDC_ERR, "Failed scm_call %d\n", rc); return rc; } dprintk(VIDC_DBG, "Set state %d, resp %d\n", state, tzbsp_rsp); if (tzbsp_rsp) { dprintk(VIDC_ERR, "Failed to set video core state to suspend: %d\n", tzbsp_rsp); return -EINVAL; } return 0; } static inline int venus_hfi_reset_core(struct venus_hfi_device *device) { int rc = 0; venus_hfi_write_register(device, VIDC_CTRL_INIT, 0x1); rc = venus_hfi_core_start_cpu(device); if (rc) dprintk(VIDC_ERR, "Failed to start core\n"); return rc; } static struct clock_info *venus_hfi_get_clock(struct venus_hfi_device *device, char *name) { struct clock_info *vc; venus_hfi_for_each_clock(device, vc) { if (!strcmp(vc->name, name)) return vc; } dprintk(VIDC_WARN, "%s Clock %s not found\n", __func__, name); return NULL; } static unsigned long venus_hfi_get_clock_rate(struct clock_info *clock, int num_mbs_per_sec, int codecs_enabled) { int num_rows = clock->count; struct load_freq_table *table = clock->load_freq_tbl; unsigned long freq = table[0].freq; int i; bool matches = false; if (!num_mbs_per_sec && num_rows > 1) return table[num_rows - 1].freq; for (i = 0; i < num_rows; i++) { if (num_mbs_per_sec > table[i].load) break; matches = venus_hfi_is_session_supported( table[i].supported_codecs, codecs_enabled); if (matches) freq = table[i].freq; } dprintk(VIDC_PROF, "Required clock rate = %lu\n", freq); return freq; } static unsigned long venus_hfi_get_core_clock_rate(void *dev) { struct venus_hfi_device *device = (struct venus_hfi_device *) dev; struct clock_info *vc; if (!device) { dprintk(VIDC_ERR, "%s Invalid args: %p\n", __func__, device); return -EINVAL; } vc = venus_hfi_get_clock(device, "core_clk"); if (vc) return clk_get_rate(vc->clk); else return 0; } static int venus_hfi_suspend(void *dev) { int rc = 0; struct venus_hfi_device *device = (struct venus_hfi_device *) dev; if (!device) { dprintk(VIDC_ERR, "%s invalid device\n", __func__); return -EINVAL; } dprintk(VIDC_INFO, "%s\n", __func__); if (device->power_enabled) { rc = flush_delayed_work(&venus_hfi_pm_work); dprintk(VIDC_INFO, "%s flush delayed work %d\n", __func__, rc); } return 0; } static int venus_hfi_halt_axi(struct venus_hfi_device *device) { u32 reg; int rc = 0; if (!device) { dprintk(VIDC_ERR, "Invalid input: %p\n", device); return -EINVAL; } if (venus_hfi_power_enable(device)) { dprintk(VIDC_ERR, "%s: Failed to enable power\n", __func__); return 0; } /* Halt AXI and AXI OCMEM VBIF Access */ reg = venus_hfi_read_register(device, VENUS_VBIF_AXI_HALT_CTRL0); reg |= VENUS_VBIF_AXI_HALT_CTRL0_HALT_REQ; venus_hfi_write_register(device, VENUS_VBIF_AXI_HALT_CTRL0, reg); /* Request for AXI bus port halt */ rc = readl_poll_timeout(device->hal_data->register_base + VENUS_VBIF_AXI_HALT_CTRL1, reg, reg & VENUS_VBIF_AXI_HALT_CTRL1_HALT_ACK, POLL_INTERVAL_US, VENUS_VBIF_AXI_HALT_ACK_TIMEOUT_US); if (rc) dprintk(VIDC_WARN, "AXI bus port halt timeout\n"); return rc; } static inline int venus_hfi_power_off(struct venus_hfi_device *device) { int rc = 0; if (!device) { dprintk(VIDC_ERR, "Invalid params: %p\n", device); return -EINVAL; } if (!device->power_enabled) { dprintk(VIDC_DBG, "Power already disabled\n"); return 0; } dprintk(VIDC_DBG, "Entering power collapse\n"); rc = venus_hfi_tzbsp_set_video_state(TZBSP_VIDEO_STATE_SUSPEND); if (rc) { dprintk(VIDC_WARN, "Failed to suspend video core %d\n", rc); goto err_tzbsp_suspend; } venus_hfi_iommu_detach(device); /* * For some regulators, driver might have transfered the control to HW. * So before touching any clocks, driver should get the regulator * control back. Acquire regulators also makes sure that the regulators * are turned ON. So driver can touch the clocks safely. */ rc = venus_hfi_acquire_regulators(device); if (rc) { dprintk(VIDC_ERR, "Failed to enable gdsc in %s Err code = %d\n", __func__, rc); goto err_acquire_regulators; } venus_hfi_disable_unprepare_clks(device); rc = venus_hfi_disable_regulators(device); if (rc) { dprintk(VIDC_ERR, "Failed to disable gdsc\n"); goto err_disable_regulators; } venus_hfi_unvote_buses(device); device->power_enabled = false; dprintk(VIDC_INFO, "Venus power collapsed\n"); return rc; err_disable_regulators: if (venus_hfi_prepare_enable_clks(device)) dprintk(VIDC_ERR, "Failed prepare_enable_clks\n"); if (venus_hfi_hand_off_regulators(device)) dprintk(VIDC_ERR, "Failed hand_off_regulators\n"); err_acquire_regulators: if (venus_hfi_iommu_attach(device)) dprintk(VIDC_ERR, "Failed iommu_attach\n"); if (venus_hfi_tzbsp_set_video_state(TZBSP_VIDEO_STATE_RESUME)) dprintk(VIDC_ERR, "Failed TZBSP_RESUME\n"); err_tzbsp_suspend: return rc; } static inline int venus_hfi_power_on(struct venus_hfi_device *device) { int rc = 0; if (!device) { dprintk(VIDC_ERR, "Invalid params: %p\n", device); return -EINVAL; } if (device->power_enabled) return 0; dprintk(VIDC_DBG, "Resuming from power collapse\n"); rc = venus_hfi_vote_buses(device, device->bus_load.vote_data, device->bus_load.vote_data_count, 0); if (rc) { dprintk(VIDC_ERR, "Failed to scale buses\n"); goto err_vote_buses; } /* At this point driver has the control for all regulators */ rc = venus_hfi_enable_regulators(device); if (rc) { dprintk(VIDC_ERR, "Failed to enable GDSC in %s Err code = %d\n", __func__, rc); goto err_enable_gdsc; } rc = venus_hfi_prepare_enable_clks(device); if (rc) { dprintk(VIDC_ERR, "Failed to enable clocks\n"); goto err_enable_clk; } /* iommu_attach makes call to TZ for restore_sec_cfg. With this call * TZ accesses the VMIDMT block which needs all the Venus clocks. * While going to power collapse these clocks were turned OFF. * Hence enabling the Venus clocks before iommu_attach call. */ rc = venus_hfi_iommu_attach(device); if (rc) { dprintk(VIDC_ERR, "Failed to attach iommu after power on\n"); goto err_iommu_attach; } /* Reboot the firmware */ rc = venus_hfi_tzbsp_set_video_state(TZBSP_VIDEO_STATE_RESUME); if (rc) { dprintk(VIDC_ERR, "Failed to resume video core %d\n", rc); goto err_set_video_state; } rc = venus_hfi_hand_off_regulators(device); if (rc) dprintk(VIDC_WARN, "Failed to handoff control to HW %d\n", rc); /* * Re-program all of the registers that get reset as a result of * regulator_disable() and _enable() */ venus_hfi_set_registers(device); venus_hfi_write_register(device, VIDC_UC_REGION_ADDR, (u32)device->iface_q_table.align_device_addr); venus_hfi_write_register(device, VIDC_UC_REGION_SIZE, SHARED_QSIZE); venus_hfi_write_register(device, VIDC_CPU_CS_SCIACMDARG2, (u32)device->iface_q_table.align_device_addr); if (device->sfr.align_device_addr) venus_hfi_write_register(device, VIDC_SFR_ADDR, (u32)device->sfr.align_device_addr); if (device->qdss.align_device_addr) venus_hfi_write_register(device, VIDC_MMAP_ADDR, (u32)device->qdss.align_device_addr); /* Wait for boot completion */ rc = venus_hfi_reset_core(device); if (rc) { dprintk(VIDC_ERR, "Failed to reset venus core\n"); goto err_reset_core; } /* * set the flag here to skip venus_hfi_power_on() which is * being called again via __alloc_set_ocmem() if ocmem is enabled */ device->power_enabled = true; /* * write_lock is already acquired at this point, so to avoid * recursive lock in cmdq_write function, call nolock version * of alloc_ocmem */ WARN_ON(!mutex_is_locked(&device->write_lock)); rc = __alloc_set_ocmem(device, false); if (rc) { dprintk(VIDC_ERR, "Failed to allocate OCMEM"); goto err_alloc_ocmem; } dprintk(VIDC_INFO, "Resumed from power collapse\n"); return rc; err_alloc_ocmem: err_reset_core: venus_hfi_tzbsp_set_video_state(TZBSP_VIDEO_STATE_SUSPEND); err_set_video_state: venus_hfi_iommu_detach(device); err_iommu_attach: venus_hfi_disable_unprepare_clks(device); err_enable_clk: venus_hfi_disable_regulators(device); err_enable_gdsc: venus_hfi_unvote_buses(device); err_vote_buses: device->power_enabled = false; dprintk(VIDC_ERR, "Failed to resume from power collapse\n"); return rc; } static int venus_hfi_power_enable(void *dev) { int rc = 0; struct venus_hfi_device *device = dev; if (!device) { dprintk(VIDC_ERR, "Invalid params: %p\n", device); return -EINVAL; } mutex_lock(&device->write_lock); rc = venus_hfi_power_on(device); if (rc) dprintk(VIDC_ERR, "%s: Failed to enable power\n", __func__); mutex_unlock(&device->write_lock); return rc; } static int venus_hfi_scale_clocks(void *dev, int load, int codecs_enabled) { int rc = 0; struct venus_hfi_device *device = dev; struct clock_info *cl; if (!device) { dprintk(VIDC_ERR, "Invalid args: %p\n", device); return -EINVAL; } device->clk_load = load; device->codecs_enabled = codecs_enabled; venus_hfi_for_each_clock(device, cl) { if (cl->count) {/* has_scaling */ unsigned long rate = venus_hfi_get_clock_rate(cl, load, codecs_enabled); rc = clk_set_rate(cl->clk, rate); if (rc) { dprintk(VIDC_ERR, "Failed to set clock rate %lu %s: %d\n", rate, cl->name, rc); break; } } } return rc; } static int venus_hfi_iface_cmdq_write_nolock(struct venus_hfi_device *device, void *pkt) { u32 rx_req_is_set = 0; struct vidc_iface_q_info *q_info; struct vidc_hal_cmd_pkt_hdr *cmd_packet; int result = -EPERM; if (!device || !pkt) { dprintk(VIDC_ERR, "Invalid Params\n"); return -EINVAL; } WARN(!mutex_is_locked(&device->write_lock), "Cmd queue write lock must be acquired"); if (!venus_hfi_core_in_valid_state(device)) { dprintk(VIDC_DBG, "%s - fw not in init state\n", __func__); result = -EINVAL; goto err_q_null; } cmd_packet = (struct vidc_hal_cmd_pkt_hdr *)pkt; device->last_packet_type = cmd_packet->packet_type; q_info = &device->iface_queues[VIDC_IFACEQ_CMDQ_IDX]; if (!q_info) { dprintk(VIDC_ERR, "cannot write to shared Q's\n"); goto err_q_null; } if (!q_info->q_array.align_virtual_addr) { dprintk(VIDC_ERR, "cannot write to shared CMD Q's\n"); result = -ENODATA; goto err_q_null; } venus_hfi_sim_modify_cmd_packet((u8 *)pkt, device); if (!venus_hfi_write_queue(q_info, (u8 *)pkt, &rx_req_is_set)) { if (venus_hfi_power_on(device)) { dprintk(VIDC_ERR, "%s: Power on failed\n", __func__); goto err_q_write; } if (venus_hfi_scale_clocks(device, device->clk_load, device->codecs_enabled)) { dprintk(VIDC_ERR, "Clock scaling failed\n"); goto err_q_write; } if (rx_req_is_set) venus_hfi_write_register( device, VIDC_CPU_IC_SOFTINT, 1 << VIDC_CPU_IC_SOFTINT_H2A_SHFT); if (device->res->sw_power_collapsible) { dprintk(VIDC_DBG, "Cancel and queue delayed work again\n"); cancel_delayed_work(&venus_hfi_pm_work); if (!queue_delayed_work(device->venus_pm_workq, &venus_hfi_pm_work, msecs_to_jiffies( msm_vidc_pwr_collapse_delay))) { dprintk(VIDC_DBG, "PM work already scheduled\n"); } } result = 0; } else { dprintk(VIDC_ERR, "venus_hfi_iface_cmdq_write:queue_full\n"); } err_q_write: err_q_null: return result; } static int venus_hfi_iface_msgq_read(struct venus_hfi_device *device, void *pkt) { u32 tx_req_is_set = 0; int rc = 0; struct vidc_iface_q_info *q_info; if (!pkt) { dprintk(VIDC_ERR, "Invalid Params\n"); return -EINVAL; } mutex_lock(&device->read_lock); if (!venus_hfi_core_in_valid_state(device)) { dprintk(VIDC_DBG, "%s - fw not in init state\n", __func__); rc = -EINVAL; goto read_error_null; } if (device->iface_queues[VIDC_IFACEQ_MSGQ_IDX]. q_array.align_virtual_addr == 0) { dprintk(VIDC_ERR, "cannot read from shared MSG Q's\n"); rc = -ENODATA; goto read_error_null; } q_info = &device->iface_queues[VIDC_IFACEQ_MSGQ_IDX]; if (!venus_hfi_read_queue(q_info, (u8 *)pkt, &tx_req_is_set)) { venus_hfi_hal_sim_modify_msg_packet((u8 *)pkt, device); if (tx_req_is_set) venus_hfi_write_register( device, VIDC_CPU_IC_SOFTINT, 1 << VIDC_CPU_IC_SOFTINT_H2A_SHFT); rc = 0; } else rc = -ENODATA; read_error_null: mutex_unlock(&device->read_lock); return rc; } static int venus_hfi_iface_dbgq_read(struct venus_hfi_device *device, void *pkt) { u32 tx_req_is_set = 0; int rc = 0; struct vidc_iface_q_info *q_info; if (!pkt) { dprintk(VIDC_ERR, "Invalid Params\n"); return -EINVAL; } mutex_lock(&device->read_lock); if (!venus_hfi_core_in_valid_state(device)) { dprintk(VIDC_DBG, "%s - fw not in init state\n", __func__); rc = -EINVAL; goto dbg_error_null; } if (device->iface_queues[VIDC_IFACEQ_DBGQ_IDX]. q_array.align_virtual_addr == 0) { dprintk(VIDC_ERR, "cannot read from shared DBG Q's\n"); rc = -ENODATA; goto dbg_error_null; } q_info = &device->iface_queues[VIDC_IFACEQ_DBGQ_IDX]; if (!venus_hfi_read_queue(q_info, (u8 *)pkt, &tx_req_is_set)) { if (tx_req_is_set) venus_hfi_write_register( device, VIDC_CPU_IC_SOFTINT, 1 << VIDC_CPU_IC_SOFTINT_H2A_SHFT); rc = 0; } else rc = -ENODATA; dbg_error_null: mutex_unlock(&device->read_lock); return rc; } static void venus_hfi_set_queue_hdr_defaults(struct hfi_queue_header *q_hdr) { q_hdr->qhdr_status = 0x1; q_hdr->qhdr_type = VIDC_IFACEQ_DFLT_QHDR; q_hdr->qhdr_q_size = VIDC_IFACEQ_QUEUE_SIZE / 4; q_hdr->qhdr_pkt_size = 0; q_hdr->qhdr_rx_wm = 0x1; q_hdr->qhdr_tx_wm = 0x1; q_hdr->qhdr_rx_req = 0x1; q_hdr->qhdr_tx_req = 0x0; q_hdr->qhdr_rx_irq_status = 0x0; q_hdr->qhdr_tx_irq_status = 0x0; q_hdr->qhdr_read_idx = 0x0; q_hdr->qhdr_write_idx = 0x0; } static void venus_hfi_interface_queues_release(struct venus_hfi_device *device) { int i; struct hfi_mem_map_table *qdss; struct hfi_mem_map *mem_map; int num_entries = sizeof(venus_qdss_entries)/(2 * sizeof(u32)); int domain = -1, partition = -1; unsigned long mem_map_table_base_addr; mutex_lock(&device->write_lock); mutex_lock(&device->read_lock); if (device->qdss.mem_data) { qdss = (struct hfi_mem_map_table *) device->qdss.align_virtual_addr; qdss->mem_map_num_entries = num_entries; mem_map_table_base_addr = device->qdss.align_device_addr + sizeof(struct hfi_mem_map_table); qdss->mem_map_table_base_addr = (u32)mem_map_table_base_addr; if ((unsigned long)qdss->mem_map_table_base_addr != mem_map_table_base_addr) { dprintk(VIDC_ERR, "Invalid mem_map_table_base_addr 0x%lx", mem_map_table_base_addr); } mem_map = (struct hfi_mem_map *)(qdss + 1); msm_smem_get_domain_partition(device->hal_client, 0, HAL_BUFFER_INTERNAL_CMD_QUEUE, &domain, &partition); if (domain >= 0 && partition >= 0) { for (i = 0; i < num_entries; i++) { msm_iommu_unmap_contig_buffer( (unsigned long) (mem_map[i].virtual_addr), domain, partition, SZ_4K); } } venus_hfi_free(device, device->qdss.mem_data); } venus_hfi_free(device, device->iface_q_table.mem_data); venus_hfi_free(device, device->sfr.mem_data); for (i = 0; i < VIDC_IFACEQ_NUMQ; i++) { device->iface_queues[i].q_hdr = NULL; device->iface_queues[i].q_array.mem_data = NULL; device->iface_queues[i].q_array.align_virtual_addr = NULL; device->iface_queues[i].q_array.align_device_addr = 0; } device->iface_q_table.mem_data = NULL; device->iface_q_table.align_virtual_addr = NULL; device->iface_q_table.align_device_addr = 0; device->qdss.mem_data = NULL; device->qdss.align_virtual_addr = NULL; device->qdss.align_device_addr = 0; device->sfr.mem_data = NULL; device->sfr.align_virtual_addr = NULL; device->sfr.align_device_addr = 0; device->mem_addr.mem_data = NULL; device->mem_addr.align_virtual_addr = NULL; device->mem_addr.align_device_addr = 0; msm_smem_delete_client(device->hal_client); device->hal_client = NULL; mutex_unlock(&device->read_lock); mutex_unlock(&device->write_lock); } static int venus_hfi_get_qdss_iommu_virtual_addr(struct hfi_mem_map *mem_map, int domain, int partition) { int i; int rc = 0; ion_phys_addr_t iova = 0; int num_entries = sizeof(venus_qdss_entries)/(2 * sizeof(u32)); for (i = 0; i < num_entries; i++) { if (domain >= 0 && partition >= 0) { rc = msm_iommu_map_contig_buffer( venus_qdss_entries[i][0], domain, partition, venus_qdss_entries[i][1], SZ_4K, 0, &iova); if (rc) { dprintk(VIDC_ERR, "IOMMU QDSS mapping failed for addr 0x%x\n", venus_qdss_entries[i][0]); rc = -ENOMEM; break; } } else { iova = venus_qdss_entries[i][0]; } mem_map[i].virtual_addr = iova; mem_map[i].physical_addr = venus_qdss_entries[i][0]; mem_map[i].size = venus_qdss_entries[i][1]; mem_map[i].attr = 0x0; } if (i < num_entries) { dprintk(VIDC_ERR, "IOMMU QDSS mapping failed, Freeing entries %d\n", i); if (domain >= 0 && partition >= 0) { for (--i; i >= 0; i--) { msm_iommu_unmap_contig_buffer( (unsigned long) (mem_map[i].virtual_addr), domain, partition, SZ_4K); } } } return rc; } static int venus_hfi_interface_queues_init(struct venus_hfi_device *dev) { struct hfi_queue_table_header *q_tbl_hdr; struct hfi_queue_header *q_hdr; u32 i; int rc = 0; struct hfi_mem_map_table *qdss; struct hfi_mem_map *mem_map; struct vidc_iface_q_info *iface_q; struct hfi_sfr_struct *vsfr; struct vidc_mem_addr *mem_addr; int offset = 0; int num_entries = sizeof(venus_qdss_entries)/(2 * sizeof(u32)); int domain = -1, partition = -1; u32 value = 0; unsigned long mem_map_table_base_addr; phys_addr_t fw_bias = 0; mem_addr = &dev->mem_addr; if (!is_iommu_present(dev->res)) fw_bias = dev->hal_data->firmware_base; rc = venus_hfi_alloc(dev, (void *) mem_addr, QUEUE_SIZE, 1, 0, HAL_BUFFER_INTERNAL_CMD_QUEUE); if (rc) { dprintk(VIDC_ERR, "iface_q_table_alloc_fail\n"); goto fail_alloc_queue; } dev->iface_q_table.align_virtual_addr = mem_addr->align_virtual_addr; dev->iface_q_table.align_device_addr = mem_addr->align_device_addr - fw_bias; dev->iface_q_table.mem_size = VIDC_IFACEQ_TABLE_SIZE; dev->iface_q_table.mem_data = mem_addr->mem_data; offset += dev->iface_q_table.mem_size; for (i = 0; i < VIDC_IFACEQ_NUMQ; i++) { iface_q = &dev->iface_queues[i]; iface_q->q_array.align_device_addr = mem_addr->align_device_addr + offset - fw_bias; iface_q->q_array.align_virtual_addr = mem_addr->align_virtual_addr + offset; iface_q->q_array.mem_size = VIDC_IFACEQ_QUEUE_SIZE; iface_q->q_array.mem_data = NULL; offset += iface_q->q_array.mem_size; iface_q->q_hdr = VIDC_IFACEQ_GET_QHDR_START_ADDR( dev->iface_q_table.align_virtual_addr, i); venus_hfi_set_queue_hdr_defaults(iface_q->q_hdr); } if (msm_fw_debug_mode & HFI_DEBUG_MODE_QDSS) { rc = venus_hfi_alloc(dev, (void *) mem_addr, QDSS_SIZE, 1, 0, HAL_BUFFER_INTERNAL_CMD_QUEUE); if (rc) { dprintk(VIDC_WARN, "qdss_alloc_fail: QDSS messages logging will not work\n"); dev->qdss.align_device_addr = 0; } else { dev->qdss.align_device_addr = mem_addr->align_device_addr - fw_bias; dev->qdss.align_virtual_addr = mem_addr->align_virtual_addr; dev->qdss.mem_size = QDSS_SIZE; dev->qdss.mem_data = mem_addr->mem_data; } } rc = venus_hfi_alloc(dev, (void *) mem_addr, SFR_SIZE, 1, 0, HAL_BUFFER_INTERNAL_CMD_QUEUE); if (rc) { dprintk(VIDC_WARN, "sfr_alloc_fail: SFR not will work\n"); dev->sfr.align_device_addr = 0; } else { dev->sfr.align_device_addr = mem_addr->align_device_addr - fw_bias; dev->sfr.align_virtual_addr = mem_addr->align_virtual_addr; dev->sfr.mem_size = SFR_SIZE; dev->sfr.mem_data = mem_addr->mem_data; } q_tbl_hdr = (struct hfi_queue_table_header *) dev->iface_q_table.align_virtual_addr; q_tbl_hdr->qtbl_version = 0; q_tbl_hdr->qtbl_size = VIDC_IFACEQ_TABLE_SIZE; q_tbl_hdr->qtbl_qhdr0_offset = sizeof( struct hfi_queue_table_header); q_tbl_hdr->qtbl_qhdr_size = sizeof( struct hfi_queue_header); q_tbl_hdr->qtbl_num_q = VIDC_IFACEQ_NUMQ; q_tbl_hdr->qtbl_num_active_q = VIDC_IFACEQ_NUMQ; iface_q = &dev->iface_queues[VIDC_IFACEQ_CMDQ_IDX]; q_hdr = iface_q->q_hdr; q_hdr->qhdr_start_addr = (u32)iface_q->q_array.align_device_addr; q_hdr->qhdr_type |= HFI_Q_ID_HOST_TO_CTRL_CMD_Q; if ((ion_phys_addr_t)q_hdr->qhdr_start_addr != iface_q->q_array.align_device_addr) { dprintk(VIDC_ERR, "Invalid CMDQ device address (0x%pa)", &iface_q->q_array.align_device_addr); } iface_q = &dev->iface_queues[VIDC_IFACEQ_MSGQ_IDX]; q_hdr = iface_q->q_hdr; q_hdr->qhdr_start_addr = (u32)iface_q->q_array.align_device_addr; q_hdr->qhdr_type |= HFI_Q_ID_CTRL_TO_HOST_MSG_Q; if ((ion_phys_addr_t)q_hdr->qhdr_start_addr != iface_q->q_array.align_device_addr) { dprintk(VIDC_ERR, "Invalid MSGQ device address (0x%pa)", &iface_q->q_array.align_device_addr); } iface_q = &dev->iface_queues[VIDC_IFACEQ_DBGQ_IDX]; q_hdr = iface_q->q_hdr; q_hdr->qhdr_start_addr = (u32)iface_q->q_array.align_device_addr; q_hdr->qhdr_type |= HFI_Q_ID_CTRL_TO_HOST_DEBUG_Q; /* * Set receive request to zero on debug queue as there is no * need of interrupt from video hardware for debug messages */ q_hdr->qhdr_rx_req = 0; if ((ion_phys_addr_t)q_hdr->qhdr_start_addr != iface_q->q_array.align_device_addr) { dprintk(VIDC_ERR, "Invalid DBGQ device address (0x%pa)", &iface_q->q_array.align_device_addr); } value = (u32)dev->iface_q_table.align_device_addr; if ((ion_phys_addr_t)value != dev->iface_q_table.align_device_addr) { dprintk(VIDC_ERR, "Invalid iface_q_table device address (0x%pa)", &dev->iface_q_table.align_device_addr); } venus_hfi_write_register(dev, VIDC_UC_REGION_ADDR, value); venus_hfi_write_register(dev, VIDC_UC_REGION_SIZE, SHARED_QSIZE); venus_hfi_write_register(dev, VIDC_CPU_CS_SCIACMDARG2, value); venus_hfi_write_register(dev, VIDC_CPU_CS_SCIACMDARG1, 0x01); if (dev->qdss.mem_data) { qdss = (struct hfi_mem_map_table *)dev->qdss.align_virtual_addr; qdss->mem_map_num_entries = num_entries; mem_map_table_base_addr = dev->qdss.align_device_addr + sizeof(struct hfi_mem_map_table); qdss->mem_map_table_base_addr = (u32)mem_map_table_base_addr; if ((ion_phys_addr_t)qdss->mem_map_table_base_addr != mem_map_table_base_addr) { dprintk(VIDC_ERR, "Invalid mem_map_table_base_addr (0x%lx)", mem_map_table_base_addr); } mem_map = (struct hfi_mem_map *)(qdss + 1); msm_smem_get_domain_partition(dev->hal_client, 0, HAL_BUFFER_INTERNAL_CMD_QUEUE, &domain, &partition); rc = venus_hfi_get_qdss_iommu_virtual_addr( mem_map, domain, partition); if (rc) { dprintk(VIDC_ERR, "IOMMU mapping failed, Freeing qdss memdata\n"); venus_hfi_free(dev, dev->qdss.mem_data); dev->qdss.mem_data = NULL; } value = (u32)dev->qdss.align_device_addr; if ((ion_phys_addr_t)value != dev->qdss.align_device_addr) { dprintk(VIDC_ERR, "Invalid qdss device address (0x%pa)", &dev->qdss.align_device_addr); } if (dev->qdss.align_device_addr) venus_hfi_write_register(dev, VIDC_MMAP_ADDR, value); } vsfr = (struct hfi_sfr_struct *) dev->sfr.align_virtual_addr; vsfr->bufSize = SFR_SIZE; value = (u32)dev->sfr.align_device_addr; if ((ion_phys_addr_t)value != dev->sfr.align_device_addr) { dprintk(VIDC_ERR, "Invalid sfr device address (0x%pa)", &dev->sfr.align_device_addr); } if (dev->sfr.align_device_addr) venus_hfi_write_register(dev, VIDC_SFR_ADDR, value); return 0; fail_alloc_queue: return -ENOMEM; } static int venus_hfi_sys_set_debug(struct venus_hfi_device *device, u32 debug) { u8 packet[VIDC_IFACEQ_VAR_SMALL_PKT_SIZE]; int rc = 0; struct hfi_cmd_sys_set_property_packet *pkt = (struct hfi_cmd_sys_set_property_packet *) &packet; rc = create_pkt_cmd_sys_debug_config(pkt, debug); if (rc) { dprintk(VIDC_WARN, "Debug mode setting to FW failed\n"); return -ENOTEMPTY; } if (venus_hfi_iface_cmdq_write(device, pkt)) return -ENOTEMPTY; return 0; } static int venus_hfi_sys_set_coverage(struct venus_hfi_device *device, u32 mode) { u8 packet[VIDC_IFACEQ_VAR_SMALL_PKT_SIZE]; int rc = 0; struct hfi_cmd_sys_set_property_packet *pkt = (struct hfi_cmd_sys_set_property_packet *) &packet; rc = create_pkt_cmd_sys_coverage_config(pkt, mode); if (rc) { dprintk(VIDC_WARN, "Coverage mode setting to FW failed\n"); return -ENOTEMPTY; } if (venus_hfi_iface_cmdq_write(device, pkt)) { dprintk(VIDC_WARN, "Failed to send coverage pkt to f/w\n"); return -ENOTEMPTY; } return 0; } static int venus_hfi_sys_set_idle_message(struct venus_hfi_device *device, bool enable) { u8 packet[VIDC_IFACEQ_VAR_SMALL_PKT_SIZE]; struct hfi_cmd_sys_set_property_packet *pkt = (struct hfi_cmd_sys_set_property_packet *) &packet; if (!enable) { dprintk(VIDC_DBG, "sys_idle_indicator is not enabled\n"); return 0; } create_pkt_cmd_sys_idle_indicator(pkt, enable); if (venus_hfi_iface_cmdq_write(device, pkt)) return -ENOTEMPTY; return 0; } static int venus_hfi_sys_set_power_control(struct venus_hfi_device *device, bool enable) { struct regulator_info *rinfo; bool supported = false; u8 packet[VIDC_IFACEQ_VAR_SMALL_PKT_SIZE]; struct hfi_cmd_sys_set_property_packet *pkt = (struct hfi_cmd_sys_set_property_packet *) &packet; venus_hfi_for_each_regulator(device, rinfo) { if (rinfo->has_hw_power_collapse) { supported = true; break; } } if (!supported) return 0; create_pkt_cmd_sys_power_control(pkt, enable); if (venus_hfi_iface_cmdq_write(device, pkt)) return -ENOTEMPTY; return 0; } static int venus_hfi_core_init(void *device) { struct hfi_cmd_sys_init_packet pkt; struct hfi_cmd_sys_get_property_packet version_pkt; int rc = 0; struct venus_hfi_device *dev; if (device) { dev = device; } else { dprintk(VIDC_ERR, "Invalid device\n"); return -ENODEV; } venus_hfi_set_state(dev, VENUS_STATE_INIT); dev->intr_status = 0; INIT_LIST_HEAD(&dev->sess_head); venus_hfi_set_registers(dev); if (!dev->hal_client) { dev->hal_client = msm_smem_new_client(SMEM_ION, dev->res); if (dev->hal_client == NULL) { dprintk(VIDC_ERR, "Failed to alloc ION_Client\n"); rc = -ENODEV; goto err_core_init; } dprintk(VIDC_DBG, "Dev_Virt: 0x%pa, Reg_Virt: 0x%p\n", &dev->hal_data->firmware_base, dev->hal_data->register_base); rc = venus_hfi_interface_queues_init(dev); if (rc) { dprintk(VIDC_ERR, "failed to init queues\n"); rc = -ENOMEM; goto err_core_init; } } else { dprintk(VIDC_ERR, "hal_client exists\n"); rc = -EEXIST; goto err_core_init; } enable_irq(dev->hal_data->irq); venus_hfi_write_register(dev, VIDC_CTRL_INIT, 0x1); rc = venus_hfi_core_start_cpu(dev); if (rc) { dprintk(VIDC_ERR, "Failed to start core\n"); rc = -ENODEV; goto err_core_init; } rc = create_pkt_cmd_sys_init(&pkt, HFI_VIDEO_ARCH_OX); if (rc) { dprintk(VIDC_ERR, "Failed to create sys init pkt\n"); goto err_core_init; } if (venus_hfi_iface_cmdq_write(dev, &pkt)) { rc = -ENOTEMPTY; goto err_core_init; } rc = create_pkt_cmd_sys_image_version(&version_pkt); if (rc || venus_hfi_iface_cmdq_write(dev, &version_pkt)) dprintk(VIDC_WARN, "Failed to send image version pkt to f/w\n"); return rc; err_core_init: venus_hfi_set_state(dev, VENUS_STATE_DEINIT); disable_irq_nosync(dev->hal_data->irq); return rc; } static int venus_hfi_core_release(void *device) { struct venus_hfi_device *dev; int rc = 0; if (device) { dev = device; } else { dprintk(VIDC_ERR, "invalid device\n"); return -ENODEV; } if (dev->hal_client) { if (venus_hfi_power_enable(device)) { dprintk(VIDC_ERR, "%s: Power enable failed\n", __func__); return -EIO; } rc = __unset_free_ocmem(dev); if (rc) dprintk(VIDC_ERR, "Failed to unset and free OCMEM in core release, rc : %d\n", rc); venus_hfi_write_register(dev, VIDC_CPU_CS_SCIACMDARG3, 0); if (!(dev->intr_status & VIDC_WRAPPER_INTR_STATUS_A2HWD_BMSK)) disable_irq_nosync(dev->hal_data->irq); dev->intr_status = 0; } venus_hfi_set_state(dev, VENUS_STATE_DEINIT); dprintk(VIDC_INFO, "HAL exited\n"); return 0; } static int venus_hfi_get_q_size(struct venus_hfi_device *dev, unsigned int q_index) { struct hfi_queue_header *queue; struct vidc_iface_q_info *q_info; u32 write_ptr, read_ptr; u32 rc = 0; if (q_index >= VIDC_IFACEQ_NUMQ) { dprintk(VIDC_ERR, "Invalid q index: %d\n", q_index); return -ENOENT; } q_info = &dev->iface_queues[q_index]; if (!q_info) { dprintk(VIDC_ERR, "cannot read shared Q's\n"); return -ENOENT; } queue = (struct hfi_queue_header *)q_info->q_hdr; if (!queue) { dprintk(VIDC_ERR, "queue not present\n"); return -ENOENT; } write_ptr = (u32)queue->qhdr_write_idx; read_ptr = (u32)queue->qhdr_read_idx; rc = read_ptr - write_ptr; return rc; } static void venus_hfi_core_clear_interrupt(struct venus_hfi_device *device) { u32 intr_status = 0; if (!device) { dprintk(VIDC_ERR, "%s: NULL device\n", __func__); return; } intr_status = venus_hfi_read_register( device, VIDC_WRAPPER_INTR_STATUS); if ((intr_status & VIDC_WRAPPER_INTR_STATUS_A2H_BMSK) || (intr_status & VIDC_WRAPPER_INTR_STATUS_A2HWD_BMSK) || (intr_status & VIDC_CPU_CS_SCIACMDARG0_HFI_CTRL_INIT_IDLE_MSG_BMSK)) { device->intr_status |= intr_status; device->reg_count++; dprintk(VIDC_DBG, "INTERRUPT for device: 0x%p: times: %d interrupt_status: %d\n", device, device->reg_count, intr_status); } else { device->spur_count++; dprintk(VIDC_INFO, "SPURIOUS_INTR for device: 0x%p: times: %d interrupt_status: %d\n", device, device->spur_count, intr_status); } venus_hfi_write_register(device, VIDC_CPU_CS_A2HSOFTINTCLR, 1); venus_hfi_write_register(device, VIDC_WRAPPER_INTR_CLEAR, intr_status); dprintk(VIDC_DBG, "Cleared WRAPPER/A2H interrupt\n"); } static int venus_hfi_core_ping(void *device) { struct hfi_cmd_sys_ping_packet pkt; int rc = 0; struct venus_hfi_device *dev; if (device) { dev = device; } else { dprintk(VIDC_ERR, "invalid device\n"); return -ENODEV; } rc = create_pkt_cmd_sys_ping(&pkt); if (rc) { dprintk(VIDC_ERR, "core_ping: failed to create packet\n"); goto err_create_pkt; } if (venus_hfi_iface_cmdq_write(dev, &pkt)) rc = -ENOTEMPTY; err_create_pkt: return rc; } static int venus_hfi_core_trigger_ssr(void *device, enum hal_ssr_trigger_type type) { struct hfi_cmd_sys_test_ssr_packet pkt; int rc = 0; struct venus_hfi_device *dev; if (device) { dev = device; } else { dprintk(VIDC_ERR, "invalid device\n"); return -ENODEV; } rc = create_pkt_ssr_cmd(type, &pkt); if (rc) { dprintk(VIDC_ERR, "core_ping: failed to create packet\n"); goto err_create_pkt; } if (venus_hfi_iface_cmdq_write(dev, &pkt)) rc = -ENOTEMPTY; err_create_pkt: return rc; } static int venus_hfi_session_set_property(void *sess, enum hal_property ptype, void *pdata) { u8 packet[VIDC_IFACEQ_VAR_LARGE_PKT_SIZE]; struct hfi_cmd_session_set_property_packet *pkt = (struct hfi_cmd_session_set_property_packet *) &packet; struct hal_session *session; int rc = 0; if (!sess || !pdata) { dprintk(VIDC_ERR, "Invalid Params\n"); return -EINVAL; } else { session = sess; } dprintk(VIDC_INFO, "in set_prop,with prop id: 0x%x\n", ptype); if (create_pkt_cmd_session_set_property(pkt, session, ptype, pdata)) { dprintk(VIDC_ERR, "set property: failed to create packet\n"); return -EINVAL; } if (venus_hfi_iface_cmdq_write(session->device, pkt)) return -ENOTEMPTY; return rc; } static int venus_hfi_session_get_property(void *sess, enum hal_property ptype) { struct hfi_cmd_session_get_property_packet pkt = {0}; struct hal_session *session; int rc = 0; if (!sess) { dprintk(VIDC_ERR, "Invalid Params\n"); return -EINVAL; } else { session = sess; } dprintk(VIDC_INFO, "%s: property id: %d\n", __func__, ptype); rc = create_pkt_cmd_session_get_property(&pkt, session, ptype); if (rc) { dprintk(VIDC_ERR, "get property profile: pkt failed\n"); goto err_create_pkt; } if (venus_hfi_iface_cmdq_write(session->device, &pkt)) { rc = -ENOTEMPTY; dprintk(VIDC_ERR, "%s cmdq_write error\n", __func__); } err_create_pkt: return rc; } static void venus_hfi_set_default_sys_properties( struct venus_hfi_device *device) { if (venus_hfi_sys_set_debug(device, msm_fw_debug)) dprintk(VIDC_WARN, "Setting fw_debug msg ON failed\n"); if (venus_hfi_sys_set_idle_message(device, device->res->sys_idle_indicator || msm_vidc_sys_idle_indicator)) dprintk(VIDC_WARN, "Setting idle response ON failed\n"); if (venus_hfi_sys_set_power_control(device, msm_fw_low_power_mode)) dprintk(VIDC_WARN, "Setting h/w power collapse ON failed\n"); } static void *venus_hfi_session_init(void *device, void *session_id, enum hal_domain session_type, enum hal_video_codec codec_type) { struct hfi_cmd_sys_session_init_packet pkt; struct hal_session *new_session; struct venus_hfi_device *dev; if (device) { dev = device; } else { dprintk(VIDC_ERR, "invalid device\n"); return NULL; } new_session = (struct hal_session *) kzalloc(sizeof(struct hal_session), GFP_KERNEL); if (!new_session) { dprintk(VIDC_ERR, "new session fail: Out of memory\n"); return NULL; } new_session->session_id = session_id; if (session_type == 1) new_session->is_decoder = 0; else if (session_type == 2) new_session->is_decoder = 1; new_session->device = dev; mutex_lock(&dev->session_lock); list_add_tail(&new_session->list, &dev->sess_head); mutex_unlock(&dev->session_lock); venus_hfi_set_default_sys_properties(device); if (create_pkt_cmd_sys_session_init(&pkt, new_session, session_type, codec_type)) { dprintk(VIDC_ERR, "session_init: failed to create packet\n"); goto err_session_init_fail; } if (venus_hfi_iface_cmdq_write(dev, &pkt)) goto err_session_init_fail; return (void *) new_session; err_session_init_fail: kfree(new_session); return NULL; } static int venus_hfi_send_session_cmd(void *session_id, int pkt_type) { struct vidc_hal_session_cmd_pkt pkt; int rc = 0; struct hal_session *session; if (session_id) { session = session_id; } else { dprintk(VIDC_ERR, "invalid session"); return -ENODEV; } rc = create_pkt_cmd_session_cmd(&pkt, pkt_type, session); if (rc) { dprintk(VIDC_ERR, "send session cmd: create pkt failed\n"); goto err_create_pkt; } if (venus_hfi_iface_cmdq_write(session->device, &pkt)) rc = -ENOTEMPTY; err_create_pkt: return rc; } static int venus_hfi_session_end(void *session) { struct hal_session *sess; if (!session) { dprintk(VIDC_ERR, "Invalid Params %s\n", __func__); return -EINVAL; } sess = session; if (msm_fw_coverage) { if (venus_hfi_sys_set_coverage(sess->device, msm_fw_coverage)) dprintk(VIDC_WARN, "Fw_coverage msg ON failed\n"); } return venus_hfi_send_session_cmd(session, HFI_CMD_SYS_SESSION_END); } static int venus_hfi_session_abort(void *session) { return venus_hfi_send_session_cmd(session, HFI_CMD_SYS_SESSION_ABORT); } static int venus_hfi_session_clean(void *session) { struct hal_session *sess_close; if (!session) { dprintk(VIDC_ERR, "Invalid Params %s\n", __func__); return -EINVAL; } sess_close = session; dprintk(VIDC_DBG, "deleted the session: 0x%p\n", sess_close); mutex_lock(&((struct venus_hfi_device *) sess_close->device)->session_lock); list_del(&sess_close->list); mutex_unlock(&((struct venus_hfi_device *) sess_close->device)->session_lock); kfree(sess_close); return 0; } static int venus_hfi_session_set_buffers(void *sess, struct vidc_buffer_addr_info *buffer_info) { struct hfi_cmd_session_set_buffers_packet *pkt; u8 packet[VIDC_IFACEQ_VAR_LARGE_PKT_SIZE]; int rc = 0; struct hal_session *session; if (!sess || !buffer_info) { dprintk(VIDC_ERR, "Invalid Params\n"); return -EINVAL; } else { session = sess; } if (buffer_info->buffer_type == HAL_BUFFER_INPUT) return 0; pkt = (struct hfi_cmd_session_set_buffers_packet *)packet; rc = create_pkt_cmd_session_set_buffers(pkt, session, buffer_info); if (rc) { dprintk(VIDC_ERR, "set buffers: failed to create packet\n"); goto err_create_pkt; } dprintk(VIDC_INFO, "set buffers: 0x%x\n", buffer_info->buffer_type); if (venus_hfi_iface_cmdq_write(session->device, pkt)) rc = -ENOTEMPTY; err_create_pkt: return rc; } static int venus_hfi_session_release_buffers(void *sess, struct vidc_buffer_addr_info *buffer_info) { struct hfi_cmd_session_release_buffer_packet *pkt; u8 packet[VIDC_IFACEQ_VAR_LARGE_PKT_SIZE]; int rc = 0; struct hal_session *session = sess; if (!session || !buffer_info) { dprintk(VIDC_ERR, "Invalid Params\n"); return -EINVAL; } if (buffer_info->buffer_type == HAL_BUFFER_INPUT) return 0; pkt = (struct hfi_cmd_session_release_buffer_packet *) packet; rc = create_pkt_cmd_session_release_buffers(pkt, session, buffer_info); if (rc) { dprintk(VIDC_ERR, "release buffers: failed to create packet\n"); goto err_create_pkt; } dprintk(VIDC_INFO, "Release buffers: 0x%x\n", buffer_info->buffer_type); if (venus_hfi_iface_cmdq_write(session->device, pkt)) rc = -ENOTEMPTY; err_create_pkt: return rc; } static int venus_hfi_session_load_res(void *sess) { return venus_hfi_send_session_cmd(sess, HFI_CMD_SESSION_LOAD_RESOURCES); } static int venus_hfi_session_release_res(void *sess) { return venus_hfi_send_session_cmd(sess, HFI_CMD_SESSION_RELEASE_RESOURCES); } static int venus_hfi_session_start(void *sess) { return venus_hfi_send_session_cmd(sess, HFI_CMD_SESSION_START); } static int venus_hfi_session_stop(void *sess) { return venus_hfi_send_session_cmd(sess, HFI_CMD_SESSION_STOP); } static int venus_hfi_session_etb(void *sess, struct vidc_frame_data *input_frame) { int rc = 0; struct hal_session *session; if (!sess || !input_frame) { dprintk(VIDC_ERR, "Invalid Params\n"); return -EINVAL; } else { session = sess; } if (session->is_decoder) { struct hfi_cmd_session_empty_buffer_compressed_packet pkt; rc = create_pkt_cmd_session_etb_decoder(&pkt, session, input_frame); if (rc) { dprintk(VIDC_ERR, "Session etb decoder: failed to create pkt\n"); goto err_create_pkt; } dprintk(VIDC_DBG, "Q DECODER INPUT BUFFER\n"); if (venus_hfi_iface_cmdq_write(session->device, &pkt)) rc = -ENOTEMPTY; } else { struct hfi_cmd_session_empty_buffer_uncompressed_plane0_packet pkt; rc = create_pkt_cmd_session_etb_encoder(&pkt, session, input_frame); if (rc) { dprintk(VIDC_ERR, "Session etb encoder: failed to create pkt\n"); goto err_create_pkt; } dprintk(VIDC_DBG, "Q ENCODER INPUT BUFFER\n"); if (venus_hfi_iface_cmdq_write(session->device, &pkt)) rc = -ENOTEMPTY; } err_create_pkt: return rc; } static int venus_hfi_session_ftb(void *sess, struct vidc_frame_data *output_frame) { struct hfi_cmd_session_fill_buffer_packet pkt; int rc = 0; struct hal_session *session; if (!sess || !output_frame) { dprintk(VIDC_ERR, "Invalid Params\n"); return -EINVAL; } else { session = sess; } rc = create_pkt_cmd_session_ftb(&pkt, session, output_frame); if (rc) { dprintk(VIDC_ERR, "Session ftb: failed to create pkt\n"); goto err_create_pkt; } if (venus_hfi_iface_cmdq_write(session->device, &pkt)) rc = -ENOTEMPTY; err_create_pkt: return rc; } static int venus_hfi_session_parse_seq_hdr(void *sess, struct vidc_seq_hdr *seq_hdr) { struct hfi_cmd_session_parse_sequence_header_packet *pkt; int rc = 0; u8 packet[VIDC_IFACEQ_VAR_SMALL_PKT_SIZE]; struct hal_session *session; if (!sess || !seq_hdr) { dprintk(VIDC_ERR, "Invalid Params\n"); return -EINVAL; } else { session = sess; } pkt = (struct hfi_cmd_session_parse_sequence_header_packet *) packet; rc = create_pkt_cmd_session_parse_seq_header(pkt, session, seq_hdr); if (rc) { dprintk(VIDC_ERR, "Session parse seq hdr: failed to create pkt\n"); goto err_create_pkt; } if (venus_hfi_iface_cmdq_write(session->device, pkt)) rc = -ENOTEMPTY; err_create_pkt: return rc; } static int venus_hfi_session_get_seq_hdr(void *sess, struct vidc_seq_hdr *seq_hdr) { struct hfi_cmd_session_get_sequence_header_packet *pkt; int rc = 0; u8 packet[VIDC_IFACEQ_VAR_SMALL_PKT_SIZE]; struct hal_session *session; if (!sess || !seq_hdr) { dprintk(VIDC_ERR, "Invalid Params\n"); return -EINVAL; } else { session = sess; } pkt = (struct hfi_cmd_session_get_sequence_header_packet *) packet; rc = create_pkt_cmd_session_get_seq_hdr(pkt, session, seq_hdr); if (rc) { dprintk(VIDC_ERR, "Session get seq hdr: failed to create pkt\n"); goto err_create_pkt; } if (venus_hfi_iface_cmdq_write(session->device, pkt)) rc = -ENOTEMPTY; err_create_pkt: return rc; } static int venus_hfi_session_get_buf_req(void *sess) { struct hfi_cmd_session_get_property_packet pkt; int rc = 0; struct hal_session *session; if (sess) { session = sess; } else { dprintk(VIDC_ERR, "invalid session"); return -ENODEV; } rc = create_pkt_cmd_session_get_buf_req(&pkt, session); if (rc) { dprintk(VIDC_ERR, "Session get buf req: failed to create pkt\n"); goto err_create_pkt; } if (venus_hfi_iface_cmdq_write(session->device, &pkt)) rc = -ENOTEMPTY; err_create_pkt: return rc; } static int venus_hfi_session_flush(void *sess, enum hal_flush flush_mode) { struct hfi_cmd_session_flush_packet pkt; int rc = 0; struct hal_session *session; if (sess) { session = sess; } else { dprintk(VIDC_ERR, "invalid session"); return -ENODEV; } rc = create_pkt_cmd_session_flush(&pkt, session, flush_mode); if (rc) { dprintk(VIDC_ERR, "Session flush: failed to create pkt\n"); goto err_create_pkt; } if (venus_hfi_iface_cmdq_write(session->device, &pkt)) rc = -ENOTEMPTY; err_create_pkt: return rc; } static int venus_hfi_check_core_registered( struct hal_device_data core, phys_addr_t fw_addr, u8 *reg_addr, u32 reg_size, phys_addr_t irq) { struct venus_hfi_device *device; struct list_head *curr, *next; if (core.dev_count) { list_for_each_safe(curr, next, &core.dev_head) { device = list_entry(curr, struct venus_hfi_device, list); if (device && device->hal_data->irq == irq && (CONTAINS(device->hal_data-> firmware_base, FIRMWARE_SIZE, fw_addr) || CONTAINS(fw_addr, FIRMWARE_SIZE, device->hal_data-> firmware_base) || CONTAINS(device->hal_data-> register_base, reg_size, reg_addr) || CONTAINS(reg_addr, reg_size, device->hal_data-> register_base) || OVERLAPS(device->hal_data-> register_base, reg_size, reg_addr, reg_size) || OVERLAPS(reg_addr, reg_size, device->hal_data-> register_base, reg_size) || OVERLAPS(device->hal_data-> firmware_base, FIRMWARE_SIZE, fw_addr, FIRMWARE_SIZE) || OVERLAPS(fw_addr, FIRMWARE_SIZE, device->hal_data-> firmware_base, FIRMWARE_SIZE))) { return 0; } else { dprintk(VIDC_INFO, "Device not registered\n"); return -EINVAL; } } } else { dprintk(VIDC_INFO, "no device Registered\n"); } return -EINVAL; } static void venus_hfi_process_sys_watchdog_timeout( struct venus_hfi_device *device) { struct msm_vidc_cb_cmd_done cmd_done; memset(&cmd_done, 0, sizeof(struct msm_vidc_cb_cmd_done)); cmd_done.device_id = device->device_id; device->callback(SYS_WATCHDOG_TIMEOUT, &cmd_done); } static int venus_hfi_core_pc_prep(void *device) { struct hfi_cmd_sys_pc_prep_packet pkt; int rc = 0; struct venus_hfi_device *dev; if (device) { dev = device; } else { dprintk(VIDC_ERR, "invalid device\n"); return -ENODEV; } rc = create_pkt_cmd_sys_pc_prep(&pkt); if (rc) { dprintk(VIDC_ERR, "Failed to create sys pc prep pkt\n"); goto err_create_pkt; } if (venus_hfi_iface_cmdq_write(dev, &pkt)) rc = -ENOTEMPTY; err_create_pkt: return rc; } static int venus_hfi_prepare_pc(struct venus_hfi_device *device) { int rc = 0; init_completion(&pc_prep_done); rc = venus_hfi_core_pc_prep(device); if (rc) { dprintk(VIDC_ERR, "Failed to prepare venus for power off"); goto err_pc_prep; } rc = wait_for_completion_timeout(&pc_prep_done, msecs_to_jiffies(msm_vidc_hw_rsp_timeout)); if (!rc) { dprintk(VIDC_ERR, "Wait interrupted or timeout for PC_PREP_DONE: %d\n", rc); rc = -EIO; goto err_pc_prep; } rc = 0; err_pc_prep: return rc; } static void venus_hfi_pm_hndlr(struct work_struct *work) { int rc = 0; u32 ctrl_status = 0; struct venus_hfi_device *device = list_first_entry( &hal_ctxt.dev_head, struct venus_hfi_device, list); if (!device) { dprintk(VIDC_ERR, "%s: NULL device\n", __func__); return; } if (!device->power_enabled) { dprintk(VIDC_DBG, "%s: Power already disabled\n", __func__); return; } mutex_lock(&device->write_lock); mutex_lock(&device->read_lock); rc = venus_hfi_core_in_valid_state(device); mutex_unlock(&device->read_lock); mutex_unlock(&device->write_lock); if (!rc) { dprintk(VIDC_WARN, "Core is in bad state, Skipping power collapse\n"); return; } dprintk(VIDC_DBG, "Prepare for power collapse\n"); rc = __unset_free_ocmem(device); if (rc) { dprintk(VIDC_ERR, "Failed to unset and free OCMEM for PC, rc : %d\n", rc); return; } rc = venus_hfi_prepare_pc(device); if (rc) { dprintk(VIDC_ERR, "Failed to prepare for PC, rc : %d\n", rc); rc = __alloc_set_ocmem(device, true); if (rc) dprintk(VIDC_WARN, "Failed to re-allocate OCMEM. Performance will be impacted\n"); return; } mutex_lock(&device->write_lock); if (device->last_packet_type != HFI_CMD_SYS_PC_PREP) { dprintk(VIDC_DBG, "Last command (0x%x) is not PC_PREP cmd\n", device->last_packet_type); goto skip_power_off; } if (venus_hfi_get_q_size(device, VIDC_IFACEQ_MSGQ_IDX) || venus_hfi_get_q_size(device, VIDC_IFACEQ_CMDQ_IDX)) { dprintk(VIDC_DBG, "Cmd/msg queues are not empty\n"); goto skip_power_off; } ctrl_status = venus_hfi_read_register(device, VIDC_CPU_CS_SCIACMDARG0); if (!(ctrl_status & VIDC_CPU_CS_SCIACMDARG0_HFI_CTRL_PC_READY)) { dprintk(VIDC_DBG, "Venus is not ready for power collapse (0x%x)\n", ctrl_status); goto skip_power_off; } rc = venus_hfi_power_off(device); if (rc) { dprintk(VIDC_ERR, "Failed venus power off\n"); goto err_power_off; } /* Cancel pending delayed works if any */ cancel_delayed_work(&venus_hfi_pm_work); mutex_unlock(&device->write_lock); return; err_power_off: skip_power_off: /* Reset PC_READY bit as power_off is skipped, if set by Venus */ ctrl_status = venus_hfi_read_register(device, VIDC_CPU_CS_SCIACMDARG0); if (ctrl_status & VIDC_CPU_CS_SCIACMDARG0_HFI_CTRL_PC_READY) { ctrl_status &= ~(VIDC_CPU_CS_SCIACMDARG0_HFI_CTRL_PC_READY); venus_hfi_write_register(device, VIDC_CPU_CS_SCIACMDARG0, ctrl_status); } /* Cancel pending delayed works if any */ cancel_delayed_work(&venus_hfi_pm_work); dprintk(VIDC_WARN, "Power off skipped (0x%x, 0x%x)\n", device->last_packet_type, ctrl_status); mutex_unlock(&device->write_lock); rc = __alloc_set_ocmem(device, true); if (rc) dprintk(VIDC_WARN, "Failed to re-allocate OCMEM. Performance will be impacted\n"); return; } static void venus_hfi_process_msg_event_notify( struct venus_hfi_device *device, void *packet) { struct hfi_sfr_struct *vsfr = NULL; struct hfi_msg_event_notify_packet *event_pkt; struct vidc_hal_msg_pkt_hdr *msg_hdr; msg_hdr = (struct vidc_hal_msg_pkt_hdr *)packet; event_pkt = (struct hfi_msg_event_notify_packet *)msg_hdr; if (event_pkt && event_pkt->event_id == HFI_EVENT_SYS_ERROR) { venus_hfi_set_state(device, VENUS_STATE_DEINIT); vsfr = (struct hfi_sfr_struct *) device->sfr.align_virtual_addr; if (vsfr) { void *p = memchr(vsfr->rg_data, '\0', vsfr->bufSize); /* SFR isn't guaranteed to be NULL terminated since SYS_ERROR indicates that Venus is in the process of crashing.*/ if (p == NULL) vsfr->rg_data[vsfr->bufSize - 1] = '\0'; dprintk(VIDC_ERR, "SFR Message from FW : %s\n", vsfr->rg_data); } } } static void venus_hfi_response_handler(struct venus_hfi_device *device) { u8 *packet = NULL; u32 rc = 0; struct hfi_sfr_struct *vsfr = NULL; int stm_size = 0; packet = kzalloc(VIDC_IFACEQ_VAR_HUGE_PKT_SIZE, GFP_TEMPORARY); if (!packet) { dprintk(VIDC_ERR, "In %s() Fail to allocate mem\n", __func__); return; } dprintk(VIDC_INFO, "#####venus_hfi_response_handler#####\n"); if (device) { if ((device->intr_status & VIDC_WRAPPER_INTR_CLEAR_A2HWD_BMSK)) { dprintk(VIDC_ERR, "Received: Watchdog timeout %s\n", __func__); vsfr = (struct hfi_sfr_struct *) device->sfr.align_virtual_addr; if (vsfr) dprintk(VIDC_ERR, "SFR Message from FW : %s\n", vsfr->rg_data); venus_hfi_process_sys_watchdog_timeout(device); } while (!venus_hfi_iface_msgq_read(device, packet)) { rc = hfi_process_msg_packet(device->callback, device->device_id, (struct vidc_hal_msg_pkt_hdr *) packet, &device->sess_head, &device->session_lock); if (rc == HFI_MSG_EVENT_NOTIFY) { venus_hfi_process_msg_event_notify( device, (void *)packet); } else if (rc == HFI_MSG_SYS_RELEASE_RESOURCE) { dprintk(VIDC_DBG, "Received HFI_MSG_SYS_RELEASE_RESOURCE\n"); complete(&release_resources_done); } else if (rc == HFI_MSG_SYS_INIT_DONE) { int ret = 0; dprintk(VIDC_DBG, "Received HFI_MSG_SYS_INIT_DONE\n"); ret = __alloc_set_ocmem(device, true); if (ret) dprintk(VIDC_WARN, "Failed to allocate OCMEM. Performance will be impacted\n"); } } while (!venus_hfi_iface_dbgq_read(device, packet)) { struct hfi_msg_sys_coverage_packet *pkt = (struct hfi_msg_sys_coverage_packet *) packet; if (pkt->packet_type == HFI_MSG_SYS_COV) { dprintk(VIDC_DBG, "DbgQ pkt size:%d\n", pkt->msg_size); stm_size = stm_log_inv_ts(0, 0, pkt->rg_msg_data, pkt->msg_size); if (stm_size == 0) dprintk(VIDC_ERR, "In %s, stm_log returned size of 0\n", __func__); } else { struct hfi_msg_sys_debug_packet *pkt = (struct hfi_msg_sys_debug_packet *) packet; dprintk(VIDC_FW, "%s", pkt->rg_msg_data); } } switch (rc) { case HFI_MSG_SYS_PC_PREP_DONE: dprintk(VIDC_DBG, "Received HFI_MSG_SYS_PC_PREP_DONE\n"); complete(&pc_prep_done); break; } } else { dprintk(VIDC_ERR, "SPURIOUS_INTERRUPT\n"); } kfree(packet); } static void venus_hfi_core_work_handler(struct work_struct *work) { struct venus_hfi_device *device = list_first_entry( &hal_ctxt.dev_head, struct venus_hfi_device, list); dprintk(VIDC_INFO, "GOT INTERRUPT\n"); if (!device->callback) { dprintk(VIDC_ERR, "No interrupt callback function: %p\n", device); return; } if (venus_hfi_power_enable(device)) { dprintk(VIDC_ERR, "%s: Power enable failed\n", __func__); return; } if (device->res->sw_power_collapsible) { dprintk(VIDC_DBG, "Cancel and queue delayed work again.\n"); cancel_delayed_work(&venus_hfi_pm_work); if (!queue_delayed_work(device->venus_pm_workq, &venus_hfi_pm_work, msecs_to_jiffies(msm_vidc_pwr_collapse_delay))) { dprintk(VIDC_DBG, "PM work already scheduled\n"); } } venus_hfi_core_clear_interrupt(device); venus_hfi_response_handler(device); if (!(device->intr_status & VIDC_WRAPPER_INTR_STATUS_A2HWD_BMSK)) enable_irq(device->hal_data->irq); } static DECLARE_WORK(venus_hfi_work, venus_hfi_core_work_handler); static irqreturn_t venus_hfi_isr(int irq, void *dev) { struct venus_hfi_device *device = dev; dprintk(VIDC_INFO, "vidc_hal_isr %d\n", irq); disable_irq_nosync(irq); queue_work(device->vidc_workq, &venus_hfi_work); return IRQ_HANDLED; } static int venus_hfi_init_regs_and_interrupts( struct venus_hfi_device *device, struct msm_vidc_platform_resources *res) { struct hal_data *hal = NULL; int rc = 0; rc = venus_hfi_check_core_registered(hal_ctxt, res->firmware_base, (u8 *)(unsigned long)res->register_base, res->register_size, res->irq); if (!rc) { dprintk(VIDC_ERR, "Core present/Already added\n"); rc = -EEXIST; goto err_core_init; } dprintk(VIDC_DBG, "HAL_DATA will be assigned now\n"); hal = (struct hal_data *) kzalloc(sizeof(struct hal_data), GFP_KERNEL); if (!hal) { dprintk(VIDC_ERR, "Failed to alloc\n"); rc = -ENOMEM; goto err_core_init; } hal->irq = res->irq; hal->firmware_base = res->firmware_base; hal->register_base = devm_ioremap_nocache(&res->pdev->dev, res->register_base, (unsigned long)res->register_size); hal->register_size = res->register_size; if (!hal->register_base) { dprintk(VIDC_ERR, "could not map reg addr 0x%pa of size %d\n", &res->register_base, res->register_size); goto error_irq_fail; } device->hal_data = hal; rc = request_irq(res->irq, venus_hfi_isr, IRQF_TRIGGER_HIGH, "msm_vidc", device); if (unlikely(rc)) { dprintk(VIDC_ERR, "() :request_irq failed\n"); goto error_irq_fail; } disable_irq_nosync(res->irq); dprintk(VIDC_INFO, "firmware_base = 0x%pa, register_base = 0x%pa, register_size = %d\n", &res->firmware_base, &res->register_base, res->register_size); return rc; error_irq_fail: kfree(hal); err_core_init: return rc; } static inline int venus_hfi_init_clocks(struct msm_vidc_platform_resources *res, struct venus_hfi_device *device) { int rc = 0; struct clock_info *cl = NULL; if (!res || !device) { dprintk(VIDC_ERR, "Invalid params: %p\n", device); return -EINVAL; } venus_hfi_for_each_clock(device, cl) { int i = 0; dprintk(VIDC_DBG, "%s: scalable? %d, gate-able? %d\n", cl->name, !!cl->count, cl->has_gating); for (i = 0; i < cl->count; ++i) { dprintk(VIDC_DBG, "\tload = %d, freq = %d codecs supported 0x%x\n", cl->load_freq_tbl[i].load, cl->load_freq_tbl[i].freq, cl->load_freq_tbl[i].supported_codecs); } } venus_hfi_for_each_clock(device, cl) { if (!strcmp(cl->name, "mem_clk") && !res->ocmem_size) { dprintk(VIDC_ERR, "Found %s on a target that doesn't support ocmem\n", cl->name); rc = -ENOENT; goto err_found_bad_ocmem; } if (!cl->clk) { cl->clk = devm_clk_get(&res->pdev->dev, cl->name); if (IS_ERR_OR_NULL(cl->clk)) { dprintk(VIDC_ERR, "Failed to get clock: %s\n", cl->name); rc = PTR_ERR(cl->clk) ?: -EINVAL; cl->clk = NULL; goto err_clk_get; } } } return 0; err_clk_get: err_found_bad_ocmem: venus_hfi_for_each_clock(device, cl) { if (cl->clk) clk_put(cl->clk); } return rc; } static inline void venus_hfi_deinit_clocks(struct venus_hfi_device *device) { struct clock_info *cl; if (!device) { dprintk(VIDC_ERR, "Invalid args\n"); return; } venus_hfi_for_each_clock(device, cl) clk_put(cl->clk); } static inline void venus_hfi_disable_unprepare_clks( struct venus_hfi_device *device) { struct clock_info *cl; if (!device) { dprintk(VIDC_ERR, "Invalid params: %p\n", device); return; } if (device->clk_state == DISABLED_UNPREPARED) { dprintk(VIDC_DBG, "Clocks already unprepared and disabled\n"); return; } venus_hfi_for_each_clock(device, cl) { usleep(100); dprintk(VIDC_DBG, "Clock: %s disable and unprepare\n", cl->name); clk_disable_unprepare(cl->clk); } device->clk_state = DISABLED_UNPREPARED; } static inline int venus_hfi_prepare_enable_clks(struct venus_hfi_device *device) { struct clock_info *cl = NULL, *cl_fail = NULL; int rc = 0; if (!device) { dprintk(VIDC_ERR, "Invalid params: %p\n", device); return -EINVAL; } if (device->clk_state == ENABLED_PREPARED) { dprintk(VIDC_DBG, "Clocks already prepared and enabled\n"); return 0; } venus_hfi_for_each_clock(device, cl) { rc = clk_prepare_enable(cl->clk); if (rc) { dprintk(VIDC_ERR, "Failed to enable clocks\n"); cl_fail = cl; goto fail_clk_enable; } dprintk(VIDC_DBG, "Clock: %s prepared and enabled\n", cl->name); } device->clk_state = ENABLED_PREPARED; venus_hfi_write_register(device, VIDC_WRAPPER_CLOCK_CONFIG, 0); venus_hfi_write_register(device, VIDC_WRAPPER_CPU_CLOCK_CONFIG, 0); return rc; fail_clk_enable: venus_hfi_for_each_clock(device, cl) { if (cl_fail == cl) break; usleep(100); dprintk(VIDC_ERR, "Clock: %s disable and unprepare\n", cl->name); clk_disable_unprepare(cl->clk); } device->clk_state = DISABLED_UNPREPARED; return rc; } static int venus_hfi_register_iommu_domains(struct venus_hfi_device *device, struct msm_vidc_platform_resources *res) { struct iommu_domain *domain; int rc = 0, i = 0; struct iommu_set *iommu_group_set; struct iommu_info *iommu_map; if (!device || !res) return -EINVAL; iommu_group_set = &device->res->iommu_group_set; for (i = 0; i < iommu_group_set->count; i++) { iommu_map = &iommu_group_set->iommu_maps[i]; iommu_map->group = iommu_group_find(iommu_map->name); if (!iommu_map->group) { dprintk(VIDC_DBG, "Failed to find group :%s\n", iommu_map->name); rc = -EPROBE_DEFER; goto fail_group; } domain = iommu_group_get_iommudata(iommu_map->group); if (!domain) { dprintk(VIDC_ERR, "Failed to get domain data for group %p\n", iommu_map->group); rc = -EINVAL; goto fail_group; } iommu_map->domain = msm_find_domain_no(domain); if (iommu_map->domain < 0) { dprintk(VIDC_ERR, "Failed to get domain index for domain %p\n", domain); rc = -EINVAL; goto fail_group; } } return rc; fail_group: for (--i; i >= 0; i--) { iommu_map = &iommu_group_set->iommu_maps[i]; if (iommu_map->group) iommu_group_put(iommu_map->group); iommu_map->group = NULL; iommu_map->domain = -1; } return rc; } static void venus_hfi_deregister_iommu_domains(struct venus_hfi_device *device) { struct iommu_set *iommu_group_set; struct iommu_info *iommu_map; int i = 0; if (!device) return; iommu_group_set = &device->res->iommu_group_set; for (i = 0; i < iommu_group_set->count; i++) { iommu_map = &iommu_group_set->iommu_maps[i]; if (iommu_map->group) iommu_group_put(iommu_map->group); iommu_map->group = NULL; iommu_map->domain = -1; } } static void venus_hfi_deinit_bus(struct venus_hfi_device *device) { struct bus_info *bus = NULL; if (!device) return; venus_hfi_for_each_bus(device, bus) { if (bus->priv) { msm_bus_scale_unregister_client( bus->priv); bus->priv = 0; dprintk(VIDC_DBG, "Unregistered bus client %s\n", bus->pdata->name); } } kfree(device->bus_load.vote_data); device->bus_load.vote_data = NULL; device->bus_load.vote_data_count = 0; } static int venus_hfi_init_bus(struct venus_hfi_device *device) { struct bus_info *bus = NULL; int rc = 0; if (!device) return -EINVAL; venus_hfi_for_each_bus(device, bus) { const char *name = bus->pdata->name; if (!device->res->ocmem_size && strnstr(name, "ocmem", strlen(name))) { dprintk(VIDC_ERR, "%s found when target doesn't support ocmem\n", name); rc = -EINVAL; goto err_init_bus; } bus->priv = msm_bus_scale_register_client(bus->pdata); if (!bus->priv) { dprintk(VIDC_ERR, "Failed to register bus client %s\n", name); rc = -EBADHANDLE; goto err_init_bus; } dprintk(VIDC_DBG, "Registered bus client %s\n", name); } device->bus_load.vote_data = NULL; device->bus_load.vote_data_count = 0; return rc; err_init_bus: venus_hfi_deinit_bus(device); return rc; } static int venus_hfi_init_regulators(struct venus_hfi_device *device, struct msm_vidc_platform_resources *res) { struct regulator_info *rinfo = NULL; venus_hfi_for_each_regulator(device, rinfo) { rinfo->regulator = devm_regulator_get(&res->pdev->dev, rinfo->name); if (IS_ERR(rinfo->regulator)) { dprintk(VIDC_ERR, "Failed to get regulator: %s\n", rinfo->name); rinfo->regulator = NULL; return -ENODEV; } } return 0; } static void venus_hfi_deinit_regulators(struct venus_hfi_device *device) { struct regulator_info *rinfo = NULL; /* No need to regulator_put. Regulators automatically freed * thanks to devm_regulator_get */ venus_hfi_for_each_regulator(device, rinfo) rinfo->regulator = NULL; } static int venus_hfi_init_resources(struct venus_hfi_device *device, struct msm_vidc_platform_resources *res) { int rc = 0; device->res = res; if (!res) { dprintk(VIDC_ERR, "Invalid params: %p\n", res); return -ENODEV; } rc = venus_hfi_init_regulators(device, res); if (rc) { dprintk(VIDC_ERR, "Failed to get all regulators\n"); return -ENODEV; } rc = venus_hfi_init_clocks(res, device); if (rc) { dprintk(VIDC_ERR, "Failed to init clocks\n"); rc = -ENODEV; goto err_init_clocks; } rc = venus_hfi_init_bus(device); if (rc) { dprintk(VIDC_ERR, "Failed to init bus: %d\n", rc); goto err_init_bus; } rc = venus_hfi_register_iommu_domains(device, res); if (rc) { if (rc != -EPROBE_DEFER) { dprintk(VIDC_ERR, "Failed to register iommu domains: %d\n", rc); } goto err_register_iommu_domain; } return rc; err_register_iommu_domain: venus_hfi_deinit_bus(device); err_init_bus: venus_hfi_deinit_clocks(device); err_init_clocks: venus_hfi_deinit_regulators(device); return rc; } static void venus_hfi_deinit_resources(struct venus_hfi_device *device) { venus_hfi_deregister_iommu_domains(device); venus_hfi_deinit_bus(device); venus_hfi_deinit_clocks(device); venus_hfi_deinit_regulators(device); } static int venus_hfi_iommu_get_domain_partition(void *dev, u32 flags, u32 buffer_type, int *domain, int *partition) { struct venus_hfi_device *device = dev; if (!device) { dprintk(VIDC_ERR, "%s: Invalid param device: %p\n", __func__, device); return -EINVAL; } msm_smem_get_domain_partition(device->hal_client, flags, buffer_type, domain, partition); return 0; } static int protect_cp_mem(struct venus_hfi_device *device) { struct tzbsp_memprot memprot; unsigned int resp = 0; int rc = 0; struct iommu_set *iommu_group_set; struct iommu_info *iommu_map; int i; struct scm_desc desc = {0}; if (!device) return -EINVAL; iommu_group_set = &device->res->iommu_group_set; if (!iommu_group_set) { dprintk(VIDC_ERR, "invalid params: %p\n", iommu_group_set); return -EINVAL; } memprot.cp_start = 0x0; memprot.cp_size = 0x0; memprot.cp_nonpixel_start = 0x0; memprot.cp_nonpixel_size = 0x0; for (i = 0; i < iommu_group_set->count; i++) { iommu_map = &iommu_group_set->iommu_maps[i]; if (strcmp(iommu_map->name, "venus_ns") == 0) desc.args[1] = memprot.cp_size = iommu_map->addr_range[0].start; if (strcmp(iommu_map->name, "venus_sec_non_pixel") == 0) { desc.args[2] = memprot.cp_nonpixel_start = iommu_map->addr_range[0].start; desc.args[3] = memprot.cp_nonpixel_size = iommu_map->addr_range[0].size; } else if (strcmp(iommu_map->name, "venus_cp") == 0) { desc.args[2] = memprot.cp_nonpixel_start = iommu_map->addr_range[1].start; } } if (!is_scm_armv8()) { rc = scm_call(SCM_SVC_MP, TZBSP_MEM_PROTECT_VIDEO_VAR, &memprot, sizeof(memprot), &resp, sizeof(resp)); } else { desc.arginfo = SCM_ARGS(4); rc = scm_call2(SCM_SIP_FNID(SCM_SVC_MP, TZBSP_MEM_PROTECT_VIDEO_VAR), &desc); resp = desc.ret[0]; } if (rc) dprintk(VIDC_ERR, "Failed to protect memory , rc is :%d, response : %d\n", rc, resp); trace_venus_hfi_var_done( memprot.cp_start, memprot.cp_size, memprot.cp_nonpixel_start, memprot.cp_nonpixel_size); return rc; } static int venus_hfi_disable_regulator(struct regulator_info *rinfo) { int rc = 0; dprintk(VIDC_DBG, "Disabling regulator %s\n", rinfo->name); /* * This call is needed. Driver needs to acquire the control back * from HW in order to disable the regualtor. Else the behavior * is unknown. */ rc = venus_hfi_acquire_regulator(rinfo); if (rc) { /* This is somewhat fatal, but nothing we can do * about it. We can't disable the regulator w/o * getting it back under s/w control */ dprintk(VIDC_WARN, "Failed to acquire control on %s\n", rinfo->name); goto disable_regulator_failed; } rc = regulator_disable(rinfo->regulator); if (rc) { dprintk(VIDC_WARN, "Failed to disable %s: %d\n", rinfo->name, rc); goto disable_regulator_failed; } return 0; disable_regulator_failed: /* Bring attention to this issue */ WARN_ON(1); return rc; } static int venus_hfi_enable_hw_power_collapse(struct venus_hfi_device *device) { int rc = 0; if (!msm_fw_low_power_mode) { dprintk(VIDC_DBG, "Not enabling hardware power collapse\n"); return 0; } rc = venus_hfi_hand_off_regulators(device); if (rc) dprintk(VIDC_WARN, "%s : Failed to enable HW power collapse %d\n", __func__, rc); return rc; } static int venus_hfi_enable_regulators(struct venus_hfi_device *device) { int rc = 0, c = 0; struct regulator_info *rinfo; dprintk(VIDC_DBG, "Enabling regulators\n"); venus_hfi_for_each_regulator(device, rinfo) { rc = regulator_enable(rinfo->regulator); if (rc) { dprintk(VIDC_ERR, "Failed to enable %s: %d\n", rinfo->name, rc); goto err_reg_enable_failed; } dprintk(VIDC_DBG, "Enabled regulator %s\n", rinfo->name); c++; } return 0; err_reg_enable_failed: venus_hfi_for_each_regulator(device, rinfo) { if (!c) break; venus_hfi_disable_regulator(rinfo); --c; } return rc; } static int venus_hfi_disable_regulators(struct venus_hfi_device *device) { struct regulator_info *rinfo; dprintk(VIDC_DBG, "Disabling regulators\n"); venus_hfi_for_each_regulator(device, rinfo) venus_hfi_disable_regulator(rinfo); return 0; } static int venus_hfi_load_fw(void *dev) { int rc = 0; struct venus_hfi_device *device = dev; if (!device) { dprintk(VIDC_ERR, "%s Invalid paramter: %p\n", __func__, device); return -EINVAL; } trace_msm_v4l2_vidc_fw_load_start("msm_v4l2_vidc venus_fw load start"); rc = venus_hfi_enable_regulators(device); if (rc) { dprintk(VIDC_ERR, "%s : Failed to enable GDSC, Err = %d\n", __func__, rc); goto fail_enable_gdsc; } /* iommu_attach makes call to TZ for restore_sec_cfg. With this call * TZ accesses the VMIDMT block which needs all the Venus clocks. */ rc = venus_hfi_prepare_enable_clks(device); if (rc) { dprintk(VIDC_ERR, "Failed to enable clocks: %d\n", rc); goto fail_enable_clks; } rc = venus_hfi_iommu_attach(device); if (rc) { dprintk(VIDC_ERR, "Failed to attach iommu\n"); goto fail_iommu_attach; } if ((!device->res->use_non_secure_pil && !device->res->firmware_base) || (device->res->use_non_secure_pil)) { if (!device->resources.fw.cookie) device->resources.fw.cookie = subsystem_get("venus"); if (IS_ERR_OR_NULL(device->resources.fw.cookie)) { dprintk(VIDC_ERR, "Failed to download firmware\n"); rc = -ENOMEM; goto fail_load_fw; } } device->power_enabled = true; /* Hand off control of regulators to h/w _after_ enabling clocks */ venus_hfi_enable_hw_power_collapse(device); if (!device->res->use_non_secure_pil && !device->res->firmware_base) { rc = protect_cp_mem(device); if (rc) { dprintk(VIDC_ERR, "Failed to protect memory\n"); goto fail_protect_mem; } } trace_msm_v4l2_vidc_fw_load_end("msm_v4l2_vidc venus_fw load end"); return rc; fail_protect_mem: device->power_enabled = false; if (device->resources.fw.cookie) subsystem_put(device->resources.fw.cookie); device->resources.fw.cookie = NULL; fail_load_fw: venus_hfi_iommu_detach(device); fail_iommu_attach: venus_hfi_disable_unprepare_clks(device); fail_enable_clks: venus_hfi_disable_regulators(device); fail_enable_gdsc: trace_msm_v4l2_vidc_fw_load_end("msm_v4l2_vidc venus_fw load end"); return rc; } static void venus_hfi_unload_fw(void *dev) { struct venus_hfi_device *device = dev; if (!device) { dprintk(VIDC_ERR, "%s Invalid paramter: %p\n", __func__, device); return; } if (device->resources.fw.cookie) { flush_workqueue(device->vidc_workq); cancel_delayed_work(&venus_hfi_pm_work); flush_workqueue(device->venus_pm_workq); subsystem_put(device->resources.fw.cookie); venus_hfi_interface_queues_release(dev); /* IOMMU operations need to be done before AXI halt.*/ venus_hfi_iommu_detach(device); /* Halt the AXI to make sure there are no pending transactions. * Clocks should be unprepared after making sure axi is halted. */ if (venus_hfi_halt_axi(device)) dprintk(VIDC_WARN, "Failed to halt AXI\n"); venus_hfi_disable_unprepare_clks(device); venus_hfi_disable_regulators(device); device->power_enabled = false; device->resources.fw.cookie = NULL; } } static int venus_hfi_resurrect_fw(void *dev) { struct venus_hfi_device *device = dev; int rc = 0; if (!device) { dprintk(VIDC_ERR, "%s Invalid paramter: %p\n", __func__, device); return -EINVAL; } rc = venus_hfi_core_release(device); if (rc) { dprintk(VIDC_ERR, "%s - failed to release venus core rc = %d\n", __func__, rc); goto exit; } dprintk(VIDC_ERR, "praying for firmware resurrection\n"); venus_hfi_unload_fw(device); rc = venus_hfi_vote_buses(device, device->bus_load.vote_data, device->bus_load.vote_data_count, 0); if (rc) { dprintk(VIDC_ERR, "Failed to scale buses\n"); goto exit; } rc = venus_hfi_load_fw(device); if (rc) { dprintk(VIDC_ERR, "%s - failed to load venus fw rc = %d\n", __func__, rc); goto exit; } dprintk(VIDC_ERR, "Hurray!! firmware has restarted\n"); exit: return rc; } static int venus_hfi_get_fw_info(void *dev, enum fw_info info) { int rc = 0; struct venus_hfi_device *device = dev; if (!device) { dprintk(VIDC_ERR, "%s Invalid paramter: %p\n", __func__, device); return -EINVAL; } switch (info) { case FW_BASE_ADDRESS: rc = (u32)device->hal_data->firmware_base; if ((phys_addr_t)rc != device->hal_data->firmware_base) { dprintk(VIDC_INFO, "%s: firmware_base (0x%pa) truncated to 0x%x", __func__, &device->hal_data->firmware_base, rc); } break; case FW_REGISTER_BASE: rc = (u32)device->res->register_base; if ((phys_addr_t)rc != device->res->register_base) { dprintk(VIDC_INFO, "%s: register_base (0x%pa) truncated to 0x%x", __func__, &device->res->register_base, rc); } break; case FW_REGISTER_SIZE: rc = device->hal_data->register_size; break; case FW_IRQ: rc = device->hal_data->irq; break; default: dprintk(VIDC_ERR, "Invalid fw info requested\n"); } return rc; } int venus_hfi_get_stride_scanline(int color_fmt, int width, int height, int *stride, int *scanlines) { *stride = VENUS_Y_STRIDE(color_fmt, width); *scanlines = VENUS_Y_SCANLINES(color_fmt, height); return 0; } int venus_hfi_get_core_capabilities(void) { int rc = 0; rc = HAL_VIDEO_ENCODER_ROTATION_CAPABILITY | HAL_VIDEO_ENCODER_SCALING_CAPABILITY | HAL_VIDEO_ENCODER_DEINTERLACE_CAPABILITY | HAL_VIDEO_DECODER_MULTI_STREAM_CAPABILITY; return rc; } static void *venus_hfi_add_device(u32 device_id, struct msm_vidc_platform_resources *res, hfi_cmd_response_callback callback) { struct venus_hfi_device *hdevice = NULL; int rc = 0; if (!res || !callback) { dprintk(VIDC_ERR, "Invalid Parameters\n"); return NULL; } dprintk(VIDC_INFO, "entered , device_id: %d\n", device_id); hdevice = (struct venus_hfi_device *) kzalloc(sizeof(struct venus_hfi_device), GFP_KERNEL); if (!hdevice) { dprintk(VIDC_ERR, "failed to allocate new device\n"); goto err_alloc; } rc = venus_hfi_init_regs_and_interrupts(hdevice, res); if (rc) goto err_init_regs; hdevice->device_id = device_id; hdevice->callback = callback; hdevice->vidc_workq = create_singlethread_workqueue( "msm_vidc_workerq_venus"); if (!hdevice->vidc_workq) { dprintk(VIDC_ERR, ": create vidc workq failed\n"); goto error_createq; } hdevice->venus_pm_workq = create_singlethread_workqueue( "pm_workerq_venus"); if (!hdevice->venus_pm_workq) { dprintk(VIDC_ERR, ": create pm workq failed\n"); goto error_createq_pm; } mutex_init(&hdevice->read_lock); mutex_init(&hdevice->write_lock); mutex_init(&hdevice->session_lock); if (hal_ctxt.dev_count == 0) INIT_LIST_HEAD(&hal_ctxt.dev_head); INIT_LIST_HEAD(&hdevice->list); list_add_tail(&hdevice->list, &hal_ctxt.dev_head); hal_ctxt.dev_count++; return (void *) hdevice; error_createq_pm: destroy_workqueue(hdevice->vidc_workq); error_createq: err_init_regs: kfree(hdevice); err_alloc: return NULL; } static void *venus_hfi_get_device(u32 device_id, struct msm_vidc_platform_resources *res, hfi_cmd_response_callback callback) { struct venus_hfi_device *device; int rc = 0; if (!res || !callback) { dprintk(VIDC_ERR, "Invalid params: %p %p\n", res, callback); return NULL; } device = venus_hfi_add_device(device_id, res, &handle_cmd_response); if (!device) { dprintk(VIDC_ERR, "Failed to create HFI device\n"); return NULL; } rc = venus_hfi_init_resources(device, res); if (rc) { if (rc != -EPROBE_DEFER) dprintk(VIDC_ERR, "Failed to init resources: %d\n", rc); goto err_fail_init_res; } return device; err_fail_init_res: venus_hfi_delete_device(device); return ERR_PTR(rc); } void venus_hfi_delete_device(void *device) { struct venus_hfi_device *close, *tmp, *dev; if (device) { venus_hfi_deinit_resources(device); dev = (struct venus_hfi_device *) device; list_for_each_entry_safe(close, tmp, &hal_ctxt.dev_head, list) { if (close->hal_data->irq == dev->hal_data->irq) { hal_ctxt.dev_count--; free_irq(dev->hal_data->irq, close); list_del(&close->list); destroy_workqueue(close->vidc_workq); destroy_workqueue(close->venus_pm_workq); kfree(close->hal_data); kfree(close); break; } } } } static void venus_init_hfi_callbacks(struct hfi_device *hdev) { hdev->core_init = venus_hfi_core_init; hdev->core_release = venus_hfi_core_release; hdev->core_pc_prep = venus_hfi_core_pc_prep; hdev->core_ping = venus_hfi_core_ping; hdev->core_trigger_ssr = venus_hfi_core_trigger_ssr; hdev->session_init = venus_hfi_session_init; hdev->session_end = venus_hfi_session_end; hdev->session_abort = venus_hfi_session_abort; hdev->session_clean = venus_hfi_session_clean; hdev->session_set_buffers = venus_hfi_session_set_buffers; hdev->session_release_buffers = venus_hfi_session_release_buffers; hdev->session_load_res = venus_hfi_session_load_res; hdev->session_release_res = venus_hfi_session_release_res; hdev->session_start = venus_hfi_session_start; hdev->session_stop = venus_hfi_session_stop; hdev->session_etb = venus_hfi_session_etb; hdev->session_ftb = venus_hfi_session_ftb; hdev->session_parse_seq_hdr = venus_hfi_session_parse_seq_hdr; hdev->session_get_seq_hdr = venus_hfi_session_get_seq_hdr; hdev->session_get_buf_req = venus_hfi_session_get_buf_req; hdev->session_flush = venus_hfi_session_flush; hdev->session_set_property = venus_hfi_session_set_property; hdev->session_get_property = venus_hfi_session_get_property; hdev->scale_clocks = venus_hfi_scale_clocks; hdev->vote_bus = venus_hfi_vote_buses; hdev->unvote_bus = venus_hfi_unvote_buses; hdev->iommu_get_domain_partition = venus_hfi_iommu_get_domain_partition; hdev->load_fw = venus_hfi_load_fw; hdev->unload_fw = venus_hfi_unload_fw; hdev->resurrect_fw = venus_hfi_resurrect_fw; hdev->get_fw_info = venus_hfi_get_fw_info; hdev->get_stride_scanline = venus_hfi_get_stride_scanline; hdev->get_core_capabilities = venus_hfi_get_core_capabilities; hdev->power_enable = venus_hfi_power_enable; hdev->suspend = venus_hfi_suspend; hdev->get_core_clock_rate = venus_hfi_get_core_clock_rate; } int venus_hfi_initialize(struct hfi_device *hdev, u32 device_id, struct msm_vidc_platform_resources *res, hfi_cmd_response_callback callback) { int rc = 0; if (!hdev || !res || !callback) { dprintk(VIDC_ERR, "Invalid params: %p %p %p\n", hdev, res, callback); rc = -EINVAL; goto err_venus_hfi_init; } hdev->hfi_device_data = venus_hfi_get_device(device_id, res, callback); if (IS_ERR_OR_NULL(hdev->hfi_device_data)) { rc = PTR_ERR(hdev->hfi_device_data) ?: -EINVAL; goto err_venus_hfi_init; } venus_init_hfi_callbacks(hdev); err_venus_hfi_init: return rc; }
kashifmin/KKernel_yu_msm8916
drivers/media/platform/msm/vidc/venus_hfi.c
C
gpl-2.0
110,890
/* External/Public TUI Header File. Copyright (C) 1998-2014 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. This file is part of GDB. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TUI_H #define TUI_H struct ui_file; extern void strcat_to_buf (char *, int, const char *); /* Types of error returns. */ enum tui_status { TUI_SUCCESS, TUI_FAILURE }; /* Types of windows. */ enum tui_win_type { SRC_WIN = 0, DISASSEM_WIN, DATA_WIN, CMD_WIN, /* This must ALWAYS be AFTER the major windows last. */ MAX_MAJOR_WINDOWS, /* Auxillary windows. */ LOCATOR_WIN, EXEC_INFO_WIN, DATA_ITEM_WIN, /* This must ALWAYS be next to last. */ MAX_WINDOWS, UNDEFINED_WIN /* LAST */ }; /* GENERAL TUI FUNCTIONS */ /* tui.c */ extern CORE_ADDR tui_get_low_disassembly_address (struct gdbarch *, CORE_ADDR, CORE_ADDR); extern void tui_show_assembly (struct gdbarch *gdbarch, CORE_ADDR addr); extern int tui_is_window_visible (enum tui_win_type type); extern int tui_get_command_dimension (unsigned int *width, unsigned int *height); /* Initialize readline and configure the keymap for the switching key shortcut. */ extern void tui_initialize_readline (void); /* True if enabling the TUI is allowed. Example, if the top level interpreter is MI, enabling curses will certainly lose. */ extern int tui_allowed_p (void); /* Enter in the tui mode (curses). */ extern void tui_enable (void); /* Leave the tui mode. */ extern void tui_disable (void); enum tui_key_mode { /* Plain command mode to enter gdb commands. */ TUI_COMMAND_MODE, /* SingleKey mode with some keys bound to gdb commands. */ TUI_SINGLE_KEY_MODE, /* Read/edit one command and return to SingleKey after it's processed. */ TUI_ONE_COMMAND_MODE }; extern enum tui_key_mode tui_current_key_mode; /* Change the TUI key mode by installing the appropriate readline keymap. */ extern void tui_set_key_mode (enum tui_key_mode mode); extern int tui_active; extern void tui_show_source (const char *fullname, int line); extern struct ui_out *tui_out_new (struct ui_file *stream); /* tui-layout.c */ extern enum tui_status tui_set_layout_for_display_command (const char *); #endif
zxombie/aarch64-freebsd-binutils
gdb/tui/tui.h
C
gpl-2.0
2,859
/* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright 2010 Matt Turner. * Copyright 2012 Red Hat * * Authors: Matthew Garrett * Matt Turner * Dave Airlie */ #ifndef __MGAG200_DRV_H__ #define __MGAG200_DRV_H__ #include <linux/i2c-algo-bit.h> #include <linux/i2c.h> #include <video/vga.h> #include <drm/drm_encoder.h> #include <drm/drm_fb_helper.h> #include <drm/drm_gem.h> #include <drm/drm_gem_shmem_helper.h> #include <drm/drm_simple_kms_helper.h> #include "mgag200_reg.h" #define DRIVER_AUTHOR "Matthew Garrett" #define DRIVER_NAME "mgag200" #define DRIVER_DESC "MGA G200 SE" #define DRIVER_DATE "20110418" #define DRIVER_MAJOR 1 #define DRIVER_MINOR 0 #define DRIVER_PATCHLEVEL 0 #define RREG8(reg) ioread8(((void __iomem *)mdev->rmmio) + (reg)) #define WREG8(reg, v) iowrite8(v, ((void __iomem *)mdev->rmmio) + (reg)) #define RREG32(reg) ioread32(((void __iomem *)mdev->rmmio) + (reg)) #define WREG32(reg, v) iowrite32(v, ((void __iomem *)mdev->rmmio) + (reg)) #define MGA_BIOS_OFFSET 0x7ffc #define ATTR_INDEX 0x1fc0 #define ATTR_DATA 0x1fc1 #define WREG_MISC(v) \ WREG8(MGA_MISC_OUT, v) #define RREG_MISC(v) \ ((v) = RREG8(MGA_MISC_IN)) #define WREG_MISC_MASKED(v, mask) \ do { \ u8 misc_; \ u8 mask_ = (mask); \ RREG_MISC(misc_); \ misc_ &= ~mask_; \ misc_ |= ((v) & mask_); \ WREG_MISC(misc_); \ } while (0) #define WREG_ATTR(reg, v) \ do { \ RREG8(0x1fda); \ WREG8(ATTR_INDEX, reg); \ WREG8(ATTR_DATA, v); \ } while (0) \ #define RREG_SEQ(reg, v) \ do { \ WREG8(MGAREG_SEQ_INDEX, reg); \ v = RREG8(MGAREG_SEQ_DATA); \ } while (0) \ #define WREG_SEQ(reg, v) \ do { \ WREG8(MGAREG_SEQ_INDEX, reg); \ WREG8(MGAREG_SEQ_DATA, v); \ } while (0) \ #define RREG_CRT(reg, v) \ do { \ WREG8(MGAREG_CRTC_INDEX, reg); \ v = RREG8(MGAREG_CRTC_DATA); \ } while (0) \ #define WREG_CRT(reg, v) \ do { \ WREG8(MGAREG_CRTC_INDEX, reg); \ WREG8(MGAREG_CRTC_DATA, v); \ } while (0) \ #define RREG_ECRT(reg, v) \ do { \ WREG8(MGAREG_CRTCEXT_INDEX, reg); \ v = RREG8(MGAREG_CRTCEXT_DATA); \ } while (0) \ #define WREG_ECRT(reg, v) \ do { \ WREG8(MGAREG_CRTCEXT_INDEX, reg); \ WREG8(MGAREG_CRTCEXT_DATA, v); \ } while (0) \ #define GFX_INDEX 0x1fce #define GFX_DATA 0x1fcf #define WREG_GFX(reg, v) \ do { \ WREG8(GFX_INDEX, reg); \ WREG8(GFX_DATA, v); \ } while (0) \ #define DAC_INDEX 0x3c00 #define DAC_DATA 0x3c0a #define WREG_DAC(reg, v) \ do { \ WREG8(DAC_INDEX, reg); \ WREG8(DAC_DATA, v); \ } while (0) \ #define MGA_MISC_OUT 0x1fc2 #define MGA_MISC_IN 0x1fcc #define MGAG200_MAX_FB_HEIGHT 4096 #define MGAG200_MAX_FB_WIDTH 4096 struct mga_device; struct mgag200_pll; /* * Stores parameters for programming the PLLs * * Fref: reference frequency (A: 25.175 Mhz, B: 28.361, C: XX Mhz) * Fo: output frequency * Fvco = Fref * (N / M) * Fo = Fvco / P * * S = [0..3] */ struct mgag200_pll_values { unsigned int m; unsigned int n; unsigned int p; unsigned int s; }; struct mgag200_pll_funcs { int (*compute)(struct mgag200_pll *pll, long clock, struct mgag200_pll_values *pllc); void (*update)(struct mgag200_pll *pll, const struct mgag200_pll_values *pllc); }; struct mgag200_pll { struct mga_device *mdev; const struct mgag200_pll_funcs *funcs; }; struct mgag200_crtc_state { struct drm_crtc_state base; struct mgag200_pll_values pixpllc; }; static inline struct mgag200_crtc_state *to_mgag200_crtc_state(struct drm_crtc_state *base) { return container_of(base, struct mgag200_crtc_state, base); } #define to_mga_connector(x) container_of(x, struct mga_connector, base) struct mga_i2c_chan { struct i2c_adapter adapter; struct drm_device *dev; struct i2c_algo_bit_data bit; int data, clock; }; struct mga_connector { struct drm_connector base; struct mga_i2c_chan *i2c; }; struct mga_mc { resource_size_t vram_size; resource_size_t vram_base; resource_size_t vram_window; }; enum mga_type { G200_PCI, G200_AGP, G200_SE_A, G200_SE_B, G200_WB, G200_EV, G200_EH, G200_EH3, G200_ER, G200_EW3, }; /* HW does not handle 'startadd' field correct. */ #define MGAG200_FLAG_HW_BUG_NO_STARTADD (1ul << 8) #define MGAG200_TYPE_MASK (0x000000ff) #define MGAG200_FLAG_MASK (0x00ffff00) #define IS_G200_SE(mdev) (mdev->type == G200_SE_A || mdev->type == G200_SE_B) struct mga_device { struct drm_device base; unsigned long flags; resource_size_t rmmio_base; resource_size_t rmmio_size; void __iomem *rmmio; struct mga_mc mc; void __iomem *vram; size_t vram_fb_available; enum mga_type type; int fb_mtrr; union { struct { long ref_clk; long pclk_min; long pclk_max; } g200; struct { /* SE model number stored in reg 0x1e24 */ u32 unique_rev_id; } g200se; } model; struct mga_connector connector; struct mgag200_pll pixpll; struct drm_simple_display_pipe display_pipe; }; static inline struct mga_device *to_mga_device(struct drm_device *dev) { return container_of(dev, struct mga_device, base); } /* mgag200_mode.c */ int mgag200_modeset_init(struct mga_device *mdev); /* mgag200_i2c.c */ struct mga_i2c_chan *mgag200_i2c_create(struct drm_device *dev); void mgag200_i2c_destroy(struct mga_i2c_chan *i2c); /* mgag200_mm.c */ int mgag200_mm_init(struct mga_device *mdev); /* mgag200_pll.c */ int mgag200_pixpll_init(struct mgag200_pll *pixpll, struct mga_device *mdev); #endif /* __MGAG200_DRV_H__ */
tprrt/linux-stable
drivers/gpu/drm/mgag200/mgag200_drv.h
C
gpl-2.0
5,670
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ // vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4: #ident "$Id$" /*====== This file is part of PerconaFT. Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. PerconaFT is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. PerconaFT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. ---------------------------------------- PerconaFT is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. PerconaFT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. ======= */ #ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved." #include "test.h" /* Like test_log3 except do abort */ #include <db.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <memory.h> // TOKU_TEST_FILENAME is defined in the Makefile static void make_db (void) { DB_ENV *env; DB *db; DB_TXN *tid; int r; toku_os_recursive_delete(TOKU_TEST_FILENAME); r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=db_env_create(&env, 0); assert(r==0); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=db_create(&db, env, 0); CKERR(r); r=env->txn_begin(env, 0, &tid, 0); assert(r==0); r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=tid->commit(tid, 0); assert(r==0); r=env->txn_begin(env, 0, &tid, 0); assert(r==0); { DBT key,data; dbt_init(&key, "hello", sizeof "hello"); dbt_init(&data, "there", sizeof "there"); r=db->put(db, tid, &key, &data, 0); assert(r==0); } r=tid->abort(tid); assert(r==0); // Now see that the string isn't there. { DBT key,data; dbt_init(&key, "hello", sizeof "hello"); dbt_init(&data, NULL, 0); r=db->get(db, 0, &key, &data, 0); assert(r==DB_NOTFOUND); } r=db->close(db, 0); assert(r==0); r=env->close(env, 0); assert(r==0); } int test_main (int argc __attribute__((__unused__)), char *const argv[] __attribute__((__unused__))) { make_db(); return 0; }
cvicentiu/mariadb-10.0
storage/tokudb/PerconaFT/src/tests/test_log3_abort.cc
C++
gpl-2.0
3,145
<?php /** * File cache cleaner class */ if (!defined('ABSPATH')) { die(); } w3_require_once(W3TC_LIB_W3_DIR . '/Cache/File.php'); /** * Class W3_Cache_File_Cleaner */ class W3_Cache_File_Cleaner { /** * Cache directory * * @var string */ var $_cache_dir = ''; /** * Clean operation time limit * * @var int */ var $_clean_timelimit = 0; /** * Exclude files * * @var array */ var $_exclude = array(); /** * PHP5-style constructor * * @param array $config */ function __construct($config = array()) { $this->_cache_dir = (isset($config['cache_dir']) ? trim($config['cache_dir']) : 'cache'); $this->_clean_timelimit = (isset($config['clean_timelimit']) ? (int) $config['clean_timelimit'] : 180); $this->_exclude = (isset($config['exclude']) ? (array) $config['exclude'] : array()); } /** * Run clean operation * * @return boolean */ function clean() { @set_time_limit($this->_clean_timelimit); $this->_clean($this->_cache_dir, false); } /** * Clean * * @param string $path * @param bool $remove * @return void */ function _clean($path, $remove = true) { $dir = @opendir($path); if ($dir) { while (($entry = @readdir($dir)) !== false) { if ($entry == '.' || $entry == '..') { continue; } foreach ($this->_exclude as $mask) { if (fnmatch($mask, basename($entry))) { continue 2; } } $full_path = $path . DIRECTORY_SEPARATOR . $entry; if (@is_dir($full_path)) { $this->_clean($full_path); } elseif (!$this->is_valid($full_path)) { @unlink($full_path); } } @closedir($dir); if ($remove) { @rmdir($path); } } } /** * Check if file is valid * * @param string $file * @return bool */ function is_valid($file) { $valid = false; if (file_exists($file)) { $ftime = @filemtime($file); if ($ftime) { $fp = @fopen($file, 'rb'); if ($fp) { $expires = @fread($fp, 4); if ($expires !== false) { list(, $expire) = @unpack('L', $expires); $expire = ($expire && $expire <= W3TC_CACHE_FILE_EXPIRE_MAX ? $expire : W3TC_CACHE_FILE_EXPIRE_MAX); if ($ftime > (time() - $expire)) { $valid = true; } } @fclose($fp); } } } return $valid; } }
Hagaren64/jtdev
wp-content/plugins/w3-total-cache/lib/W3/Cache/File/Cleaner.php
PHP
gpl-2.0
3,114
// STLport configuration file // It is internal STLport header - DO NOT include it directly // AS/400 C++ config # ifdef _REENTRANT # define _PTHREADS # endif # define _STLP_NO_NEW_NEW_HEADER 1 # define _STLP_NO_BOOL # define _STLP_LIMITED_DEFAULT_TEMPLATES # define _STLP_HAS_NO_NAMESPACES # define _STLP_NEED_TYPENAME # define _STLP_NEED_EXPLICIT # define _STLP_HAS_NO_EXCEPTIONS # define _STLP_NO_EXCEPTION_SPEC # define _STLP_NO_ARROW_OPERATOR # define _STLP_NO_NEW_STYLE_CASTS # define _STLP_NEED_MUTABLE # define _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX # define _STLP_NO_BAD_ALLOC # define _STLP_NO_MEMBER_TEMPLATES # define _STLP_NO_MEMBER_TEMPLATE_CLASSES # define _STLP_NO_MEMBER_TEMPLATE_KEYWORD # define _STLP_NO_FRIEND_TEMPLATES # define _STLP_NO_QUALIFIED_FRIENDS # define _STLP_NO_CLASS_PARTIAL_SPECIALIZATION # define _STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER # define _STLP_NO_METHOD_SPECIALIZATION # define _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS // # define _STLP_NO_EXCEPTION_HEADER # define _STLP_HAS_NO_NEW_C_HEADERS # define _STLP_STATIC_CONST_INIT_BUG # define _STLP_THROW_RETURN_BUG # define _STLP_LINK_TIME_INSTANTIATION # define _STLP_NO_TEMPLATE_CONVERSIONS # define _STLP_NON_TYPE_TMPL_PARAM_BUG 1 # define _STLP_TRIVIAL_DESTRUCTOR_BUG 1 # if defined(_LONG_LONG) # define _STLP_LONG_LONG long long # endif # if defined(_PTHREADS) # define _MULTI_THREADED # endif // fbp : to fix __partition() problem # define _STLP_NONTEMPL_BASE_MATCH_BUG 1
yeKcim/warmux
trunk/build/symbian/lib/stlport/stlport/stl/config/_as400.h
C
gpl-2.0
1,515
// errchk $G $D/$F.go // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main type T struct { x, x int // ERROR "duplicate" }
SanDisk-Open-Source/SSD_Dashboard
uefi/gcc/gcc-4.6.3/gcc/testsuite/go.test/test/fixedbugs/bug132.go
GO
gpl-2.0
247
// SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 2017 - 2018 Intel Corporation. */ #include <asm/barrier.h> #include <errno.h> #include <getopt.h> #include <libgen.h> #include <linux/bpf.h> #include <linux/compiler.h> #include <linux/if_link.h> #include <linux/if_xdp.h> #include <linux/if_ether.h> #include <locale.h> #include <net/ethernet.h> #include <net/if.h> #include <poll.h> #include <pthread.h> #include <signal.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/mman.h> #include <sys/resource.h> #include <sys/socket.h> #include <sys/types.h> #include <time.h> #include <unistd.h> #include "bpf/libbpf.h" #include "bpf/xsk.h" #include <bpf/bpf.h> #ifndef SOL_XDP #define SOL_XDP 283 #endif #ifndef AF_XDP #define AF_XDP 44 #endif #ifndef PF_XDP #define PF_XDP AF_XDP #endif #define NUM_FRAMES (4 * 1024) #define BATCH_SIZE 64 #define DEBUG_HEXDUMP 0 #define MAX_SOCKS 8 typedef __u64 u64; typedef __u32 u32; static unsigned long prev_time; enum benchmark_type { BENCH_RXDROP = 0, BENCH_TXONLY = 1, BENCH_L2FWD = 2, }; static enum benchmark_type opt_bench = BENCH_RXDROP; static u32 opt_xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST; static const char *opt_if = ""; static int opt_ifindex; static int opt_queue; static int opt_poll; static int opt_interval = 1; static u32 opt_xdp_bind_flags; static __u32 prog_id; struct xsk_umem_info { struct xsk_ring_prod fq; struct xsk_ring_cons cq; struct xsk_umem *umem; void *buffer; }; struct xsk_socket_info { struct xsk_ring_cons rx; struct xsk_ring_prod tx; struct xsk_umem_info *umem; struct xsk_socket *xsk; unsigned long rx_npkts; unsigned long tx_npkts; unsigned long prev_rx_npkts; unsigned long prev_tx_npkts; u32 outstanding_tx; }; static int num_socks; struct xsk_socket_info *xsks[MAX_SOCKS]; static unsigned long get_nsecs(void) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); return ts.tv_sec * 1000000000UL + ts.tv_nsec; } static void print_benchmark(bool running) { const char *bench_str = "INVALID"; if (opt_bench == BENCH_RXDROP) bench_str = "rxdrop"; else if (opt_bench == BENCH_TXONLY) bench_str = "txonly"; else if (opt_bench == BENCH_L2FWD) bench_str = "l2fwd"; printf("%s:%d %s ", opt_if, opt_queue, bench_str); if (opt_xdp_flags & XDP_FLAGS_SKB_MODE) printf("xdp-skb "); else if (opt_xdp_flags & XDP_FLAGS_DRV_MODE) printf("xdp-drv "); else printf(" "); if (opt_poll) printf("poll() "); if (running) { printf("running..."); fflush(stdout); } } static void dump_stats(void) { unsigned long now = get_nsecs(); long dt = now - prev_time; int i; prev_time = now; for (i = 0; i < num_socks && xsks[i]; i++) { char *fmt = "%-15s %'-11.0f %'-11lu\n"; double rx_pps, tx_pps; rx_pps = (xsks[i]->rx_npkts - xsks[i]->prev_rx_npkts) * 1000000000. / dt; tx_pps = (xsks[i]->tx_npkts - xsks[i]->prev_tx_npkts) * 1000000000. / dt; printf("\n sock%d@", i); print_benchmark(false); printf("\n"); printf("%-15s %-11s %-11s %-11.2f\n", "", "pps", "pkts", dt / 1000000000.); printf(fmt, "rx", rx_pps, xsks[i]->rx_npkts); printf(fmt, "tx", tx_pps, xsks[i]->tx_npkts); xsks[i]->prev_rx_npkts = xsks[i]->rx_npkts; xsks[i]->prev_tx_npkts = xsks[i]->tx_npkts; } } static void *poller(void *arg) { (void)arg; for (;;) { sleep(opt_interval); dump_stats(); } return NULL; } static void remove_xdp_program(void) { __u32 curr_prog_id = 0; if (bpf_get_link_xdp_id(opt_ifindex, &curr_prog_id, opt_xdp_flags)) { printf("bpf_get_link_xdp_id failed\n"); exit(EXIT_FAILURE); } if (prog_id == curr_prog_id) bpf_set_link_xdp_fd(opt_ifindex, -1, opt_xdp_flags); else if (!curr_prog_id) printf("couldn't find a prog id on a given interface\n"); else printf("program on interface changed, not removing\n"); } static void int_exit(int sig) { struct xsk_umem *umem = xsks[0]->umem->umem; (void)sig; dump_stats(); xsk_socket__delete(xsks[0]->xsk); (void)xsk_umem__delete(umem); remove_xdp_program(); exit(EXIT_SUCCESS); } static void __exit_with_error(int error, const char *file, const char *func, int line) { fprintf(stderr, "%s:%s:%i: errno: %d/\"%s\"\n", file, func, line, error, strerror(error)); dump_stats(); remove_xdp_program(); exit(EXIT_FAILURE); } #define exit_with_error(error) __exit_with_error(error, __FILE__, __func__, \ __LINE__) static const char pkt_data[] = "\x3c\xfd\xfe\x9e\x7f\x71\xec\xb1\xd7\x98\x3a\xc0\x08\x00\x45\x00" "\x00\x2e\x00\x00\x00\x00\x40\x11\x88\x97\x05\x08\x07\x08\xc8\x14" "\x1e\x04\x10\x92\x10\x92\x00\x1a\x6d\xa3\x34\x33\x1f\x69\x40\x6b" "\x54\x59\xb6\x14\x2d\x11\x44\xbf\xaf\xd9\xbe\xaa"; static void swap_mac_addresses(void *data) { struct ether_header *eth = (struct ether_header *)data; struct ether_addr *src_addr = (struct ether_addr *)&eth->ether_shost; struct ether_addr *dst_addr = (struct ether_addr *)&eth->ether_dhost; struct ether_addr tmp; tmp = *src_addr; *src_addr = *dst_addr; *dst_addr = tmp; } static void hex_dump(void *pkt, size_t length, u64 addr) { const unsigned char *address = (unsigned char *)pkt; const unsigned char *line = address; size_t line_size = 32; unsigned char c; char buf[32]; int i = 0; if (!DEBUG_HEXDUMP) return; sprintf(buf, "addr=%llu", addr); printf("length = %zu\n", length); printf("%s | ", buf); while (length-- > 0) { printf("%02X ", *address++); if (!(++i % line_size) || (length == 0 && i % line_size)) { if (length == 0) { while (i++ % line_size) printf("__ "); } printf(" | "); /* right close */ while (line < address) { c = *line++; printf("%c", (c < 33 || c == 255) ? 0x2E : c); } printf("\n"); if (length > 0) printf("%s | ", buf); } } printf("\n"); } static size_t gen_eth_frame(struct xsk_umem_info *umem, u64 addr) { memcpy(xsk_umem__get_data(umem->buffer, addr), pkt_data, sizeof(pkt_data) - 1); return sizeof(pkt_data) - 1; } static struct xsk_umem_info *xsk_configure_umem(void *buffer, u64 size) { struct xsk_umem_info *umem; int ret; umem = calloc(1, sizeof(*umem)); if (!umem) exit_with_error(errno); ret = xsk_umem__create(&umem->umem, buffer, size, &umem->fq, &umem->cq, NULL); if (ret) exit_with_error(-ret); umem->buffer = buffer; return umem; } static struct xsk_socket_info *xsk_configure_socket(struct xsk_umem_info *umem) { struct xsk_socket_config cfg; struct xsk_socket_info *xsk; int ret; u32 idx; int i; xsk = calloc(1, sizeof(*xsk)); if (!xsk) exit_with_error(errno); xsk->umem = umem; cfg.rx_size = XSK_RING_CONS__DEFAULT_NUM_DESCS; cfg.tx_size = XSK_RING_PROD__DEFAULT_NUM_DESCS; cfg.libbpf_flags = 0; cfg.xdp_flags = opt_xdp_flags; cfg.bind_flags = opt_xdp_bind_flags; ret = xsk_socket__create(&xsk->xsk, opt_if, opt_queue, umem->umem, &xsk->rx, &xsk->tx, &cfg); if (ret) exit_with_error(-ret); ret = bpf_get_link_xdp_id(opt_ifindex, &prog_id, opt_xdp_flags); if (ret) exit_with_error(-ret); ret = xsk_ring_prod__reserve(&xsk->umem->fq, XSK_RING_PROD__DEFAULT_NUM_DESCS, &idx); if (ret != XSK_RING_PROD__DEFAULT_NUM_DESCS) exit_with_error(-ret); for (i = 0; i < XSK_RING_PROD__DEFAULT_NUM_DESCS * XSK_UMEM__DEFAULT_FRAME_SIZE; i += XSK_UMEM__DEFAULT_FRAME_SIZE) *xsk_ring_prod__fill_addr(&xsk->umem->fq, idx++) = i; xsk_ring_prod__submit(&xsk->umem->fq, XSK_RING_PROD__DEFAULT_NUM_DESCS); return xsk; } static struct option long_options[] = { {"rxdrop", no_argument, 0, 'r'}, {"txonly", no_argument, 0, 't'}, {"l2fwd", no_argument, 0, 'l'}, {"interface", required_argument, 0, 'i'}, {"queue", required_argument, 0, 'q'}, {"poll", no_argument, 0, 'p'}, {"xdp-skb", no_argument, 0, 'S'}, {"xdp-native", no_argument, 0, 'N'}, {"interval", required_argument, 0, 'n'}, {"zero-copy", no_argument, 0, 'z'}, {"copy", no_argument, 0, 'c'}, {0, 0, 0, 0} }; static void usage(const char *prog) { const char *str = " Usage: %s [OPTIONS]\n" " Options:\n" " -r, --rxdrop Discard all incoming packets (default)\n" " -t, --txonly Only send packets\n" " -l, --l2fwd MAC swap L2 forwarding\n" " -i, --interface=n Run on interface n\n" " -q, --queue=n Use queue n (default 0)\n" " -p, --poll Use poll syscall\n" " -S, --xdp-skb=n Use XDP skb-mod\n" " -N, --xdp-native=n Enfore XDP native mode\n" " -n, --interval=n Specify statistics update interval (default 1 sec).\n" " -z, --zero-copy Force zero-copy mode.\n" " -c, --copy Force copy mode.\n" "\n"; fprintf(stderr, str, prog); exit(EXIT_FAILURE); } static void parse_command_line(int argc, char **argv) { int option_index, c; opterr = 0; for (;;) { c = getopt_long(argc, argv, "Frtli:q:psSNn:cz", long_options, &option_index); if (c == -1) break; switch (c) { case 'r': opt_bench = BENCH_RXDROP; break; case 't': opt_bench = BENCH_TXONLY; break; case 'l': opt_bench = BENCH_L2FWD; break; case 'i': opt_if = optarg; break; case 'q': opt_queue = atoi(optarg); break; case 'p': opt_poll = 1; break; case 'S': opt_xdp_flags |= XDP_FLAGS_SKB_MODE; opt_xdp_bind_flags |= XDP_COPY; break; case 'N': opt_xdp_flags |= XDP_FLAGS_DRV_MODE; break; case 'n': opt_interval = atoi(optarg); break; case 'z': opt_xdp_bind_flags |= XDP_ZEROCOPY; break; case 'c': opt_xdp_bind_flags |= XDP_COPY; break; case 'F': opt_xdp_flags &= ~XDP_FLAGS_UPDATE_IF_NOEXIST; break; default: usage(basename(argv[0])); } } opt_ifindex = if_nametoindex(opt_if); if (!opt_ifindex) { fprintf(stderr, "ERROR: interface \"%s\" does not exist\n", opt_if); usage(basename(argv[0])); } } static void kick_tx(struct xsk_socket_info *xsk) { int ret; ret = sendto(xsk_socket__fd(xsk->xsk), NULL, 0, MSG_DONTWAIT, NULL, 0); if (ret >= 0 || errno == ENOBUFS || errno == EAGAIN || errno == EBUSY) return; exit_with_error(errno); } static inline void complete_tx_l2fwd(struct xsk_socket_info *xsk) { u32 idx_cq = 0, idx_fq = 0; unsigned int rcvd; size_t ndescs; if (!xsk->outstanding_tx) return; kick_tx(xsk); ndescs = (xsk->outstanding_tx > BATCH_SIZE) ? BATCH_SIZE : xsk->outstanding_tx; /* re-add completed Tx buffers */ rcvd = xsk_ring_cons__peek(&xsk->umem->cq, ndescs, &idx_cq); if (rcvd > 0) { unsigned int i; int ret; ret = xsk_ring_prod__reserve(&xsk->umem->fq, rcvd, &idx_fq); while (ret != rcvd) { if (ret < 0) exit_with_error(-ret); ret = xsk_ring_prod__reserve(&xsk->umem->fq, rcvd, &idx_fq); } for (i = 0; i < rcvd; i++) *xsk_ring_prod__fill_addr(&xsk->umem->fq, idx_fq++) = *xsk_ring_cons__comp_addr(&xsk->umem->cq, idx_cq++); xsk_ring_prod__submit(&xsk->umem->fq, rcvd); xsk_ring_cons__release(&xsk->umem->cq, rcvd); xsk->outstanding_tx -= rcvd; xsk->tx_npkts += rcvd; } } static inline void complete_tx_only(struct xsk_socket_info *xsk) { unsigned int rcvd; u32 idx; if (!xsk->outstanding_tx) return; kick_tx(xsk); rcvd = xsk_ring_cons__peek(&xsk->umem->cq, BATCH_SIZE, &idx); if (rcvd > 0) { xsk_ring_cons__release(&xsk->umem->cq, rcvd); xsk->outstanding_tx -= rcvd; xsk->tx_npkts += rcvd; } } static void rx_drop(struct xsk_socket_info *xsk) { unsigned int rcvd, i; u32 idx_rx = 0, idx_fq = 0; int ret; rcvd = xsk_ring_cons__peek(&xsk->rx, BATCH_SIZE, &idx_rx); if (!rcvd) return; ret = xsk_ring_prod__reserve(&xsk->umem->fq, rcvd, &idx_fq); while (ret != rcvd) { if (ret < 0) exit_with_error(-ret); ret = xsk_ring_prod__reserve(&xsk->umem->fq, rcvd, &idx_fq); } for (i = 0; i < rcvd; i++) { u64 addr = xsk_ring_cons__rx_desc(&xsk->rx, idx_rx)->addr; u32 len = xsk_ring_cons__rx_desc(&xsk->rx, idx_rx++)->len; char *pkt = xsk_umem__get_data(xsk->umem->buffer, addr); hex_dump(pkt, len, addr); *xsk_ring_prod__fill_addr(&xsk->umem->fq, idx_fq++) = addr; } xsk_ring_prod__submit(&xsk->umem->fq, rcvd); xsk_ring_cons__release(&xsk->rx, rcvd); xsk->rx_npkts += rcvd; } static void rx_drop_all(void) { struct pollfd fds[MAX_SOCKS + 1]; int i, ret, timeout, nfds = 1; memset(fds, 0, sizeof(fds)); for (i = 0; i < num_socks; i++) { fds[i].fd = xsk_socket__fd(xsks[i]->xsk); fds[i].events = POLLIN; timeout = 1000; /* 1sn */ } for (;;) { if (opt_poll) { ret = poll(fds, nfds, timeout); if (ret <= 0) continue; } for (i = 0; i < num_socks; i++) rx_drop(xsks[i]); } } static void tx_only(struct xsk_socket_info *xsk) { int timeout, ret, nfds = 1; struct pollfd fds[nfds + 1]; u32 idx, frame_nb = 0; memset(fds, 0, sizeof(fds)); fds[0].fd = xsk_socket__fd(xsk->xsk); fds[0].events = POLLOUT; timeout = 1000; /* 1sn */ for (;;) { if (opt_poll) { ret = poll(fds, nfds, timeout); if (ret <= 0) continue; if (!(fds[0].revents & POLLOUT)) continue; } if (xsk_ring_prod__reserve(&xsk->tx, BATCH_SIZE, &idx) == BATCH_SIZE) { unsigned int i; for (i = 0; i < BATCH_SIZE; i++) { xsk_ring_prod__tx_desc(&xsk->tx, idx + i)->addr = (frame_nb + i) << XSK_UMEM__DEFAULT_FRAME_SHIFT; xsk_ring_prod__tx_desc(&xsk->tx, idx + i)->len = sizeof(pkt_data) - 1; } xsk_ring_prod__submit(&xsk->tx, BATCH_SIZE); xsk->outstanding_tx += BATCH_SIZE; frame_nb += BATCH_SIZE; frame_nb %= NUM_FRAMES; } complete_tx_only(xsk); } } static void l2fwd(struct xsk_socket_info *xsk) { for (;;) { unsigned int rcvd, i; u32 idx_rx = 0, idx_tx = 0; int ret; for (;;) { complete_tx_l2fwd(xsk); rcvd = xsk_ring_cons__peek(&xsk->rx, BATCH_SIZE, &idx_rx); if (rcvd > 0) break; } ret = xsk_ring_prod__reserve(&xsk->tx, rcvd, &idx_tx); while (ret != rcvd) { if (ret < 0) exit_with_error(-ret); ret = xsk_ring_prod__reserve(&xsk->tx, rcvd, &idx_tx); } for (i = 0; i < rcvd; i++) { u64 addr = xsk_ring_cons__rx_desc(&xsk->rx, idx_rx)->addr; u32 len = xsk_ring_cons__rx_desc(&xsk->rx, idx_rx++)->len; char *pkt = xsk_umem__get_data(xsk->umem->buffer, addr); swap_mac_addresses(pkt); hex_dump(pkt, len, addr); xsk_ring_prod__tx_desc(&xsk->tx, idx_tx)->addr = addr; xsk_ring_prod__tx_desc(&xsk->tx, idx_tx++)->len = len; } xsk_ring_prod__submit(&xsk->tx, rcvd); xsk_ring_cons__release(&xsk->rx, rcvd); xsk->rx_npkts += rcvd; xsk->outstanding_tx += rcvd; } } int main(int argc, char **argv) { struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; struct xsk_umem_info *umem; pthread_t pt; void *bufs; int ret; parse_command_line(argc, argv); if (setrlimit(RLIMIT_MEMLOCK, &r)) { fprintf(stderr, "ERROR: setrlimit(RLIMIT_MEMLOCK) \"%s\"\n", strerror(errno)); exit(EXIT_FAILURE); } ret = posix_memalign(&bufs, getpagesize(), /* PAGE_SIZE aligned */ NUM_FRAMES * XSK_UMEM__DEFAULT_FRAME_SIZE); if (ret) exit_with_error(ret); /* Create sockets... */ umem = xsk_configure_umem(bufs, NUM_FRAMES * XSK_UMEM__DEFAULT_FRAME_SIZE); xsks[num_socks++] = xsk_configure_socket(umem); if (opt_bench == BENCH_TXONLY) { int i; for (i = 0; i < NUM_FRAMES * XSK_UMEM__DEFAULT_FRAME_SIZE; i += XSK_UMEM__DEFAULT_FRAME_SIZE) (void)gen_eth_frame(umem, i); } signal(SIGINT, int_exit); signal(SIGTERM, int_exit); signal(SIGABRT, int_exit); setlocale(LC_ALL, ""); ret = pthread_create(&pt, NULL, poller, NULL); if (ret) exit_with_error(ret); prev_time = get_nsecs(); if (opt_bench == BENCH_RXDROP) rx_drop_all(); else if (opt_bench == BENCH_TXONLY) tx_only(xsks[0]); else l2fwd(xsks[0]); return 0; }
gazoo74/linux
samples/bpf/xdpsock_user.c
C
gpl-2.0
15,696
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Example - example-ng-class1-jquery</title> <link href="style.css" rel="stylesheet" type="text/css"> <script src="../../components/jquery-3.2.1/jquery.js"></script> <script src="../../../angular.js"></script> <script src="../../../angular-animate.js"></script> </head> <body ng-app="ngAnimate"> <input id="setbtn" type="button" value="set" ng-click="myVar='my-class'"> <input id="clearbtn" type="button" value="clear" ng-click="myVar=''"> <br> <span class="base-class" ng-class="myVar">Sample Text</span> </body> </html>
LearnNavi/Naranawm
www/assets/library/angular-1.6.5/docs/examples/example-ng-class1/index-jquery.html
HTML
agpl-3.0
614
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.elasticsearch.analysis.common; import org.apache.lucene.analysis.CharArraySet; import org.apache.lucene.analysis.ru.RussianAnalyzer; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.env.Environment; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.analysis.AbstractIndexAnalyzerProvider; import org.elasticsearch.index.analysis.Analysis; public class RussianAnalyzerProvider extends AbstractIndexAnalyzerProvider<RussianAnalyzer> { private final RussianAnalyzer analyzer; RussianAnalyzerProvider(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, name, settings); analyzer = new RussianAnalyzer( Analysis.parseStopWords(env, settings, RussianAnalyzer.getDefaultStopSet()), Analysis.parseStemExclusion(settings, CharArraySet.EMPTY_SET) ); analyzer.setVersion(version); } @Override public RussianAnalyzer get() { return this.analyzer; } }
EvilMcJerkface/crate
plugins/es-analysis-common/src/main/java/org/elasticsearch/analysis/common/RussianAnalyzerProvider.java
Java
apache-2.0
1,837
不,Linux 桌面版并没有突然流行起来 ============================================================ > 最近流传着这样一个传闻,Linux 桌面版已经突然流行起来了,并且使用者超过了 macOS。其实,并不是的。 有一些传闻说,Linux 桌面版的市场占有率从通常的 1.5% - 3% 翻了一番,达到 5%。那些报道是基于 [NetMarketShare][4] 的桌面操作系统分析报告而来的,据其显示,在七月份,Linux 桌面版的市场占有率从 2.5% 飙升,在九月份几乎达到 5%。但对 Linux 爱好者来说,很不幸,它并不是真的。 它也不是因为加入了谷歌推出的 Chrome OS,它在 [NetMarketShare][4] 和 [StatCounter][5] 的桌面操作系统的数据中被低估,它被认为是 Linux。但请注意,那是公正的,因为 [Chrome OS 是基于 Linux 的][6]。 真正的解释要简单的多。这似乎只是一个错误。NetMarketShare 的市场营销高管 Vince Vizzaccaro 告诉我,“Linux 份额是不正确的。我们意识到这个问题,目前正在调查此事”。 如果这听起来很奇怪,那是因为你可能认为,NetMarketShare 和 StatCounter 只是计算用户数量。但他们不是这样的。相反,他们都使用自己的秘密的方法去统计这些操作系统的数据。 NetMarketShare 的方法是对 “[从网站访问者的浏览器中收集数据][7]到我们专用的请求式 HitsLink 分析网络中和 SharePost 客户端。该网络包括超过 4 万个网站,遍布全球。我们‘计数’访问我们的网络站点的唯一访客,并且一个唯一访客每天每个网络站点只计数一次。” 然后,公司按国家对数据进行加权。“我们将我们的流量与 CIA 互联网流量按国家进行比较,并相应地对我们的数据进行加权。例如,如果我们的全球数据显示巴西占我们网络流量的 2%,而 CIA 的数据显示巴西占全球互联网流量的 4%,那么我们将统计每一个来自巴西的唯一访客两次。” 他们究竟如何 “权衡” 每天访问一个站点的数据?我们不知道。 StatCounter 也有自己的方法。它使用 “[在全球超过 200 万个站点上安装的跟踪代码][8]。这些网站涵盖了各种类型和不同的地理位置。每个月,我们都会记录在这些站点上的数十亿页的页面访问。对于每个页面访问,我们分析其使用的浏览器/操作系统/屏幕分辨率(如果页面访问来自移动设备)。 ... 我们统计了所有这些数据以获取我们的全球统计信息。 我们为互联网使用趋势提供独立的、公正的统计数据。我们不与任何其他信息源核对我们的统计数据,也 [没有使用人为加权][9]。” 他们如何汇总他们的数据?你猜猜看?其它我们也不知道。 因此,无论何时,你看到的他们这些经常被引用的操作系统或浏览器的数字,使用它们要有很大的保留余地。 对于更精确的,以美国为对象的操作系统和浏览器数量,我更喜欢使用联邦政府的 [数字分析计划(DAP)][10]。 与其它的不同, DAP 的数字来自在过去的 90 天访问过 [400 个美国政府行政机构域名][11] 的数十亿访问者。那里有 [大概 5000 个网站][12],并且包含每个内阁部门。 DAP 从一个谷歌分析帐户中得到原始数据。 DAP [开源了它在这个网站上显示其数据的代码][13] 以及它的 [数据收集代码][14]。最重要的是,与其它的不同,你可以以 [JSON][15] 格式下载它的数据,这样你就可以自己分析原始数据了。 在 [美国分析][16] 网站上,它汇总了 DAP 的数据,你可以找到 Linux 桌面版,和往常一样,它仍以 1.5% 列在 “其它” 中。Windows 仍然是高达 45.9%,接下来是 Apple iOS,占 25.5%,Android 占 18.6%,而 macOS 占 8.5%。 对不起,伙计们,我也希望它更高,但是,这就是事实。没有人,即使是 DAP,似乎都无法很好地将基于 Linux 的 Chrome OS 数据单列出来。尽管如此,Linux 桌面版仍然是 Linux 高手、软件开发者、系统管理员和工程师的专利。Linux 爱好者们还只能对其它所有的计算机设备 —— 服务器、云、超级计算机等等的(Linux)操作系统表示自豪。 -------------------------------------------------------------------------------- via: http://www.zdnet.com/article/no-the-linux-desktop-hasnt-jumped-in-popularity/ 作者:[Steven J. Vaughan-Nichols][a] 译者:[qhwdw](https://github.com/qhwdw) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://www.zdnet.com/meet-the-team/us/steven-j-vaughan-nichols/ [1]:http://www.zdnet.com/article/the-tension-between-iot-and-erp/ [2]:http://www.zdnet.com/article/the-tension-between-iot-and-erp/ [3]:http://www.zdnet.com/article/the-tension-between-iot-and-erp/ [4]:https://www.netmarketshare.com/ [5]:https://statcounter.com/ [6]:http://www.zdnet.com/article/the-secret-origins-of-googles-chrome-os/ [7]:http://www.netmarketshare.com/faq.aspx#Methodology [8]:http://gs.statcounter.com/faq#methodology [9]:http://gs.statcounter.com/faq#no-weighting [10]:https://www.digitalgov.gov/services/dap/ [11]:https://analytics.usa.gov/data/live/second-level-domains.csv [12]:https://analytics.usa.gov/data/live/sites.csv [13]:https://github.com/GSA/analytics.usa.gov [14]:https://github.com/18F/analytics-reporter [15]:http://json.org/ [16]:https://analytics.usa.gov/ [17]:http://www.zdnet.com/meet-the-team/us/steven-j-vaughan-nichols/ [18]:http://www.zdnet.com/meet-the-team/us/steven-j-vaughan-nichols/ [19]:http://www.zdnet.com/blog/open-source/ [20]:http://www.zdnet.com/topic/enterprise-software/
geekpi/TranslateProject
published/201711/20171004 No the Linux desktop hasnt jumped in popularity.md
Markdown
apache-2.0
5,968
// // NSKeyedUnarchiver+YYAdd.h // YYCategories <https://github.com/ibireme/YYCategories> // // Created by ibireme on 13/8/4. // Copyright (c) 2015 ibireme. // // This source code is licensed under the MIT-style license found in the // LICENSE file in the root directory of this source tree. // #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN /** Provides extensions for `NSKeyedUnarchiver`. */ @interface NSKeyedUnarchiver (YYAdd) /** Same as unarchiveObjectWithData:, except it returns the exception by reference. @param data The data need unarchived. @param exception Pointer which will, upon return, if an exception occurred and said pointer is not NULL, point to said NSException. */ + (nullable id)unarchiveObjectWithData:(NSData *)data exception:(NSException *_Nullable *_Nullable)exception; /** Same as unarchiveObjectWithFile:, except it returns the exception by reference. @param path The path of archived object file. @param exception Pointer which will, upon return, if an exception occurred and said pointer is not NULL, point to said NSException. */ + (nullable id)unarchiveObjectWithFile:(NSString *)path exception:(NSException *_Nullable *_Nullable)exception; @end NS_ASSUME_NONNULL_END
wanghui9309/Poultry-net
禽病网/Pods/YYCategories/YYCategories/Foundation/NSKeyedUnarchiver+YYAdd.h
C
apache-2.0
1,319
/** * Appcelerator Titanium Mobile * Copyright (c) 2009-2013 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. * * WARNING: This is generated code. Modify at your own risk and without support. */ #ifdef USE_TI_UITEXTAREA #import "TiUITextWidget.h" @interface TiUITextViewImpl : UITextView { @private TiUIView * touchHandler; UIView * touchedContentView; } -(void)setTouchHandler:(TiUIView*)handler; @end @interface TiUITextArea : TiUITextWidget <UITextViewDelegate> { @private BOOL becameResponder; BOOL returnActive; } @property(nonatomic,readonly) BOOL becameResponder; @end #endif
chupibk/buywitme
build/iphone/Classes/TiUITextArea.h
C
apache-2.0
728
/*! * Quill Editor v1.0.0-rc.0 * https://quilljs.com/ * Copyright (c) 2014, Jason Chen * Copyright (c) 2013, salesforce.com */ .ql-container { box-sizing: border-box; font-family: Helvetica, Arial, sans-serif; font-size: 13px; height: 100%; margin: 0px; position: relative; } .ql-clipboard { left: -100000px; height: 1px; overflow-y: hidden; position: absolute; top: 50%; } .ql-clipboard p { margin: 0; padding: 0; } .ql-editor { box-sizing: border-box; cursor: text; line-height: 1.42; height: 100%; outline: none; overflow-y: auto; padding: 12px 15px; tab-size: 4; -moz-tab-size: 4; text-align: left; white-space: pre-wrap; word-wrap: break-word; } .ql-editor p, .ql-editor ol, .ql-editor ul, .ql-editor pre, .ql-editor blockquote, .ql-editor h1, .ql-editor h2, .ql-editor h3, .ql-editor h4, .ql-editor h5, .ql-editor h6 { margin: 0; padding: 0; counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8; } .ql-editor ol, .ql-editor ul { padding-left: 20px; } .ql-editor ol > li, .ql-editor ul > li { list-style-type: none; } .ql-editor ul > li::before { content: '\25CF'; } .ql-editor li::before { display: inline-block; margin-right: 4px; text-align: right; white-space: nowrap; width: 15px; } .ql-editor li:not(.ql-direction-rtl)::before { margin-left: -19px; } .ql-editor ol li, .ql-editor ul li { padding-left: 19px; } .ql-editor ol li { counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8; counter-increment: list-num; } .ql-editor ol li:before { content: counter(list-num, decimal) '. '; } .ql-editor ol li.ql-indent-1 { counter-increment: list-1; } .ql-editor ol li.ql-indent-1:before { content: counter(list-1, lower-alpha) '. '; } .ql-editor ol li.ql-indent-1 { counter-reset: list-2 list-3 list-4 list-5 list-6 list-7 list-8; } .ql-editor ol li.ql-indent-2 { counter-increment: list-2; } .ql-editor ol li.ql-indent-2:before { content: counter(list-2, lower-roman) '. '; } .ql-editor ol li.ql-indent-2 { counter-reset: list-3 list-4 list-5 list-6 list-7 list-8; } .ql-editor ol li.ql-indent-3 { counter-increment: list-3; } .ql-editor ol li.ql-indent-3:before { content: counter(list-3, decimal) '. '; } .ql-editor ol li.ql-indent-3 { counter-reset: list-4 list-5 list-6 list-7 list-8; } .ql-editor ol li.ql-indent-4 { counter-increment: list-4; } .ql-editor ol li.ql-indent-4:before { content: counter(list-4, lower-alpha) '. '; } .ql-editor ol li.ql-indent-4 { counter-reset: list-5 list-6 list-7 list-8; } .ql-editor ol li.ql-indent-5 { counter-increment: list-5; } .ql-editor ol li.ql-indent-5:before { content: counter(list-5, lower-roman) '. '; } .ql-editor ol li.ql-indent-5 { counter-reset: list-6 list-7 list-8; } .ql-editor ol li.ql-indent-6 { counter-increment: list-6; } .ql-editor ol li.ql-indent-6:before { content: counter(list-6, decimal) '. '; } .ql-editor ol li.ql-indent-6 { counter-reset: list-7 list-8; } .ql-editor ol li.ql-indent-7 { counter-increment: list-7; } .ql-editor ol li.ql-indent-7:before { content: counter(list-7, lower-alpha) '. '; } .ql-editor ol li.ql-indent-7 { counter-reset: list-8; } .ql-editor ol li.ql-indent-8 { counter-increment: list-8; } .ql-editor ol li.ql-indent-8:before { content: counter(list-8, lower-roman) '. '; } .ql-editor .ql-indent-1:not(.ql-direction-rtl) { padding-left: 40px; } .ql-editor li.ql-indent-1:not(.ql-direction-rtl) { padding-left: 59px; } .ql-editor .ql-indent-1.ql-direction-rtl.ql-align-right { padding-right: 40px; } .ql-editor li.ql-indent-1.ql-direction-rtl.ql-align-right { padding-right: 59px; } .ql-editor .ql-indent-2:not(.ql-direction-rtl) { padding-left: 80px; } .ql-editor li.ql-indent-2:not(.ql-direction-rtl) { padding-left: 99px; } .ql-editor .ql-indent-2.ql-direction-rtl.ql-align-right { padding-right: 80px; } .ql-editor li.ql-indent-2.ql-direction-rtl.ql-align-right { padding-right: 99px; } .ql-editor .ql-indent-3:not(.ql-direction-rtl) { padding-left: 120px; } .ql-editor li.ql-indent-3:not(.ql-direction-rtl) { padding-left: 139px; } .ql-editor .ql-indent-3.ql-direction-rtl.ql-align-right { padding-right: 120px; } .ql-editor li.ql-indent-3.ql-direction-rtl.ql-align-right { padding-right: 139px; } .ql-editor .ql-indent-4:not(.ql-direction-rtl) { padding-left: 160px; } .ql-editor li.ql-indent-4:not(.ql-direction-rtl) { padding-left: 179px; } .ql-editor .ql-indent-4.ql-direction-rtl.ql-align-right { padding-right: 160px; } .ql-editor li.ql-indent-4.ql-direction-rtl.ql-align-right { padding-right: 179px; } .ql-editor .ql-indent-5:not(.ql-direction-rtl) { padding-left: 200px; } .ql-editor li.ql-indent-5:not(.ql-direction-rtl) { padding-left: 219px; } .ql-editor .ql-indent-5.ql-direction-rtl.ql-align-right { padding-right: 200px; } .ql-editor li.ql-indent-5.ql-direction-rtl.ql-align-right { padding-right: 219px; } .ql-editor .ql-indent-6:not(.ql-direction-rtl) { padding-left: 240px; } .ql-editor li.ql-indent-6:not(.ql-direction-rtl) { padding-left: 259px; } .ql-editor .ql-indent-6.ql-direction-rtl.ql-align-right { padding-right: 240px; } .ql-editor li.ql-indent-6.ql-direction-rtl.ql-align-right { padding-right: 259px; } .ql-editor .ql-indent-7:not(.ql-direction-rtl) { padding-left: 280px; } .ql-editor li.ql-indent-7:not(.ql-direction-rtl) { padding-left: 299px; } .ql-editor .ql-indent-7.ql-direction-rtl.ql-align-right { padding-right: 280px; } .ql-editor li.ql-indent-7.ql-direction-rtl.ql-align-right { padding-right: 299px; } .ql-editor .ql-indent-8:not(.ql-direction-rtl) { padding-left: 320px; } .ql-editor li.ql-indent-8:not(.ql-direction-rtl) { padding-left: 339px; } .ql-editor .ql-indent-8.ql-direction-rtl.ql-align-right { padding-right: 320px; } .ql-editor li.ql-indent-8.ql-direction-rtl.ql-align-right { padding-right: 339px; } .ql-editor .ql-video { display: block; max-width: 100%; } .ql-editor .ql-video.ql-align-center { margin: 0 auto; } .ql-editor .ql-video.ql-align-right { margin: 0 0 0 auto; } .ql-editor .ql-bg-black { background-color: #000; } .ql-editor .ql-bg-red { background-color: #e60000; } .ql-editor .ql-bg-orange { background-color: #f90; } .ql-editor .ql-bg-yellow { background-color: #ff0; } .ql-editor .ql-bg-green { background-color: #008a00; } .ql-editor .ql-bg-blue { background-color: #06c; } .ql-editor .ql-bg-purple { background-color: #93f; } .ql-editor .ql-color-white { color: #fff; } .ql-editor .ql-color-red { color: #e60000; } .ql-editor .ql-color-orange { color: #f90; } .ql-editor .ql-color-yellow { color: #ff0; } .ql-editor .ql-color-green { color: #008a00; } .ql-editor .ql-color-blue { color: #06c; } .ql-editor .ql-color-purple { color: #93f; } .ql-editor .ql-font-serif { font-family: Georgia, Times New Roman, serif; } .ql-editor .ql-font-monospace { font-family: Monaco, Courier New, monospace; } .ql-editor .ql-size-small { font-size: 10px; } .ql-editor .ql-size-large { font-size: 18px; } .ql-editor .ql-size-huge { font-size: 32px; } .ql-editor .ql-direction-rtl { direction: rtl; text-align: inherit; } .ql-editor .ql-align-center { text-align: center; } .ql-editor .ql-align-justify { text-align: justify; } .ql-editor .ql-align-right { text-align: right; } .ql-editor.ql-blank::before { color: rgba(0,0,0,0.6); content: attr(data-placeholder); font-style: italic; pointer-events: none; position: absolute; }
Amomo/cdnjs
ajax/libs/quill/1.0.0-rc.0/quill.core.css
CSS
mit
7,496
#include "UmlEntryPointPseudoState.h"
kralf/bouml
src/bin/xmi_generator/UmlEntryPointPseudoState.cpp
C++
gpl-2.0
40
/* vi: set sw=4 ts=4: */ /* Copyright (C) 2003 Manuel Novoa III * * Licensed under GPL v2, or later. See file LICENSE in this tarball. */ /* Nov 6, 2003 Initial version. * * NOTE: This implementation is quite strict about requiring all * field seperators. It also does not allow leading whitespace * except when processing the numeric fields. glibc is more * lenient. See the various glibc difference comments below. * * TODO: * Move to dynamic allocation of (currently statically allocated) * buffers; especially for the group-related functions since * large group member lists will cause error returns. * */ #ifndef GETXXKEY_R_FUNC #error GETXXKEY_R_FUNC is not defined! #endif int GETXXKEY_R_FUNC(GETXXKEY_R_KEYTYPE key, GETXXKEY_R_ENTTYPE *__restrict resultbuf, char *__restrict buffer, size_t buflen, GETXXKEY_R_ENTTYPE **__restrict result) { FILE *stream; int rv; *result = NULL; stream = fopen_for_read(GETXXKEY_R_PATHNAME); if (!stream) return errno; while (1) { rv = bb__pgsreader(GETXXKEY_R_PARSER, resultbuf, buffer, buflen, stream); if (!rv) { if (GETXXKEY_R_TEST(resultbuf)) { /* Found key? */ *result = resultbuf; break; } } else { if (rv == ENOENT) { /* end-of-file encountered. */ rv = 0; } break; } } fclose(stream); return rv; } #undef GETXXKEY_R_FUNC #undef GETXXKEY_R_PARSER #undef GETXXKEY_R_ENTTYPE #undef GETXXKEY_R_TEST #undef GETXXKEY_R_KEYTYPE #undef GETXXKEY_R_PATHNAME
ZHAW-INES/rioxo-uClinux-dist
user/busybox/busybox/libpwdgrp/pwd_grp_internal.c
C
gpl-2.0
1,513
// wrapped by build app define("dojox/wire/TreeAdapter", ["dijit","dojo","dojox","dojo/require!dojox/wire/CompositeWire"], function(dijit,dojo,dojox){ dojo.provide("dojox.wire.TreeAdapter"); dojo.require("dojox.wire.CompositeWire"); dojo.declare("dojox.wire.TreeAdapter", dojox.wire.CompositeWire, { // summary: // A composite Wire for tree nodes // description: // This class has multiple child Wires for tree nodes, their title and // child nodes. // The root object for this class must be an array. // 'node' Wires in 'nodes' property is used to identify an object // representing a node. // 'title' Wires in 'nodes' property is used to get the title string // of a node. // 'children' Wires in 'nodes' property is used to iterate over child // node objects. // The node values are returned in an array as follows: // | [ // | {title: title1, // | children: [ // | {title: title2, // | child: ...}, // | {title: title3, // | child: ...}, // | ... // | ]}, // | ... // | ] // This class only supports getValue(), but not setValue(). _wireClass: "dojox.wire.TreeAdapter", constructor: function(/*Object*/ args){ // summary: // Initialize properties // description: // If object properties ('node', 'title' and 'children') of array // elements specified in 'nodes' property are not Wires, Wires are // created from them as arguments, with 'parent' property set to // this Wire instance. // args: // Arguments to initialize properties: // // - nodes: An array containing objects for child Wires for node values this._initializeChildren(this.nodes); }, _getValue: function(/*Array*/object){ // summary: // Return an array of tree node values // description: // This method iterates over an array specified to 'object' // argument and calls getValue() method of 'node' Wires with each // element of the array to get object(s) that represents nodes. // (If 'node' Wires are omitted, the array element is used for // further processing.) // Then, getValue() method of 'title' Wires are called to get // title strings for nodes. // (If 'title' Wires are omitted, the objects representing nodes // are used as title strings.) // And if an array of objects with 'node' and 'title' Wires is // specified to 'children', it is used to gather child nodes and // their title strings in the same way recursively. // Finally, an array of the top-level node objects are retuned. // object: // A root array // returns: // An array of tree node values if(!object || !this.nodes){ return object; //Array } var array = object; if(!dojo.isArray(array)){ array = [array]; } var nodes = []; for(var i in array){ for(var i2 in this.nodes){ nodes = nodes.concat(this._getNodes(array[i], this.nodes[i2])); } } return nodes; //Array }, _setValue: function(/*Array*/object, /*Array*/value){ // summary: // Not supported throw new Error("Unsupported API: " + this._wireClass + "._setValue"); }, _initializeChildren: function(/*Array*/children){ // summary: // Initialize child Wires // description: // If 'node' or 'title' properties of array elements specified in // 'children' argument are not Wires, Wires are created from them // as arguments, with 'parent' property set to this Wire instance. // If an array element has 'children' property, this method is // called recursively with it. // children: // An array of objects containing child Wires if(!children){ return; //undefined } for(var i in children){ var child = children[i]; if(child.node){ child.node.parent = this; if(!dojox.wire.isWire(child.node)){ child.node = dojox.wire.create(child.node); } } if(child.title){ child.title.parent = this; if(!dojox.wire.isWire(child.title)){ child.title = dojox.wire.create(child.title); } } if(child.children){ this._initializeChildren(child.children); } } }, _getNodes: function(/*Object*/object, /*Object*/child){ // summary: // Return an array of tree node values // description: // This method calls getValue() method of 'node' Wires with // 'object' argument to get object(s) that represents nodes. // (If 'node' Wires are omitted, 'object' is used for further // processing.) // Then, getValue() method of 'title' Wires are called to get // title strings for nodes. // (If 'title' Wires are omitted, the objects representing nodes // are used as title strings.) // And if an array of objects with 'node' and 'title' Wires is // specified to 'children', it is used to gather child nodes and // their title strings in the same way recursively. // Finally, an array of node objects are returned. // object: // An object // child: // An object with child Wires // returns: var array = null; if(child.node){ array = child.node.getValue(object); if(!array){ return []; } if(!dojo.isArray(array)){ array = [array]; } }else{ array = [object]; } var nodes = []; for(var i in array){ object = array[i]; var node = {}; if(child.title){ node.title = child.title.getValue(object); }else{ node.title = object; } if(child.children){ var children = []; for(var i2 in child.children){ children = children.concat(this._getNodes(object, child.children[i2])); } if(children.length > 0){ node.children = children; } } nodes.push(node); } return nodes; //Array } }); });
ISTang/sitemap
web/public/libs/dojo/1.8.3/dojox/wire/TreeAdapter.js.uncompressed.js
JavaScript
gpl-2.0
5,605
#ifndef NVM_H #define NVM_H #include <linux/blkdev.h> #include <linux/types.h> #include <uapi/linux/lightnvm.h> enum { NVM_IO_OK = 0, NVM_IO_REQUEUE = 1, NVM_IO_DONE = 2, NVM_IO_ERR = 3, NVM_IOTYPE_NONE = 0, NVM_IOTYPE_GC = 1, }; #define NVM_BLK_BITS (16) #define NVM_PG_BITS (16) #define NVM_SEC_BITS (8) #define NVM_PL_BITS (8) #define NVM_LUN_BITS (8) #define NVM_CH_BITS (7) struct ppa_addr { /* Generic structure for all addresses */ union { struct { u64 blk : NVM_BLK_BITS; u64 pg : NVM_PG_BITS; u64 sec : NVM_SEC_BITS; u64 pl : NVM_PL_BITS; u64 lun : NVM_LUN_BITS; u64 ch : NVM_CH_BITS; u64 reserved : 1; } g; struct { u64 line : 63; u64 is_cached : 1; } c; u64 ppa; }; }; struct nvm_rq; struct nvm_id; struct nvm_dev; struct nvm_tgt_dev; typedef int (nvm_l2p_update_fn)(u64, u32, __le64 *, void *); typedef int (nvm_id_fn)(struct nvm_dev *, struct nvm_id *); typedef int (nvm_get_l2p_tbl_fn)(struct nvm_dev *, u64, u32, nvm_l2p_update_fn *, void *); typedef int (nvm_op_bb_tbl_fn)(struct nvm_dev *, struct ppa_addr, u8 *); typedef int (nvm_op_set_bb_fn)(struct nvm_dev *, struct ppa_addr *, int, int); typedef int (nvm_submit_io_fn)(struct nvm_dev *, struct nvm_rq *); typedef int (nvm_erase_blk_fn)(struct nvm_dev *, struct nvm_rq *); typedef void *(nvm_create_dma_pool_fn)(struct nvm_dev *, char *); typedef void (nvm_destroy_dma_pool_fn)(void *); typedef void *(nvm_dev_dma_alloc_fn)(struct nvm_dev *, void *, gfp_t, dma_addr_t *); typedef void (nvm_dev_dma_free_fn)(void *, void*, dma_addr_t); struct nvm_dev_ops { nvm_id_fn *identity; nvm_get_l2p_tbl_fn *get_l2p_tbl; nvm_op_bb_tbl_fn *get_bb_tbl; nvm_op_set_bb_fn *set_bb_tbl; nvm_submit_io_fn *submit_io; nvm_erase_blk_fn *erase_block; nvm_create_dma_pool_fn *create_dma_pool; nvm_destroy_dma_pool_fn *destroy_dma_pool; nvm_dev_dma_alloc_fn *dev_dma_alloc; nvm_dev_dma_free_fn *dev_dma_free; unsigned int max_phys_sect; }; #ifdef CONFIG_NVM #include <linux/blkdev.h> #include <linux/file.h> #include <linux/dmapool.h> #include <uapi/linux/lightnvm.h> enum { /* HW Responsibilities */ NVM_RSP_L2P = 1 << 0, NVM_RSP_ECC = 1 << 1, /* Physical Adressing Mode */ NVM_ADDRMODE_LINEAR = 0, NVM_ADDRMODE_CHANNEL = 1, /* Plane programming mode for LUN */ NVM_PLANE_SINGLE = 1, NVM_PLANE_DOUBLE = 2, NVM_PLANE_QUAD = 4, /* Status codes */ NVM_RSP_SUCCESS = 0x0, NVM_RSP_NOT_CHANGEABLE = 0x1, NVM_RSP_ERR_FAILWRITE = 0x40ff, NVM_RSP_ERR_EMPTYPAGE = 0x42ff, NVM_RSP_ERR_FAILECC = 0x4281, NVM_RSP_WARN_HIGHECC = 0x4700, /* Device opcodes */ NVM_OP_HBREAD = 0x02, NVM_OP_HBWRITE = 0x81, NVM_OP_PWRITE = 0x91, NVM_OP_PREAD = 0x92, NVM_OP_ERASE = 0x90, /* PPA Command Flags */ NVM_IO_SNGL_ACCESS = 0x0, NVM_IO_DUAL_ACCESS = 0x1, NVM_IO_QUAD_ACCESS = 0x2, /* NAND Access Modes */ NVM_IO_SUSPEND = 0x80, NVM_IO_SLC_MODE = 0x100, NVM_IO_SCRAMBLE_DISABLE = 0x200, /* Block Types */ NVM_BLK_T_FREE = 0x0, NVM_BLK_T_BAD = 0x1, NVM_BLK_T_GRWN_BAD = 0x2, NVM_BLK_T_DEV = 0x4, NVM_BLK_T_HOST = 0x8, /* Memory capabilities */ NVM_ID_CAP_SLC = 0x1, NVM_ID_CAP_CMD_SUSPEND = 0x2, NVM_ID_CAP_SCRAMBLE = 0x4, NVM_ID_CAP_ENCRYPT = 0x8, /* Memory types */ NVM_ID_FMTYPE_SLC = 0, NVM_ID_FMTYPE_MLC = 1, /* Device capabilities */ NVM_ID_DCAP_BBLKMGMT = 0x1, NVM_UD_DCAP_ECC = 0x2, }; struct nvm_id_lp_mlc { u16 num_pairs; u8 pairs[886]; }; struct nvm_id_lp_tbl { __u8 id[8]; struct nvm_id_lp_mlc mlc; }; struct nvm_id_group { u8 mtype; u8 fmtype; u8 num_ch; u8 num_lun; u8 num_pln; u16 num_blk; u16 num_pg; u16 fpg_sz; u16 csecs; u16 sos; u32 trdt; u32 trdm; u32 tprt; u32 tprm; u32 tbet; u32 tbem; u32 mpos; u32 mccap; u16 cpar; struct nvm_id_lp_tbl lptbl; }; struct nvm_addr_format { u8 ch_offset; u8 ch_len; u8 lun_offset; u8 lun_len; u8 pln_offset; u8 pln_len; u8 blk_offset; u8 blk_len; u8 pg_offset; u8 pg_len; u8 sect_offset; u8 sect_len; }; struct nvm_id { u8 ver_id; u8 vmnt; u8 cgrps; u32 cap; u32 dom; struct nvm_addr_format ppaf; struct nvm_id_group groups[4]; } __packed; struct nvm_target { struct list_head list; struct nvm_tgt_dev *dev; struct nvm_tgt_type *type; struct gendisk *disk; }; struct nvm_tgt_instance { struct nvm_tgt_type *tt; }; #define ADDR_EMPTY (~0ULL) #define NVM_VERSION_MAJOR 1 #define NVM_VERSION_MINOR 0 #define NVM_VERSION_PATCH 0 struct nvm_rq; typedef void (nvm_end_io_fn)(struct nvm_rq *); struct nvm_rq { struct nvm_tgt_instance *ins; struct nvm_tgt_dev *dev; struct bio *bio; union { struct ppa_addr ppa_addr; dma_addr_t dma_ppa_list; }; struct ppa_addr *ppa_list; void *meta_list; dma_addr_t dma_meta_list; struct completion *wait; nvm_end_io_fn *end_io; uint8_t opcode; uint16_t nr_ppas; uint16_t flags; u64 ppa_status; /* ppa media status */ int error; }; static inline struct nvm_rq *nvm_rq_from_pdu(void *pdu) { return pdu - sizeof(struct nvm_rq); } static inline void *nvm_rq_to_pdu(struct nvm_rq *rqdata) { return rqdata + 1; } enum { NVM_BLK_ST_FREE = 0x1, /* Free block */ NVM_BLK_ST_TGT = 0x2, /* Block in use by target */ NVM_BLK_ST_BAD = 0x8, /* Bad block */ }; /* system block cpu representation */ struct nvm_sb_info { unsigned long seqnr; unsigned long erase_cnt; unsigned int version; char mmtype[NVM_MMTYPE_LEN]; struct ppa_addr fs_ppa; }; /* Device generic information */ struct nvm_geo { int nr_chnls; int nr_luns; int luns_per_chnl; /* -1 if channels are not symmetric */ int nr_planes; int sec_per_pg; /* only sectors for a single page */ int pgs_per_blk; int blks_per_lun; int fpg_size; int pfpg_size; /* size of buffer if all pages are to be read */ int sec_size; int oob_size; int mccap; struct nvm_addr_format ppaf; /* Calculated/Cached values. These do not reflect the actual usable * blocks at run-time. */ int max_rq_size; int plane_mode; /* drive device in single, double or quad mode */ int sec_per_pl; /* all sectors across planes */ int sec_per_blk; int sec_per_lun; }; struct nvm_tgt_dev { /* Device information */ struct nvm_geo geo; /* Base ppas for target LUNs */ struct ppa_addr *luns; sector_t total_secs; struct nvm_id identity; struct request_queue *q; struct nvm_dev *parent; void *map; }; struct nvm_dev { struct nvm_dev_ops *ops; struct list_head devices; /* Media manager */ struct nvmm_type *mt; void *mp; /* System blocks */ struct nvm_sb_info sb; /* Device information */ struct nvm_geo geo; /* lower page table */ int lps_per_blk; int *lptbl; unsigned long total_secs; unsigned long *lun_map; void *dma_pool; struct nvm_id identity; /* Backend device */ struct request_queue *q; char name[DISK_NAME_LEN]; void *private_data; void *rmap; struct mutex mlock; spinlock_t lock; }; static inline struct ppa_addr linear_to_generic_addr(struct nvm_geo *geo, u64 pba) { struct ppa_addr l; int secs, pgs, blks, luns; sector_t ppa = pba; l.ppa = 0; div_u64_rem(ppa, geo->sec_per_pg, &secs); l.g.sec = secs; sector_div(ppa, geo->sec_per_pg); div_u64_rem(ppa, geo->pgs_per_blk, &pgs); l.g.pg = pgs; sector_div(ppa, geo->pgs_per_blk); div_u64_rem(ppa, geo->blks_per_lun, &blks); l.g.blk = blks; sector_div(ppa, geo->blks_per_lun); div_u64_rem(ppa, geo->luns_per_chnl, &luns); l.g.lun = luns; sector_div(ppa, geo->luns_per_chnl); l.g.ch = ppa; return l; } static inline struct ppa_addr generic_to_dev_addr(struct nvm_dev *dev, struct ppa_addr r) { struct nvm_geo *geo = &dev->geo; struct ppa_addr l; l.ppa = ((u64)r.g.blk) << geo->ppaf.blk_offset; l.ppa |= ((u64)r.g.pg) << geo->ppaf.pg_offset; l.ppa |= ((u64)r.g.sec) << geo->ppaf.sect_offset; l.ppa |= ((u64)r.g.pl) << geo->ppaf.pln_offset; l.ppa |= ((u64)r.g.lun) << geo->ppaf.lun_offset; l.ppa |= ((u64)r.g.ch) << geo->ppaf.ch_offset; return l; } static inline struct ppa_addr dev_to_generic_addr(struct nvm_dev *dev, struct ppa_addr r) { struct nvm_geo *geo = &dev->geo; struct ppa_addr l; l.ppa = 0; /* * (r.ppa << X offset) & X len bitmask. X eq. blk, pg, etc. */ l.g.blk = (r.ppa >> geo->ppaf.blk_offset) & (((1 << geo->ppaf.blk_len) - 1)); l.g.pg |= (r.ppa >> geo->ppaf.pg_offset) & (((1 << geo->ppaf.pg_len) - 1)); l.g.sec |= (r.ppa >> geo->ppaf.sect_offset) & (((1 << geo->ppaf.sect_len) - 1)); l.g.pl |= (r.ppa >> geo->ppaf.pln_offset) & (((1 << geo->ppaf.pln_len) - 1)); l.g.lun |= (r.ppa >> geo->ppaf.lun_offset) & (((1 << geo->ppaf.lun_len) - 1)); l.g.ch |= (r.ppa >> geo->ppaf.ch_offset) & (((1 << geo->ppaf.ch_len) - 1)); return l; } static inline int ppa_empty(struct ppa_addr ppa_addr) { return (ppa_addr.ppa == ADDR_EMPTY); } static inline void ppa_set_empty(struct ppa_addr *ppa_addr) { ppa_addr->ppa = ADDR_EMPTY; } static inline int ppa_cmp_blk(struct ppa_addr ppa1, struct ppa_addr ppa2) { if (ppa_empty(ppa1) || ppa_empty(ppa2)) return 0; return ((ppa1.g.ch == ppa2.g.ch) && (ppa1.g.lun == ppa2.g.lun) && (ppa1.g.blk == ppa2.g.blk)); } static inline int ppa_to_slc(struct nvm_dev *dev, int slc_pg) { return dev->lptbl[slc_pg]; } typedef blk_qc_t (nvm_tgt_make_rq_fn)(struct request_queue *, struct bio *); typedef sector_t (nvm_tgt_capacity_fn)(void *); typedef void *(nvm_tgt_init_fn)(struct nvm_tgt_dev *, struct gendisk *); typedef void (nvm_tgt_exit_fn)(void *); struct nvm_tgt_type { const char *name; unsigned int version[3]; /* target entry points */ nvm_tgt_make_rq_fn *make_rq; nvm_tgt_capacity_fn *capacity; nvm_end_io_fn *end_io; /* module-specific init/teardown */ nvm_tgt_init_fn *init; nvm_tgt_exit_fn *exit; /* For internal use */ struct list_head list; }; extern struct nvm_tgt_type *nvm_find_target_type(const char *, int); extern int nvm_register_tgt_type(struct nvm_tgt_type *); extern void nvm_unregister_tgt_type(struct nvm_tgt_type *); extern void *nvm_dev_dma_alloc(struct nvm_dev *, gfp_t, dma_addr_t *); extern void nvm_dev_dma_free(struct nvm_dev *, void *, dma_addr_t); typedef int (nvmm_register_fn)(struct nvm_dev *); typedef void (nvmm_unregister_fn)(struct nvm_dev *); typedef int (nvmm_create_tgt_fn)(struct nvm_dev *, struct nvm_ioctl_create *); typedef int (nvmm_remove_tgt_fn)(struct nvm_dev *, struct nvm_ioctl_remove *); typedef int (nvmm_submit_io_fn)(struct nvm_tgt_dev *, struct nvm_rq *); typedef int (nvmm_erase_blk_fn)(struct nvm_tgt_dev *, struct ppa_addr *, int); typedef int (nvmm_get_area_fn)(struct nvm_dev *, sector_t *, sector_t); typedef void (nvmm_put_area_fn)(struct nvm_dev *, sector_t); typedef struct ppa_addr (nvmm_trans_ppa_fn)(struct nvm_tgt_dev *, struct ppa_addr, int); typedef void (nvmm_part_to_tgt_fn)(struct nvm_dev *, sector_t*, int); enum { TRANS_TGT_TO_DEV = 0x0, TRANS_DEV_TO_TGT = 0x1, }; struct nvmm_type { const char *name; unsigned int version[3]; nvmm_register_fn *register_mgr; nvmm_unregister_fn *unregister_mgr; nvmm_create_tgt_fn *create_tgt; nvmm_remove_tgt_fn *remove_tgt; nvmm_submit_io_fn *submit_io; nvmm_erase_blk_fn *erase_blk; nvmm_get_area_fn *get_area; nvmm_put_area_fn *put_area; nvmm_trans_ppa_fn *trans_ppa; nvmm_part_to_tgt_fn *part_to_tgt; struct list_head list; }; extern int nvm_register_mgr(struct nvmm_type *); extern void nvm_unregister_mgr(struct nvmm_type *); extern struct nvm_dev *nvm_alloc_dev(int); extern int nvm_register(struct nvm_dev *); extern void nvm_unregister(struct nvm_dev *); extern int nvm_set_bb_tbl(struct nvm_dev *, struct ppa_addr *, int, int); extern int nvm_set_tgt_bb_tbl(struct nvm_tgt_dev *, struct ppa_addr *, int, int); extern int nvm_max_phys_sects(struct nvm_tgt_dev *); extern int nvm_submit_io(struct nvm_tgt_dev *, struct nvm_rq *); extern void nvm_generic_to_addr_mode(struct nvm_dev *, struct nvm_rq *); extern void nvm_addr_to_generic_mode(struct nvm_dev *, struct nvm_rq *); extern int nvm_set_rqd_ppalist(struct nvm_dev *, struct nvm_rq *, const struct ppa_addr *, int, int); extern void nvm_free_rqd_ppalist(struct nvm_dev *, struct nvm_rq *); extern int nvm_erase_ppa(struct nvm_dev *, struct ppa_addr *, int, int); extern int nvm_erase_blk(struct nvm_tgt_dev *, struct ppa_addr *, int); extern int nvm_get_l2p_tbl(struct nvm_tgt_dev *, u64, u32, nvm_l2p_update_fn *, void *); extern int nvm_get_area(struct nvm_tgt_dev *, sector_t *, sector_t); extern void nvm_put_area(struct nvm_tgt_dev *, sector_t); extern void nvm_end_io(struct nvm_rq *, int); extern int nvm_submit_ppa(struct nvm_dev *, struct ppa_addr *, int, int, int, void *, int); extern int nvm_submit_ppa_list(struct nvm_dev *, struct ppa_addr *, int, int, int, void *, int); extern int nvm_bb_tbl_fold(struct nvm_dev *, u8 *, int); extern int nvm_get_bb_tbl(struct nvm_dev *, struct ppa_addr, u8 *); extern int nvm_get_tgt_bb_tbl(struct nvm_tgt_dev *, struct ppa_addr, u8 *); /* sysblk.c */ #define NVM_SYSBLK_MAGIC 0x4E564D53 /* "NVMS" */ /* system block on disk representation */ struct nvm_system_block { __be32 magic; /* magic signature */ __be32 seqnr; /* sequence number */ __be32 erase_cnt; /* erase count */ __be16 version; /* version number */ u8 mmtype[NVM_MMTYPE_LEN]; /* media manager name */ __be64 fs_ppa; /* PPA for media manager * superblock */ }; extern int nvm_get_sysblock(struct nvm_dev *, struct nvm_sb_info *); extern int nvm_update_sysblock(struct nvm_dev *, struct nvm_sb_info *); extern int nvm_init_sysblock(struct nvm_dev *, struct nvm_sb_info *); extern int nvm_dev_factory(struct nvm_dev *, int flags); #define nvm_for_each_lun_ppa(geo, ppa, chid, lunid) \ for ((chid) = 0, (ppa).ppa = 0; (chid) < (geo)->nr_chnls; \ (chid)++, (ppa).g.ch = (chid)) \ for ((lunid) = 0; (lunid) < (geo)->luns_per_chnl; \ (lunid)++, (ppa).g.lun = (lunid)) #else /* CONFIG_NVM */ struct nvm_dev_ops; static inline struct nvm_dev *nvm_alloc_dev(int node) { return ERR_PTR(-EINVAL); } static inline int nvm_register(struct nvm_dev *dev) { return -EINVAL; } static inline void nvm_unregister(struct nvm_dev *dev) {} #endif /* CONFIG_NVM */ #endif /* LIGHTNVM.H */
bas-t/linux_media
include/linux/lightnvm.h
C
gpl-2.0
14,178
/* * Copyright © 2014 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * */ #include <linux/firmware.h> #include "i915_drv.h" #include "i915_reg.h" /** * DOC: csr support for dmc * * Display Context Save and Restore (CSR) firmware support added from gen9 * onwards to drive newly added DMC (Display microcontroller) in display * engine to save and restore the state of display engine when it enter into * low-power state and comes back to normal. */ #define I915_CSR_GLK "i915/glk_dmc_ver1_04.bin" #define GLK_CSR_VERSION_REQUIRED CSR_VERSION(1, 4) #define I915_CSR_CNL "i915/cnl_dmc_ver1_04.bin" #define CNL_CSR_VERSION_REQUIRED CSR_VERSION(1, 4) #define I915_CSR_KBL "i915/kbl_dmc_ver1_01.bin" MODULE_FIRMWARE(I915_CSR_KBL); #define KBL_CSR_VERSION_REQUIRED CSR_VERSION(1, 1) #define I915_CSR_SKL "i915/skl_dmc_ver1_26.bin" MODULE_FIRMWARE(I915_CSR_SKL); #define SKL_CSR_VERSION_REQUIRED CSR_VERSION(1, 26) #define I915_CSR_BXT "i915/bxt_dmc_ver1_07.bin" MODULE_FIRMWARE(I915_CSR_BXT); #define BXT_CSR_VERSION_REQUIRED CSR_VERSION(1, 7) #define FIRMWARE_URL "https://01.org/linuxgraphics/downloads/firmware" #define CSR_MAX_FW_SIZE 0x2FFF #define CSR_DEFAULT_FW_OFFSET 0xFFFFFFFF struct intel_css_header { /* 0x09 for DMC */ uint32_t module_type; /* Includes the DMC specific header in dwords */ uint32_t header_len; /* always value would be 0x10000 */ uint32_t header_ver; /* Not used */ uint32_t module_id; /* Not used */ uint32_t module_vendor; /* in YYYYMMDD format */ uint32_t date; /* Size in dwords (CSS_Headerlen + PackageHeaderLen + dmc FWsLen)/4 */ uint32_t size; /* Not used */ uint32_t key_size; /* Not used */ uint32_t modulus_size; /* Not used */ uint32_t exponent_size; /* Not used */ uint32_t reserved1[12]; /* Major Minor */ uint32_t version; /* Not used */ uint32_t reserved2[8]; /* Not used */ uint32_t kernel_header_info; } __packed; struct intel_fw_info { uint16_t reserved1; /* Stepping (A, B, C, ..., *). * is a wildcard */ char stepping; /* Sub-stepping (0, 1, ..., *). * is a wildcard */ char substepping; uint32_t offset; uint32_t reserved2; } __packed; struct intel_package_header { /* DMC container header length in dwords */ unsigned char header_len; /* always value would be 0x01 */ unsigned char header_ver; unsigned char reserved[10]; /* Number of valid entries in the FWInfo array below */ uint32_t num_entries; struct intel_fw_info fw_info[20]; } __packed; struct intel_dmc_header { /* always value would be 0x40403E3E */ uint32_t signature; /* DMC binary header length */ unsigned char header_len; /* 0x01 */ unsigned char header_ver; /* Reserved */ uint16_t dmcc_ver; /* Major, Minor */ uint32_t project; /* Firmware program size (excluding header) in dwords */ uint32_t fw_size; /* Major Minor version */ uint32_t fw_version; /* Number of valid MMIO cycles present. */ uint32_t mmio_count; /* MMIO address */ uint32_t mmioaddr[8]; /* MMIO data */ uint32_t mmiodata[8]; /* FW filename */ unsigned char dfile[32]; uint32_t reserved1[2]; } __packed; struct stepping_info { char stepping; char substepping; }; static const struct stepping_info skl_stepping_info[] = { {'A', '0'}, {'B', '0'}, {'C', '0'}, {'D', '0'}, {'E', '0'}, {'F', '0'}, {'G', '0'}, {'H', '0'}, {'I', '0'}, {'J', '0'}, {'K', '0'} }; static const struct stepping_info bxt_stepping_info[] = { {'A', '0'}, {'A', '1'}, {'A', '2'}, {'B', '0'}, {'B', '1'}, {'B', '2'} }; static const struct stepping_info no_stepping_info = { '*', '*' }; static const struct stepping_info * intel_get_stepping_info(struct drm_i915_private *dev_priv) { const struct stepping_info *si; unsigned int size; if (IS_SKYLAKE(dev_priv)) { size = ARRAY_SIZE(skl_stepping_info); si = skl_stepping_info; } else if (IS_BROXTON(dev_priv)) { size = ARRAY_SIZE(bxt_stepping_info); si = bxt_stepping_info; } else { size = 0; } if (INTEL_REVID(dev_priv) < size) return si + INTEL_REVID(dev_priv); return &no_stepping_info; } static void gen9_set_dc_state_debugmask(struct drm_i915_private *dev_priv) { uint32_t val, mask; mask = DC_STATE_DEBUG_MASK_MEMORY_UP; if (IS_BROXTON(dev_priv)) mask |= DC_STATE_DEBUG_MASK_CORES; /* The below bit doesn't need to be cleared ever afterwards */ val = I915_READ(DC_STATE_DEBUG); if ((val & mask) != mask) { val |= mask; I915_WRITE(DC_STATE_DEBUG, val); POSTING_READ(DC_STATE_DEBUG); } } /** * intel_csr_load_program() - write the firmware from memory to register. * @dev_priv: i915 drm device. * * CSR firmware is read from a .bin file and kept in internal memory one time. * Everytime display comes back from low power state this function is called to * copy the firmware from internal memory to registers. */ void intel_csr_load_program(struct drm_i915_private *dev_priv) { u32 *payload = dev_priv->csr.dmc_payload; uint32_t i, fw_size; if (!HAS_CSR(dev_priv)) { DRM_ERROR("No CSR support available for this platform\n"); return; } if (!dev_priv->csr.dmc_payload) { DRM_ERROR("Tried to program CSR with empty payload\n"); return; } fw_size = dev_priv->csr.dmc_fw_size; for (i = 0; i < fw_size; i++) I915_WRITE(CSR_PROGRAM(i), payload[i]); for (i = 0; i < dev_priv->csr.mmio_count; i++) { I915_WRITE(dev_priv->csr.mmioaddr[i], dev_priv->csr.mmiodata[i]); } dev_priv->csr.dc_state = 0; gen9_set_dc_state_debugmask(dev_priv); } static uint32_t *parse_csr_fw(struct drm_i915_private *dev_priv, const struct firmware *fw) { struct intel_css_header *css_header; struct intel_package_header *package_header; struct intel_dmc_header *dmc_header; struct intel_csr *csr = &dev_priv->csr; const struct stepping_info *si = intel_get_stepping_info(dev_priv); uint32_t dmc_offset = CSR_DEFAULT_FW_OFFSET, readcount = 0, nbytes; uint32_t i; uint32_t *dmc_payload; uint32_t required_version; if (!fw) return NULL; /* Extract CSS Header information*/ css_header = (struct intel_css_header *)fw->data; if (sizeof(struct intel_css_header) != (css_header->header_len * 4)) { DRM_ERROR("Firmware has wrong CSS header length %u bytes\n", (css_header->header_len * 4)); return NULL; } csr->version = css_header->version; if (IS_CANNONLAKE(dev_priv)) { required_version = CNL_CSR_VERSION_REQUIRED; } else if (IS_GEMINILAKE(dev_priv)) { required_version = GLK_CSR_VERSION_REQUIRED; } else if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv)) { required_version = KBL_CSR_VERSION_REQUIRED; } else if (IS_SKYLAKE(dev_priv)) { required_version = SKL_CSR_VERSION_REQUIRED; } else if (IS_BROXTON(dev_priv)) { required_version = BXT_CSR_VERSION_REQUIRED; } else { MISSING_CASE(INTEL_REVID(dev_priv)); required_version = 0; } if (csr->version != required_version) { DRM_INFO("Refusing to load DMC firmware v%u.%u," " please use v%u.%u [" FIRMWARE_URL "].\n", CSR_VERSION_MAJOR(csr->version), CSR_VERSION_MINOR(csr->version), CSR_VERSION_MAJOR(required_version), CSR_VERSION_MINOR(required_version)); return NULL; } readcount += sizeof(struct intel_css_header); /* Extract Package Header information*/ package_header = (struct intel_package_header *) &fw->data[readcount]; if (sizeof(struct intel_package_header) != (package_header->header_len * 4)) { DRM_ERROR("Firmware has wrong package header length %u bytes\n", (package_header->header_len * 4)); return NULL; } readcount += sizeof(struct intel_package_header); /* Search for dmc_offset to find firware binary. */ for (i = 0; i < package_header->num_entries; i++) { if (package_header->fw_info[i].substepping == '*' && si->stepping == package_header->fw_info[i].stepping) { dmc_offset = package_header->fw_info[i].offset; break; } else if (si->stepping == package_header->fw_info[i].stepping && si->substepping == package_header->fw_info[i].substepping) { dmc_offset = package_header->fw_info[i].offset; break; } else if (package_header->fw_info[i].stepping == '*' && package_header->fw_info[i].substepping == '*') dmc_offset = package_header->fw_info[i].offset; } if (dmc_offset == CSR_DEFAULT_FW_OFFSET) { DRM_ERROR("Firmware not supported for %c stepping\n", si->stepping); return NULL; } readcount += dmc_offset; /* Extract dmc_header information. */ dmc_header = (struct intel_dmc_header *)&fw->data[readcount]; if (sizeof(struct intel_dmc_header) != (dmc_header->header_len)) { DRM_ERROR("Firmware has wrong dmc header length %u bytes\n", (dmc_header->header_len)); return NULL; } readcount += sizeof(struct intel_dmc_header); /* Cache the dmc header info. */ if (dmc_header->mmio_count > ARRAY_SIZE(csr->mmioaddr)) { DRM_ERROR("Firmware has wrong mmio count %u\n", dmc_header->mmio_count); return NULL; } csr->mmio_count = dmc_header->mmio_count; for (i = 0; i < dmc_header->mmio_count; i++) { if (dmc_header->mmioaddr[i] < CSR_MMIO_START_RANGE || dmc_header->mmioaddr[i] > CSR_MMIO_END_RANGE) { DRM_ERROR(" Firmware has wrong mmio address 0x%x\n", dmc_header->mmioaddr[i]); return NULL; } csr->mmioaddr[i] = _MMIO(dmc_header->mmioaddr[i]); csr->mmiodata[i] = dmc_header->mmiodata[i]; } /* fw_size is in dwords, so multiplied by 4 to convert into bytes. */ nbytes = dmc_header->fw_size * 4; if (nbytes > CSR_MAX_FW_SIZE) { DRM_ERROR("CSR firmware too big (%u) bytes\n", nbytes); return NULL; } csr->dmc_fw_size = dmc_header->fw_size; dmc_payload = kmalloc(nbytes, GFP_KERNEL); if (!dmc_payload) { DRM_ERROR("Memory allocation failed for dmc payload\n"); return NULL; } return memcpy(dmc_payload, &fw->data[readcount], nbytes); } static void csr_load_work_fn(struct work_struct *work) { struct drm_i915_private *dev_priv; struct intel_csr *csr; const struct firmware *fw = NULL; dev_priv = container_of(work, typeof(*dev_priv), csr.work); csr = &dev_priv->csr; request_firmware(&fw, dev_priv->csr.fw_path, &dev_priv->drm.pdev->dev); if (fw) dev_priv->csr.dmc_payload = parse_csr_fw(dev_priv, fw); if (dev_priv->csr.dmc_payload) { intel_csr_load_program(dev_priv); intel_display_power_put(dev_priv, POWER_DOMAIN_INIT); DRM_INFO("Finished loading DMC firmware %s (v%u.%u)\n", dev_priv->csr.fw_path, CSR_VERSION_MAJOR(csr->version), CSR_VERSION_MINOR(csr->version)); } else { dev_notice(dev_priv->drm.dev, "Failed to load DMC firmware" " [" FIRMWARE_URL "]," " disabling runtime power management.\n"); } release_firmware(fw); } /** * intel_csr_ucode_init() - initialize the firmware loading. * @dev_priv: i915 drm device. * * This function is called at the time of loading the display driver to read * firmware from a .bin file and copied into a internal memory. */ void intel_csr_ucode_init(struct drm_i915_private *dev_priv) { struct intel_csr *csr = &dev_priv->csr; INIT_WORK(&dev_priv->csr.work, csr_load_work_fn); if (!HAS_CSR(dev_priv)) return; if (IS_CANNONLAKE(dev_priv)) csr->fw_path = I915_CSR_CNL; else if (IS_GEMINILAKE(dev_priv)) csr->fw_path = I915_CSR_GLK; else if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv)) csr->fw_path = I915_CSR_KBL; else if (IS_SKYLAKE(dev_priv)) csr->fw_path = I915_CSR_SKL; else if (IS_BROXTON(dev_priv)) csr->fw_path = I915_CSR_BXT; else { DRM_ERROR("Unexpected: no known CSR firmware for platform\n"); return; } DRM_DEBUG_KMS("Loading %s\n", csr->fw_path); /* * Obtain a runtime pm reference, until CSR is loaded, * to avoid entering runtime-suspend. */ intel_display_power_get(dev_priv, POWER_DOMAIN_INIT); schedule_work(&dev_priv->csr.work); } /** * intel_csr_ucode_suspend() - prepare CSR firmware before system suspend * @dev_priv: i915 drm device * * Prepare the DMC firmware before entering system suspend. This includes * flushing pending work items and releasing any resources acquired during * init. */ void intel_csr_ucode_suspend(struct drm_i915_private *dev_priv) { if (!HAS_CSR(dev_priv)) return; flush_work(&dev_priv->csr.work); /* Drop the reference held in case DMC isn't loaded. */ if (!dev_priv->csr.dmc_payload) intel_display_power_put(dev_priv, POWER_DOMAIN_INIT); } /** * intel_csr_ucode_resume() - init CSR firmware during system resume * @dev_priv: i915 drm device * * Reinitialize the DMC firmware during system resume, reacquiring any * resources released in intel_csr_ucode_suspend(). */ void intel_csr_ucode_resume(struct drm_i915_private *dev_priv) { if (!HAS_CSR(dev_priv)) return; /* * Reacquire the reference to keep RPM disabled in case DMC isn't * loaded. */ if (!dev_priv->csr.dmc_payload) intel_display_power_get(dev_priv, POWER_DOMAIN_INIT); } /** * intel_csr_ucode_fini() - unload the CSR firmware. * @dev_priv: i915 drm device. * * Firmmware unloading includes freeing the internal memory and reset the * firmware loading status. */ void intel_csr_ucode_fini(struct drm_i915_private *dev_priv) { if (!HAS_CSR(dev_priv)) return; intel_csr_ucode_suspend(dev_priv); kfree(dev_priv->csr.dmc_payload); }
hannesweisbach/linux-atlas
drivers/gpu/drm/i915/intel_csr.c
C
gpl-2.0
14,230
/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef __Q6_ASM_H__ #define __Q6_ASM_H__ #include <mach/qdsp6v2/apr.h> #include <mach/msm_subsystem_map.h> #include <sound/apr_audio.h> #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION #include <linux/ion.h> #endif #define IN 0x000 #define OUT 0x001 #define CH_MODE_MONO 0x001 #define CH_MODE_STEREO 0x002 #define FORMAT_LINEAR_PCM 0x0000 #define FORMAT_DTMF 0x0001 #define FORMAT_ADPCM 0x0002 #define FORMAT_YADPCM 0x0003 #define FORMAT_MP3 0x0004 #define FORMAT_MPEG4_AAC 0x0005 #define FORMAT_AMRNB 0x0006 #define FORMAT_AMRWB 0x0007 #define FORMAT_V13K 0x0008 #define FORMAT_EVRC 0x0009 #define FORMAT_EVRCB 0x000a #define FORMAT_EVRCWB 0x000b #define FORMAT_MIDI 0x000c #define FORMAT_SBC 0x000d #define FORMAT_WMA_V10PRO 0x000e #define FORMAT_WMA_V9 0x000f #define FORMAT_AMR_WB_PLUS 0x0010 #define FORMAT_MPEG4_MULTI_AAC 0x0011 #define FORMAT_MULTI_CHANNEL_LINEAR_PCM 0x0012 #define ENCDEC_SBCBITRATE 0x0001 #define ENCDEC_IMMEDIATE_DECODE 0x0002 #define ENCDEC_CFG_BLK 0x0003 #define CMD_PAUSE 0x0001 #define CMD_FLUSH 0x0002 #define CMD_EOS 0x0003 #define CMD_CLOSE 0x0004 #define CMD_OUT_FLUSH 0x0005 /* bit 0:1 represents priority of stream */ #define STREAM_PRIORITY_NORMAL 0x0000 #define STREAM_PRIORITY_LOW 0x0001 #define STREAM_PRIORITY_HIGH 0x0002 /* bit 4 represents META enable of encoded data buffer */ #define BUFFER_META_ENABLE 0x0010 /* Enable Sample_Rate/Channel_Mode notification event from Decoder */ #define SR_CM_NOTIFY_ENABLE 0x0004 #define ASYNC_IO_MODE 0x0002 #define SYNC_IO_MODE 0x0001 #define NO_TIMESTAMP 0xFF00 #define SET_TIMESTAMP 0x0000 #define SOFT_PAUSE_ENABLE 1 #define SOFT_PAUSE_DISABLE 0 #define SESSION_MAX 0x08 #define SOFT_PAUSE_PERIOD 30 /* ramp up/down for 30ms */ #define SOFT_PAUSE_STEP 2000 /* Step value 2ms or 2000us */ enum { SOFT_PAUSE_CURVE_LINEAR = 0, SOFT_PAUSE_CURVE_EXP, SOFT_PAUSE_CURVE_LOG, }; #define SOFT_VOLUME_PERIOD 30 /* ramp up/down for 30ms */ #define SOFT_VOLUME_STEP 2000 /* Step value 2ms or 2000us */ enum { SOFT_VOLUME_CURVE_LINEAR = 0, SOFT_VOLUME_CURVE_EXP, SOFT_VOLUME_CURVE_LOG, }; typedef void (*app_cb)(uint32_t opcode, uint32_t token, uint32_t *payload, void *priv); struct audio_buffer { dma_addr_t phys; void *data; uint32_t used; uint32_t size;/* size of buffer */ uint32_t actual_size; /* actual number of bytes read by DSP */ #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION struct ion_handle *handle; struct ion_client *client; #else struct msm_mapped_buffer *mem_buffer; #endif }; struct audio_aio_write_param { unsigned long paddr; uint32_t uid; uint32_t len; uint32_t msw_ts; uint32_t lsw_ts; uint32_t flags; }; struct audio_aio_read_param { unsigned long paddr; uint32_t len; uint32_t uid; }; struct audio_port_data { struct audio_buffer *buf; uint32_t max_buf_cnt; uint32_t dsp_buf; uint32_t cpu_buf; /* read or write locks */ struct mutex lock; spinlock_t dsp_lock; }; struct audio_client { int session; /* idx:1 out port, 0: in port*/ struct audio_port_data port[2]; struct apr_svc *apr; struct mutex cmd_lock; atomic_t cmd_state; atomic_t time_flag; wait_queue_head_t cmd_wait; wait_queue_head_t time_wait; app_cb cb; void *priv; uint32_t io_mode; uint64_t time_stamp; }; void q6asm_audio_client_free(struct audio_client *ac); struct audio_client *q6asm_audio_client_alloc(app_cb cb, void *priv); struct audio_client *q6asm_get_audio_client(int session_id); int q6asm_audio_client_buf_alloc(unsigned int dir/* 1:Out,0:In */, struct audio_client *ac, unsigned int bufsz, unsigned int bufcnt); int q6asm_audio_client_buf_alloc_contiguous(unsigned int dir /* 1:Out,0:In */, struct audio_client *ac, unsigned int bufsz, unsigned int bufcnt); int q6asm_audio_client_buf_free_contiguous(unsigned int dir, struct audio_client *ac); int q6asm_open_read(struct audio_client *ac, uint32_t format); int q6asm_open_write(struct audio_client *ac, uint32_t format); int q6asm_open_read_write(struct audio_client *ac, uint32_t rd_format, uint32_t wr_format); int q6asm_write(struct audio_client *ac, uint32_t len, uint32_t msw_ts, uint32_t lsw_ts, uint32_t flags); int q6asm_write_nolock(struct audio_client *ac, uint32_t len, uint32_t msw_ts, uint32_t lsw_ts, uint32_t flags); int q6asm_async_write(struct audio_client *ac, struct audio_aio_write_param *param); int q6asm_async_read(struct audio_client *ac, struct audio_aio_read_param *param); int q6asm_read(struct audio_client *ac); int q6asm_read_nolock(struct audio_client *ac); int q6asm_memory_map(struct audio_client *ac, uint32_t buf_add, int dir, uint32_t bufsz, uint32_t bufcnt); int q6asm_memory_unmap(struct audio_client *ac, uint32_t buf_add, int dir); int q6asm_run(struct audio_client *ac, uint32_t flags, uint32_t msw_ts, uint32_t lsw_ts); int q6asm_run_nowait(struct audio_client *ac, uint32_t flags, uint32_t msw_ts, uint32_t lsw_ts); int q6asm_reg_tx_overflow(struct audio_client *ac, uint16_t enable); int q6asm_cmd(struct audio_client *ac, int cmd); int q6asm_cmd_nowait(struct audio_client *ac, int cmd); void *q6asm_is_cpu_buf_avail(int dir, struct audio_client *ac, uint32_t *size, uint32_t *idx); void *q6asm_is_cpu_buf_avail_nolock(int dir, struct audio_client *ac, uint32_t *size, uint32_t *idx); int q6asm_is_dsp_buf_avail(int dir, struct audio_client *ac); /* File format specific configurations to be added below */ int q6asm_enc_cfg_blk_aac(struct audio_client *ac, uint32_t frames_per_buf, uint32_t sample_rate, uint32_t channels, uint32_t bit_rate, uint32_t mode, uint32_t format); int q6asm_enc_cfg_blk_pcm(struct audio_client *ac, uint32_t rate, uint32_t channels); int q6asm_enable_sbrps(struct audio_client *ac, uint32_t sbr_ps); int q6asm_cfg_dual_mono_aac(struct audio_client *ac, uint16_t sce_left, uint16_t sce_right); int q6asm_set_encdec_chan_map(struct audio_client *ac, uint32_t num_channels); int q6asm_enc_cfg_blk_qcelp(struct audio_client *ac, uint32_t frames_per_buf, uint16_t min_rate, uint16_t max_rate, uint16_t reduced_rate_level, uint16_t rate_modulation_cmd); int q6asm_enc_cfg_blk_evrc(struct audio_client *ac, uint32_t frames_per_buf, uint16_t min_rate, uint16_t max_rate, uint16_t rate_modulation_cmd); int q6asm_enc_cfg_blk_amrnb(struct audio_client *ac, uint32_t frames_per_buf, uint16_t band_mode, uint16_t dtx_enable); int q6asm_enc_cfg_blk_amrwb(struct audio_client *ac, uint32_t frames_per_buf, uint16_t band_mode, uint16_t dtx_enable); int q6asm_media_format_block_pcm(struct audio_client *ac, uint32_t rate, uint32_t channels); int q6asm_media_format_block_multi_ch_pcm(struct audio_client *ac, uint32_t rate, uint32_t channels); int q6asm_media_format_block_aac(struct audio_client *ac, struct asm_aac_cfg *cfg); int q6asm_media_format_block_multi_aac(struct audio_client *ac, struct asm_aac_cfg *cfg); int q6asm_media_format_block_wma(struct audio_client *ac, void *cfg); int q6asm_media_format_block_wmapro(struct audio_client *ac, void *cfg); /* PP specific */ int q6asm_equalizer(struct audio_client *ac, void *eq); /* Send Volume Command */ int q6asm_set_volume(struct audio_client *ac, int volume); /* Set SoftPause Params */ int q6asm_set_softpause(struct audio_client *ac, struct asm_softpause_params *param); /* Set Softvolume Params */ int q6asm_set_softvolume(struct audio_client *ac, struct asm_softvolume_params *param); /* Send left-right channel gain */ int q6asm_set_lrgain(struct audio_client *ac, int left_gain, int right_gain); /* Enable Mute/unmute flag */ int q6asm_set_mute(struct audio_client *ac, int muteflag); uint64_t q6asm_get_session_time(struct audio_client *ac); /* Client can set the IO mode to either AIO/SIO mode */ int q6asm_set_io_mode(struct audio_client *ac, uint32_t mode); #ifdef CONFIG_RTAC /* Get Service ID for APR communication */ int q6asm_get_apr_service_id(int session_id); #endif /* Common format block without any payload */ int q6asm_media_format_block(struct audio_client *ac, uint32_t format); #endif /* __Q6_ASM_H__ */
CalcProgrammer1/ubuntu-kernel-quincyatt
include/sound/q6asm.h
C
gpl-2.0
8,960
/***************************************************************************/ /* */ /* aflatin2.c */ /* */ /* Auto-fitter hinting routines for latin script (body). */ /* */ /* Copyright 2003-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #include FT_ADVANCES_H #include "aflatin.h" #include "aflatin2.h" #include "aferrors.h" #ifdef AF_CONFIG_OPTION_USE_WARPER #include "afwarp.h" #endif /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ /* messages during execution. */ /* */ #undef FT_COMPONENT #define FT_COMPONENT trace_aflatin2 FT_LOCAL_DEF( FT_Error ) af_latin2_hints_compute_segments( AF_GlyphHints hints, AF_Dimension dim ); FT_LOCAL_DEF( void ) af_latin2_hints_link_segments( AF_GlyphHints hints, AF_Dimension dim ); /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** L A T I N G L O B A L M E T R I C S *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ FT_LOCAL_DEF( void ) af_latin2_metrics_init_widths( AF_LatinMetrics metrics, FT_Face face, FT_ULong charcode ) { /* scan the array of segments in each direction */ AF_GlyphHintsRec hints[1]; af_glyph_hints_init( hints, face->memory ); metrics->axis[AF_DIMENSION_HORZ].width_count = 0; metrics->axis[AF_DIMENSION_VERT].width_count = 0; { FT_Error error; FT_UInt glyph_index; int dim; AF_LatinMetricsRec dummy[1]; AF_Scaler scaler = &dummy->root.scaler; glyph_index = FT_Get_Char_Index( face, charcode ); if ( glyph_index == 0 ) goto Exit; error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); if ( error || face->glyph->outline.n_points <= 0 ) goto Exit; FT_ZERO( dummy ); dummy->units_per_em = metrics->units_per_em; scaler->x_scale = scaler->y_scale = 0x10000L; scaler->x_delta = scaler->y_delta = 0; scaler->face = face; scaler->render_mode = FT_RENDER_MODE_NORMAL; scaler->flags = 0; af_glyph_hints_rescale( hints, (AF_ScriptMetrics)dummy ); error = af_glyph_hints_reload( hints, &face->glyph->outline ); if ( error ) goto Exit; for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { AF_LatinAxis axis = &metrics->axis[dim]; AF_AxisHints axhints = &hints->axis[dim]; AF_Segment seg, limit, link; FT_UInt num_widths = 0; error = af_latin2_hints_compute_segments( hints, (AF_Dimension)dim ); if ( error ) goto Exit; af_latin2_hints_link_segments( hints, (AF_Dimension)dim ); seg = axhints->segments; limit = seg + axhints->num_segments; for ( ; seg < limit; seg++ ) { link = seg->link; /* we only consider stem segments there! */ if ( link && link->link == seg && link > seg ) { FT_Pos dist; dist = seg->pos - link->pos; if ( dist < 0 ) dist = -dist; if ( num_widths < AF_LATIN_MAX_WIDTHS ) axis->widths[num_widths++].org = dist; } } af_sort_widths( num_widths, axis->widths ); axis->width_count = num_widths; } Exit: for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { AF_LatinAxis axis = &metrics->axis[dim]; FT_Pos stdw; stdw = ( axis->width_count > 0 ) ? axis->widths[0].org : AF_LATIN_CONSTANT( metrics, 50 ); /* let's try 20% of the smallest width */ axis->edge_distance_threshold = stdw / 5; axis->standard_width = stdw; axis->extra_light = 0; } } af_glyph_hints_done( hints ); } #define AF_LATIN_MAX_TEST_CHARACTERS 12 static const char af_latin2_blue_chars[AF_LATIN_MAX_BLUES] [AF_LATIN_MAX_TEST_CHARACTERS+1] = { "THEZOCQS", "HEZLOCUS", "fijkdbh", "xzroesc", "xzroesc", "pqgjy" }; static void af_latin2_metrics_init_blues( AF_LatinMetrics metrics, FT_Face face ) { FT_Pos flats [AF_LATIN_MAX_TEST_CHARACTERS]; FT_Pos rounds[AF_LATIN_MAX_TEST_CHARACTERS]; FT_Int num_flats; FT_Int num_rounds; FT_Int bb; AF_LatinBlue blue; FT_Error error; AF_LatinAxis axis = &metrics->axis[AF_DIMENSION_VERT]; FT_GlyphSlot glyph = face->glyph; /* we compute the blues simply by loading each character from the */ /* 'af_latin2_blue_chars[blues]' string, then compute its top-most or */ /* bottom-most points (depending on `AF_IS_TOP_BLUE') */ FT_TRACE5(( "blue zones computation\n" )); FT_TRACE5(( "------------------------------------------------\n" )); for ( bb = 0; bb < AF_LATIN_BLUE_MAX; bb++ ) { const char* p = af_latin2_blue_chars[bb]; const char* limit = p + AF_LATIN_MAX_TEST_CHARACTERS; FT_Pos* blue_ref; FT_Pos* blue_shoot; FT_TRACE5(( "blue %3d: ", bb )); num_flats = 0; num_rounds = 0; for ( ; p < limit && *p; p++ ) { FT_UInt glyph_index; FT_Int best_point, best_y, best_first, best_last; FT_Vector* points; FT_Bool round; FT_TRACE5(( "'%c'", *p )); /* load the character in the face -- skip unknown or empty ones */ glyph_index = FT_Get_Char_Index( face, (FT_UInt)*p ); if ( glyph_index == 0 ) continue; error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); if ( error || glyph->outline.n_points <= 0 ) continue; /* now compute min or max point indices and coordinates */ points = glyph->outline.points; best_point = -1; best_y = 0; /* make compiler happy */ best_first = 0; /* ditto */ best_last = 0; /* ditto */ { FT_Int nn; FT_Int first = 0; FT_Int last = -1; for ( nn = 0; nn < glyph->outline.n_contours; first = last+1, nn++ ) { FT_Int old_best_point = best_point; FT_Int pp; last = glyph->outline.contours[nn]; /* Avoid single-point contours since they are never rasterized. */ /* In some fonts, they correspond to mark attachment points */ /* which are way outside of the glyph's real outline. */ if ( last == first ) continue; if ( AF_LATIN_IS_TOP_BLUE( bb ) ) { for ( pp = first; pp <= last; pp++ ) if ( best_point < 0 || points[pp].y > best_y ) { best_point = pp; best_y = points[pp].y; } } else { for ( pp = first; pp <= last; pp++ ) if ( best_point < 0 || points[pp].y < best_y ) { best_point = pp; best_y = points[pp].y; } } if ( best_point != old_best_point ) { best_first = first; best_last = last; } } FT_TRACE5(( "%5d", best_y )); } /* now check whether the point belongs to a straight or round */ /* segment; we first need to find in which contour the extremum */ /* lies, then inspect its previous and next points */ { FT_Int start, end, prev, next; FT_Pos dist; /* now look for the previous and next points that are not on the */ /* same Y coordinate. Threshold the `closeness'... */ start = end = best_point; do { prev = start-1; if ( prev < best_first ) prev = best_last; dist = points[prev].y - best_y; if ( dist < -5 || dist > 5 ) break; start = prev; } while ( start != best_point ); do { next = end+1; if ( next > best_last ) next = best_first; dist = points[next].y - best_y; if ( dist < -5 || dist > 5 ) break; end = next; } while ( end != best_point ); /* now, set the `round' flag depending on the segment's kind */ round = FT_BOOL( FT_CURVE_TAG( glyph->outline.tags[start] ) != FT_CURVE_TAG_ON || FT_CURVE_TAG( glyph->outline.tags[ end ] ) != FT_CURVE_TAG_ON ); FT_TRACE5(( "%c ", round ? 'r' : 'f' )); } if ( round ) rounds[num_rounds++] = best_y; else flats[num_flats++] = best_y; } FT_TRACE5(( "\n" )); if ( num_flats == 0 && num_rounds == 0 ) { /* * we couldn't find a single glyph to compute this blue zone, * we will simply ignore it then */ FT_TRACE5(( "empty\n" )); continue; } /* we have computed the contents of the `rounds' and `flats' tables, */ /* now determine the reference and overshoot position of the blue -- */ /* we simply take the median value after a simple sort */ af_sort_pos( num_rounds, rounds ); af_sort_pos( num_flats, flats ); blue = & axis->blues[axis->blue_count]; blue_ref = & blue->ref.org; blue_shoot = & blue->shoot.org; axis->blue_count++; if ( num_flats == 0 ) { *blue_ref = *blue_shoot = rounds[num_rounds / 2]; } else if ( num_rounds == 0 ) { *blue_ref = *blue_shoot = flats[num_flats / 2]; } else { *blue_ref = flats[num_flats / 2]; *blue_shoot = rounds[num_rounds / 2]; } /* there are sometimes problems: if the overshoot position of top */ /* zones is under its reference position, or the opposite for bottom */ /* zones. We must thus check everything there and correct the errors */ if ( *blue_shoot != *blue_ref ) { FT_Pos ref = *blue_ref; FT_Pos shoot = *blue_shoot; FT_Bool over_ref = FT_BOOL( shoot > ref ); if ( AF_LATIN_IS_TOP_BLUE( bb ) ^ over_ref ) *blue_shoot = *blue_ref = ( shoot + ref ) / 2; } blue->flags = 0; if ( AF_LATIN_IS_TOP_BLUE( bb ) ) blue->flags |= AF_LATIN_BLUE_TOP; /* * The following flags is used later to adjust the y and x scales * in order to optimize the pixel grid alignment of the top of small * letters. */ if ( bb == AF_LATIN_BLUE_SMALL_TOP ) blue->flags |= AF_LATIN_BLUE_ADJUSTMENT; FT_TRACE5(( "-- ref = %ld, shoot = %ld\n", *blue_ref, *blue_shoot )); } return; } FT_LOCAL_DEF( void ) af_latin2_metrics_check_digits( AF_LatinMetrics metrics, FT_Face face ) { FT_UInt i; FT_Bool started = 0, same_width = 1; FT_Fixed advance, old_advance = 0; /* check whether all ASCII digits have the same advance width; */ /* digit `0' is 0x30 in all supported charmaps */ for ( i = 0x30; i <= 0x39; i++ ) { FT_UInt glyph_index; glyph_index = FT_Get_Char_Index( face, i ); if ( glyph_index == 0 ) continue; if ( FT_Get_Advance( face, glyph_index, FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING | FT_LOAD_IGNORE_TRANSFORM, &advance ) ) continue; if ( started ) { if ( advance != old_advance ) { same_width = 0; break; } } else { old_advance = advance; started = 1; } } metrics->root.digits_have_same_width = same_width; } FT_LOCAL_DEF( FT_Error ) af_latin2_metrics_init( AF_LatinMetrics metrics, FT_Face face ) { FT_Error error = AF_Err_Ok; FT_CharMap oldmap = face->charmap; FT_UInt ee; static const FT_Encoding latin_encodings[] = { FT_ENCODING_UNICODE, FT_ENCODING_APPLE_ROMAN, FT_ENCODING_ADOBE_STANDARD, FT_ENCODING_ADOBE_LATIN_1, FT_ENCODING_NONE /* end of list */ }; metrics->units_per_em = face->units_per_EM; /* do we have a latin charmap in there? */ for ( ee = 0; latin_encodings[ee] != FT_ENCODING_NONE; ee++ ) { error = FT_Select_Charmap( face, latin_encodings[ee] ); if ( !error ) break; } if ( !error ) { /* For now, compute the standard width and height from the `o'. */ af_latin2_metrics_init_widths( metrics, face, 'o' ); af_latin2_metrics_init_blues( metrics, face ); af_latin2_metrics_check_digits( metrics, face ); } FT_Set_Charmap( face, oldmap ); return AF_Err_Ok; } static void af_latin2_metrics_scale_dim( AF_LatinMetrics metrics, AF_Scaler scaler, AF_Dimension dim ) { FT_Fixed scale; FT_Pos delta; AF_LatinAxis axis; FT_UInt nn; if ( dim == AF_DIMENSION_HORZ ) { scale = scaler->x_scale; delta = scaler->x_delta; } else { scale = scaler->y_scale; delta = scaler->y_delta; } axis = &metrics->axis[dim]; if ( axis->org_scale == scale && axis->org_delta == delta ) return; axis->org_scale = scale; axis->org_delta = delta; /* * correct Y scale to optimize the alignment of the top of small * letters to the pixel grid */ if ( dim == AF_DIMENSION_VERT ) { AF_LatinAxis vaxis = &metrics->axis[AF_DIMENSION_VERT]; AF_LatinBlue blue = NULL; for ( nn = 0; nn < vaxis->blue_count; nn++ ) { if ( vaxis->blues[nn].flags & AF_LATIN_BLUE_ADJUSTMENT ) { blue = &vaxis->blues[nn]; break; } } if ( blue ) { FT_Pos scaled = FT_MulFix( blue->shoot.org, scaler->y_scale ); FT_Pos fitted = ( scaled + 40 ) & ~63; #if 1 if ( scaled != fitted ) { scale = FT_MulDiv( scale, fitted, scaled ); FT_TRACE5(( "== scaled x-top = %.2g" " fitted = %.2g, scaling = %.4g\n", scaled / 64.0, fitted / 64.0, ( fitted * 1.0 ) / scaled )); } #endif } } axis->scale = scale; axis->delta = delta; if ( dim == AF_DIMENSION_HORZ ) { metrics->root.scaler.x_scale = scale; metrics->root.scaler.x_delta = delta; } else { metrics->root.scaler.y_scale = scale; metrics->root.scaler.y_delta = delta; } /* scale the standard widths */ for ( nn = 0; nn < axis->width_count; nn++ ) { AF_Width width = axis->widths + nn; width->cur = FT_MulFix( width->org, scale ); width->fit = width->cur; } /* an extra-light axis corresponds to a standard width that is */ /* smaller than 5/8 pixels */ axis->extra_light = (FT_Bool)( FT_MulFix( axis->standard_width, scale ) < 32 + 8 ); if ( dim == AF_DIMENSION_VERT ) { /* scale the blue zones */ for ( nn = 0; nn < axis->blue_count; nn++ ) { AF_LatinBlue blue = &axis->blues[nn]; FT_Pos dist; blue->ref.cur = FT_MulFix( blue->ref.org, scale ) + delta; blue->ref.fit = blue->ref.cur; blue->shoot.cur = FT_MulFix( blue->shoot.org, scale ) + delta; blue->shoot.fit = blue->shoot.cur; blue->flags &= ~AF_LATIN_BLUE_ACTIVE; /* a blue zone is only active if it is less than 3/4 pixels tall */ dist = FT_MulFix( blue->ref.org - blue->shoot.org, scale ); if ( dist <= 48 && dist >= -48 ) { FT_Pos delta1, delta2; delta1 = blue->shoot.org - blue->ref.org; delta2 = delta1; if ( delta1 < 0 ) delta2 = -delta2; delta2 = FT_MulFix( delta2, scale ); if ( delta2 < 32 ) delta2 = 0; else if ( delta2 < 64 ) delta2 = 32 + ( ( ( delta2 - 32 ) + 16 ) & ~31 ); else delta2 = FT_PIX_ROUND( delta2 ); if ( delta1 < 0 ) delta2 = -delta2; blue->ref.fit = FT_PIX_ROUND( blue->ref.cur ); blue->shoot.fit = blue->ref.fit + delta2; FT_TRACE5(( ">> activating blue zone %d:" " ref.cur=%.2g ref.fit=%.2g" " shoot.cur=%.2g shoot.fit=%.2g\n", nn, blue->ref.cur / 64.0, blue->ref.fit / 64.0, blue->shoot.cur / 64.0, blue->shoot.fit / 64.0 )); blue->flags |= AF_LATIN_BLUE_ACTIVE; } } } } FT_LOCAL_DEF( void ) af_latin2_metrics_scale( AF_LatinMetrics metrics, AF_Scaler scaler ) { metrics->root.scaler.render_mode = scaler->render_mode; metrics->root.scaler.face = scaler->face; metrics->root.scaler.flags = scaler->flags; af_latin2_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ ); af_latin2_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT ); } /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** L A T I N G L Y P H A N A L Y S I S *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ #define SORT_SEGMENTS FT_LOCAL_DEF( FT_Error ) af_latin2_hints_compute_segments( AF_GlyphHints hints, AF_Dimension dim ) { AF_AxisHints axis = &hints->axis[dim]; FT_Memory memory = hints->memory; FT_Error error = AF_Err_Ok; AF_Segment segment = NULL; AF_SegmentRec seg0; AF_Point* contour = hints->contours; AF_Point* contour_limit = contour + hints->num_contours; AF_Direction major_dir, segment_dir; FT_ZERO( &seg0 ); seg0.score = 32000; seg0.flags = AF_EDGE_NORMAL; major_dir = (AF_Direction)FT_ABS( axis->major_dir ); segment_dir = major_dir; axis->num_segments = 0; /* set up (u,v) in each point */ if ( dim == AF_DIMENSION_HORZ ) { AF_Point point = hints->points; AF_Point limit = point + hints->num_points; for ( ; point < limit; point++ ) { point->u = point->fx; point->v = point->fy; } } else { AF_Point point = hints->points; AF_Point limit = point + hints->num_points; for ( ; point < limit; point++ ) { point->u = point->fy; point->v = point->fx; } } /* do each contour separately */ for ( ; contour < contour_limit; contour++ ) { AF_Point point = contour[0]; AF_Point start = point; AF_Point last = point->prev; if ( point == last ) /* skip singletons -- just in case */ continue; /* already on an edge ?, backtrack to find its start */ if ( FT_ABS( point->in_dir ) == major_dir ) { point = point->prev; while ( point->in_dir == start->in_dir ) point = point->prev; } else /* otherwise, find first segment start, if any */ { while ( FT_ABS( point->out_dir ) != major_dir ) { point = point->next; if ( point == start ) goto NextContour; } } start = point; for (;;) { AF_Point first; FT_Pos min_u, min_v, max_u, max_v; /* we're at the start of a new segment */ FT_ASSERT( FT_ABS( point->out_dir ) == major_dir && point->in_dir != point->out_dir ); first = point; min_u = max_u = point->u; min_v = max_v = point->v; point = point->next; while ( point->out_dir == first->out_dir ) { point = point->next; if ( point->u < min_u ) min_u = point->u; if ( point->u > max_u ) max_u = point->u; } if ( point->v < min_v ) min_v = point->v; if ( point->v > max_v ) max_v = point->v; /* record new segment */ error = af_axis_hints_new_segment( axis, memory, &segment ); if ( error ) goto Exit; segment[0] = seg0; segment->dir = first->out_dir; segment->first = first; segment->last = point; segment->pos = (FT_Short)(( min_u + max_u ) >> 1); segment->min_coord = (FT_Short) min_v; segment->max_coord = (FT_Short) max_v; segment->height = (FT_Short)(max_v - min_v); /* a segment is round if it doesn't have successive */ /* on-curve points. */ { AF_Point pt = first; AF_Point last = point; AF_Flags f0 = (AF_Flags)(pt->flags & AF_FLAG_CONTROL); AF_Flags f1; segment->flags &= ~AF_EDGE_ROUND; for ( ; pt != last; f0 = f1 ) { pt = pt->next; f1 = (AF_Flags)(pt->flags & AF_FLAG_CONTROL); if ( !f0 && !f1 ) break; if ( pt == last ) segment->flags |= AF_EDGE_ROUND; } } /* this can happen in the case of a degenerate contour * e.g. a 2-point vertical contour */ if ( point == start ) break; /* jump to the start of the next segment, if any */ while ( FT_ABS(point->out_dir) != major_dir ) { point = point->next; if ( point == start ) goto NextContour; } } NextContour: ; } /* contours */ /* now slightly increase the height of segments when this makes */ /* sense -- this is used to better detect and ignore serifs */ { AF_Segment segments = axis->segments; AF_Segment segments_end = segments + axis->num_segments; for ( segment = segments; segment < segments_end; segment++ ) { AF_Point first = segment->first; AF_Point last = segment->last; AF_Point p; FT_Pos first_v = first->v; FT_Pos last_v = last->v; if ( first == last ) continue; if ( first_v < last_v ) { p = first->prev; if ( p->v < first_v ) segment->height = (FT_Short)( segment->height + ( ( first_v - p->v ) >> 1 ) ); p = last->next; if ( p->v > last_v ) segment->height = (FT_Short)( segment->height + ( ( p->v - last_v ) >> 1 ) ); } else { p = first->prev; if ( p->v > first_v ) segment->height = (FT_Short)( segment->height + ( ( p->v - first_v ) >> 1 ) ); p = last->next; if ( p->v < last_v ) segment->height = (FT_Short)( segment->height + ( ( last_v - p->v ) >> 1 ) ); } } } #ifdef AF_SORT_SEGMENTS /* place all segments with a negative direction to the start * of the array, used to speed up segment linking later... */ { AF_Segment segments = axis->segments; FT_UInt count = axis->num_segments; FT_UInt ii, jj; for (ii = 0; ii < count; ii++) { if ( segments[ii].dir > 0 ) { for (jj = ii+1; jj < count; jj++) { if ( segments[jj].dir < 0 ) { AF_SegmentRec tmp; tmp = segments[ii]; segments[ii] = segments[jj]; segments[jj] = tmp; break; } } if ( jj == count ) break; } } axis->mid_segments = ii; } #endif Exit: return error; } FT_LOCAL_DEF( void ) af_latin2_hints_link_segments( AF_GlyphHints hints, AF_Dimension dim ) { AF_AxisHints axis = &hints->axis[dim]; AF_Segment segments = axis->segments; AF_Segment segment_limit = segments + axis->num_segments; #ifdef AF_SORT_SEGMENTS AF_Segment segment_mid = segments + axis->mid_segments; #endif FT_Pos len_threshold, len_score; AF_Segment seg1, seg2; len_threshold = AF_LATIN_CONSTANT( hints->metrics, 8 ); if ( len_threshold == 0 ) len_threshold = 1; len_score = AF_LATIN_CONSTANT( hints->metrics, 6000 ); #ifdef AF_SORT_SEGMENTS for ( seg1 = segments; seg1 < segment_mid; seg1++ ) { if ( seg1->dir != axis->major_dir || seg1->first == seg1->last ) continue; for ( seg2 = segment_mid; seg2 < segment_limit; seg2++ ) #else /* now compare each segment to the others */ for ( seg1 = segments; seg1 < segment_limit; seg1++ ) { /* the fake segments are introduced to hint the metrics -- */ /* we must never link them to anything */ if ( seg1->dir != axis->major_dir || seg1->first == seg1->last ) continue; for ( seg2 = segments; seg2 < segment_limit; seg2++ ) if ( seg1->dir + seg2->dir == 0 && seg2->pos > seg1->pos ) #endif { FT_Pos pos1 = seg1->pos; FT_Pos pos2 = seg2->pos; FT_Pos dist = pos2 - pos1; if ( dist < 0 ) continue; { FT_Pos min = seg1->min_coord; FT_Pos max = seg1->max_coord; FT_Pos len, score; if ( min < seg2->min_coord ) min = seg2->min_coord; if ( max > seg2->max_coord ) max = seg2->max_coord; len = max - min; if ( len >= len_threshold ) { score = dist + len_score / len; if ( score < seg1->score ) { seg1->score = score; seg1->link = seg2; } if ( score < seg2->score ) { seg2->score = score; seg2->link = seg1; } } } } } #if 0 } #endif /* now, compute the `serif' segments */ for ( seg1 = segments; seg1 < segment_limit; seg1++ ) { seg2 = seg1->link; if ( seg2 ) { if ( seg2->link != seg1 ) { seg1->link = 0; seg1->serif = seg2->link; } } } } FT_LOCAL_DEF( FT_Error ) af_latin2_hints_compute_edges( AF_GlyphHints hints, AF_Dimension dim ) { AF_AxisHints axis = &hints->axis[dim]; FT_Error error = AF_Err_Ok; FT_Memory memory = hints->memory; AF_LatinAxis laxis = &((AF_LatinMetrics)hints->metrics)->axis[dim]; AF_Segment segments = axis->segments; AF_Segment segment_limit = segments + axis->num_segments; AF_Segment seg; AF_Direction up_dir; FT_Fixed scale; FT_Pos edge_distance_threshold; FT_Pos segment_length_threshold; axis->num_edges = 0; scale = ( dim == AF_DIMENSION_HORZ ) ? hints->x_scale : hints->y_scale; up_dir = ( dim == AF_DIMENSION_HORZ ) ? AF_DIR_UP : AF_DIR_RIGHT; /* * We want to ignore very small (mostly serif) segments, we do that * by ignoring those that whose length is less than a given fraction * of the standard width. If there is no standard width, we ignore * those that are less than a given size in pixels * * also, unlink serif segments that are linked to segments farther * than 50% of the standard width */ if ( dim == AF_DIMENSION_HORZ ) { if ( laxis->width_count > 0 ) segment_length_threshold = (laxis->standard_width * 10 ) >> 4; else segment_length_threshold = FT_DivFix( 64, hints->y_scale ); } else segment_length_threshold = 0; /*********************************************************************/ /* */ /* We will begin by generating a sorted table of edges for the */ /* current direction. To do so, we simply scan each segment and try */ /* to find an edge in our table that corresponds to its position. */ /* */ /* If no edge is found, we create and insert a new edge in the */ /* sorted table. Otherwise, we simply add the segment to the edge's */ /* list which will be processed in the second step to compute the */ /* edge's properties. */ /* */ /* Note that the edges table is sorted along the segment/edge */ /* position. */ /* */ /*********************************************************************/ edge_distance_threshold = FT_MulFix( laxis->edge_distance_threshold, scale ); if ( edge_distance_threshold > 64 / 4 ) edge_distance_threshold = 64 / 4; edge_distance_threshold = FT_DivFix( edge_distance_threshold, scale ); for ( seg = segments; seg < segment_limit; seg++ ) { AF_Edge found = 0; FT_Int ee; if ( seg->height < segment_length_threshold ) continue; /* A special case for serif edges: If they are smaller than */ /* 1.5 pixels we ignore them. */ if ( seg->serif ) { FT_Pos dist = seg->serif->pos - seg->pos; if (dist < 0) dist = -dist; if (dist >= laxis->standard_width >> 1) { /* unlink this serif, it is too distant from its reference stem */ seg->serif = NULL; } else if ( 2*seg->height < 3 * segment_length_threshold ) continue; } /* look for an edge corresponding to the segment */ for ( ee = 0; ee < axis->num_edges; ee++ ) { AF_Edge edge = axis->edges + ee; FT_Pos dist; dist = seg->pos - edge->fpos; if ( dist < 0 ) dist = -dist; if ( dist < edge_distance_threshold && edge->dir == seg->dir ) { found = edge; break; } } if ( !found ) { AF_Edge edge; /* insert a new edge in the list and */ /* sort according to the position */ error = af_axis_hints_new_edge( axis, seg->pos, seg->dir, memory, &edge ); if ( error ) goto Exit; /* add the segment to the new edge's list */ FT_ZERO( edge ); edge->first = seg; edge->last = seg; edge->fpos = seg->pos; edge->dir = seg->dir; edge->opos = edge->pos = FT_MulFix( seg->pos, scale ); seg->edge_next = seg; } else { /* if an edge was found, simply add the segment to the edge's */ /* list */ seg->edge_next = found->first; found->last->edge_next = seg; found->last = seg; } } /*********************************************************************/ /* */ /* Good, we will now compute each edge's properties according to */ /* segments found on its position. Basically, these are: */ /* */ /* - edge's main direction */ /* - stem edge, serif edge or both (which defaults to stem then) */ /* - rounded edge, straight or both (which defaults to straight) */ /* - link for edge */ /* */ /*********************************************************************/ /* first of all, set the `edge' field in each segment -- this is */ /* required in order to compute edge links */ /* * Note that removing this loop and setting the `edge' field of each * segment directly in the code above slows down execution speed for * some reasons on platforms like the Sun. */ { AF_Edge edges = axis->edges; AF_Edge edge_limit = edges + axis->num_edges; AF_Edge edge; for ( edge = edges; edge < edge_limit; edge++ ) { seg = edge->first; if ( seg ) do { seg->edge = edge; seg = seg->edge_next; } while ( seg != edge->first ); } /* now, compute each edge properties */ for ( edge = edges; edge < edge_limit; edge++ ) { FT_Int is_round = 0; /* does it contain round segments? */ FT_Int is_straight = 0; /* does it contain straight segments? */ #if 0 FT_Pos ups = 0; /* number of upwards segments */ FT_Pos downs = 0; /* number of downwards segments */ #endif seg = edge->first; do { FT_Bool is_serif; /* check for roundness of segment */ if ( seg->flags & AF_EDGE_ROUND ) is_round++; else is_straight++; #if 0 /* check for segment direction */ if ( seg->dir == up_dir ) ups += seg->max_coord-seg->min_coord; else downs += seg->max_coord-seg->min_coord; #endif /* check for links -- if seg->serif is set, then seg->link must */ /* be ignored */ is_serif = (FT_Bool)( seg->serif && seg->serif->edge && seg->serif->edge != edge ); if ( ( seg->link && seg->link->edge != NULL ) || is_serif ) { AF_Edge edge2; AF_Segment seg2; edge2 = edge->link; seg2 = seg->link; if ( is_serif ) { seg2 = seg->serif; edge2 = edge->serif; } if ( edge2 ) { FT_Pos edge_delta; FT_Pos seg_delta; edge_delta = edge->fpos - edge2->fpos; if ( edge_delta < 0 ) edge_delta = -edge_delta; seg_delta = seg->pos - seg2->pos; if ( seg_delta < 0 ) seg_delta = -seg_delta; if ( seg_delta < edge_delta ) edge2 = seg2->edge; } else edge2 = seg2->edge; if ( is_serif ) { edge->serif = edge2; edge2->flags |= AF_EDGE_SERIF; } else edge->link = edge2; } seg = seg->edge_next; } while ( seg != edge->first ); /* set the round/straight flags */ edge->flags = AF_EDGE_NORMAL; if ( is_round > 0 && is_round >= is_straight ) edge->flags |= AF_EDGE_ROUND; #if 0 /* set the edge's main direction */ edge->dir = AF_DIR_NONE; if ( ups > downs ) edge->dir = (FT_Char)up_dir; else if ( ups < downs ) edge->dir = (FT_Char)-up_dir; else if ( ups == downs ) edge->dir = 0; /* both up and down! */ #endif /* gets rid of serifs if link is set */ /* XXX: This gets rid of many unpleasant artefacts! */ /* Example: the `c' in cour.pfa at size 13 */ if ( edge->serif && edge->link ) edge->serif = 0; } } Exit: return error; } FT_LOCAL_DEF( FT_Error ) af_latin2_hints_detect_features( AF_GlyphHints hints, AF_Dimension dim ) { FT_Error error; error = af_latin2_hints_compute_segments( hints, dim ); if ( !error ) { af_latin2_hints_link_segments( hints, dim ); error = af_latin2_hints_compute_edges( hints, dim ); } return error; } FT_LOCAL_DEF( void ) af_latin2_hints_compute_blue_edges( AF_GlyphHints hints, AF_LatinMetrics metrics ) { AF_AxisHints axis = &hints->axis[AF_DIMENSION_VERT]; AF_Edge edge = axis->edges; AF_Edge edge_limit = edge + axis->num_edges; AF_LatinAxis latin = &metrics->axis[AF_DIMENSION_VERT]; FT_Fixed scale = latin->scale; FT_Pos best_dist0; /* initial threshold */ /* compute the initial threshold as a fraction of the EM size */ best_dist0 = FT_MulFix( metrics->units_per_em / 40, scale ); if ( best_dist0 > 64 / 2 ) best_dist0 = 64 / 2; /* compute which blue zones are active, i.e. have their scaled */ /* size < 3/4 pixels */ /* for each horizontal edge search the blue zone which is closest */ for ( ; edge < edge_limit; edge++ ) { FT_Int bb; AF_Width best_blue = NULL; FT_Pos best_dist = best_dist0; for ( bb = 0; bb < AF_LATIN_BLUE_MAX; bb++ ) { AF_LatinBlue blue = latin->blues + bb; FT_Bool is_top_blue, is_major_dir; /* skip inactive blue zones (i.e., those that are too small) */ if ( !( blue->flags & AF_LATIN_BLUE_ACTIVE ) ) continue; /* if it is a top zone, check for right edges -- if it is a bottom */ /* zone, check for left edges */ /* */ /* of course, that's for TrueType */ is_top_blue = (FT_Byte)( ( blue->flags & AF_LATIN_BLUE_TOP ) != 0 ); is_major_dir = FT_BOOL( edge->dir == axis->major_dir ); /* if it is a top zone, the edge must be against the major */ /* direction; if it is a bottom zone, it must be in the major */ /* direction */ if ( is_top_blue ^ is_major_dir ) { FT_Pos dist; AF_Width compare; /* if it's a rounded edge, compare it to the overshoot position */ /* if it's a flat edge, compare it to the reference position */ if ( edge->flags & AF_EDGE_ROUND ) compare = &blue->shoot; else compare = &blue->ref; dist = edge->fpos - compare->org; if (dist < 0) dist = -dist; dist = FT_MulFix( dist, scale ); if ( dist < best_dist ) { best_dist = dist; best_blue = compare; } #if 0 /* now, compare it to the overshoot position if the edge is */ /* rounded, and if the edge is over the reference position of a */ /* top zone, or under the reference position of a bottom zone */ if ( edge->flags & AF_EDGE_ROUND && dist != 0 ) { FT_Bool is_under_ref = FT_BOOL( edge->fpos < blue->ref.org ); if ( is_top_blue ^ is_under_ref ) { blue = latin->blues + bb; dist = edge->fpos - blue->shoot.org; if ( dist < 0 ) dist = -dist; dist = FT_MulFix( dist, scale ); if ( dist < best_dist ) { best_dist = dist; best_blue = & blue->shoot; } } } #endif } } if ( best_blue ) edge->blue_edge = best_blue; } } static FT_Error af_latin2_hints_init( AF_GlyphHints hints, AF_LatinMetrics metrics ) { FT_Render_Mode mode; FT_UInt32 scaler_flags, other_flags; FT_Face face = metrics->root.scaler.face; af_glyph_hints_rescale( hints, (AF_ScriptMetrics)metrics ); /* * correct x_scale and y_scale if needed, since they may have * been modified `af_latin2_metrics_scale_dim' above */ hints->x_scale = metrics->axis[AF_DIMENSION_HORZ].scale; hints->x_delta = metrics->axis[AF_DIMENSION_HORZ].delta; hints->y_scale = metrics->axis[AF_DIMENSION_VERT].scale; hints->y_delta = metrics->axis[AF_DIMENSION_VERT].delta; /* compute flags depending on render mode, etc. */ mode = metrics->root.scaler.render_mode; #if 0 /* #ifdef AF_CONFIG_OPTION_USE_WARPER */ if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V ) { metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL; } #endif scaler_flags = hints->scaler_flags; other_flags = 0; /* * We snap the width of vertical stems for the monochrome and * horizontal LCD rendering targets only. */ if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_HORZ_SNAP; /* * We snap the width of horizontal stems for the monochrome and * vertical LCD rendering targets only. */ if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V ) other_flags |= AF_LATIN_HINTS_VERT_SNAP; /* * We adjust stems to full pixels only if we don't use the `light' mode. */ if ( mode != FT_RENDER_MODE_LIGHT ) other_flags |= AF_LATIN_HINTS_STEM_ADJUST; if ( mode == FT_RENDER_MODE_MONO ) other_flags |= AF_LATIN_HINTS_MONO; /* * In `light' hinting mode we disable horizontal hinting completely. * We also do it if the face is italic. */ if ( mode == FT_RENDER_MODE_LIGHT || (face->style_flags & FT_STYLE_FLAG_ITALIC) != 0 ) scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; hints->scaler_flags = scaler_flags; hints->other_flags = other_flags; return 0; } /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** L A T I N G L Y P H G R I D - F I T T I N G *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ /* snap a given width in scaled coordinates to one of the */ /* current standard widths */ static FT_Pos af_latin2_snap_width( AF_Width widths, FT_Int count, FT_Pos width ) { int n; FT_Pos best = 64 + 32 + 2; FT_Pos reference = width; FT_Pos scaled; for ( n = 0; n < count; n++ ) { FT_Pos w; FT_Pos dist; w = widths[n].cur; dist = width - w; if ( dist < 0 ) dist = -dist; if ( dist < best ) { best = dist; reference = w; } } scaled = FT_PIX_ROUND( reference ); if ( width >= reference ) { if ( width < scaled + 48 ) width = reference; } else { if ( width > scaled - 48 ) width = reference; } return width; } /* compute the snapped width of a given stem */ static FT_Pos af_latin2_compute_stem_width( AF_GlyphHints hints, AF_Dimension dim, FT_Pos width, AF_Edge_Flags base_flags, AF_Edge_Flags stem_flags ) { AF_LatinMetrics metrics = (AF_LatinMetrics) hints->metrics; AF_LatinAxis axis = & metrics->axis[dim]; FT_Pos dist = width; FT_Int sign = 0; FT_Int vertical = ( dim == AF_DIMENSION_VERT ); FT_UNUSED(base_flags); if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) || axis->extra_light ) return width; if ( dist < 0 ) { dist = -width; sign = 1; } if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) { /* smooth hinting process: very lightly quantize the stem width */ /* leave the widths of serifs alone */ if ( ( stem_flags & AF_EDGE_SERIF ) && vertical && ( dist < 3 * 64 ) ) goto Done_Width; #if 0 else if ( ( base_flags & AF_EDGE_ROUND ) ) { if ( dist < 80 ) dist = 64; } else if ( dist < 56 ) dist = 56; #endif if ( axis->width_count > 0 ) { FT_Pos delta; /* compare to standard width */ if ( axis->width_count > 0 ) { delta = dist - axis->widths[0].cur; if ( delta < 0 ) delta = -delta; if ( delta < 40 ) { dist = axis->widths[0].cur; if ( dist < 48 ) dist = 48; goto Done_Width; } } if ( dist < 3 * 64 ) { delta = dist & 63; dist &= -64; if ( delta < 10 ) dist += delta; else if ( delta < 32 ) dist += 10; else if ( delta < 54 ) dist += 54; else dist += delta; } else dist = ( dist + 32 ) & ~63; } } else { /* strong hinting process: snap the stem width to integer pixels */ FT_Pos org_dist = dist; dist = af_latin2_snap_width( axis->widths, axis->width_count, dist ); if ( vertical ) { /* in the case of vertical hinting, always round */ /* the stem heights to integer pixels */ if ( dist >= 64 ) dist = ( dist + 16 ) & ~63; else dist = 64; } else { if ( AF_LATIN_HINTS_DO_MONO( hints ) ) { /* monochrome horizontal hinting: snap widths to integer pixels */ /* with a different threshold */ if ( dist < 64 ) dist = 64; else dist = ( dist + 32 ) & ~63; } else { /* for horizontal anti-aliased hinting, we adopt a more subtle */ /* approach: we strengthen small stems, round stems whose size */ /* is between 1 and 2 pixels to an integer, otherwise nothing */ if ( dist < 48 ) dist = ( dist + 64 ) >> 1; else if ( dist < 128 ) { /* We only round to an integer width if the corresponding */ /* distortion is less than 1/4 pixel. Otherwise this */ /* makes everything worse since the diagonals, which are */ /* not hinted, appear a lot bolder or thinner than the */ /* vertical stems. */ FT_Int delta; dist = ( dist + 22 ) & ~63; delta = dist - org_dist; if ( delta < 0 ) delta = -delta; if (delta >= 16) { dist = org_dist; if ( dist < 48 ) dist = ( dist + 64 ) >> 1; } } else /* round otherwise to prevent color fringes in LCD mode */ dist = ( dist + 32 ) & ~63; } } } Done_Width: if ( sign ) dist = -dist; return dist; } /* align one stem edge relative to the previous stem edge */ static void af_latin2_align_linked_edge( AF_GlyphHints hints, AF_Dimension dim, AF_Edge base_edge, AF_Edge stem_edge ) { FT_Pos dist = stem_edge->opos - base_edge->opos; FT_Pos fitted_width = af_latin2_compute_stem_width( hints, dim, dist, (AF_Edge_Flags)base_edge->flags, (AF_Edge_Flags)stem_edge->flags ); stem_edge->pos = base_edge->pos + fitted_width; FT_TRACE5(( "LINK: edge %d (opos=%.2f) linked to (%.2f), " "dist was %.2f, now %.2f\n", stem_edge-hints->axis[dim].edges, stem_edge->opos / 64.0, stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 )); } static void af_latin2_align_serif_edge( AF_GlyphHints hints, AF_Edge base, AF_Edge serif ) { FT_UNUSED( hints ); serif->pos = base->pos + (serif->opos - base->opos); } /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** E D G E H I N T I N G ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ FT_LOCAL_DEF( void ) af_latin2_hint_edges( AF_GlyphHints hints, AF_Dimension dim ) { AF_AxisHints axis = &hints->axis[dim]; AF_Edge edges = axis->edges; AF_Edge edge_limit = edges + axis->num_edges; AF_Edge edge; AF_Edge anchor = 0; FT_Int has_serifs = 0; FT_Pos anchor_drift = 0; FT_TRACE5(( "==== hinting %s edges =====\n", dim == AF_DIMENSION_HORZ ? "vertical" : "horizontal" )); /* we begin by aligning all stems relative to the blue zone */ /* if needed -- that's only for horizontal edges */ if ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_BLUES( hints ) ) { for ( edge = edges; edge < edge_limit; edge++ ) { AF_Width blue; AF_Edge edge1, edge2; if ( edge->flags & AF_EDGE_DONE ) continue; blue = edge->blue_edge; edge1 = NULL; edge2 = edge->link; if ( blue ) { edge1 = edge; } else if ( edge2 && edge2->blue_edge ) { blue = edge2->blue_edge; edge1 = edge2; edge2 = edge; } if ( !edge1 ) continue; FT_TRACE5(( "BLUE: edge %d (opos=%.2f) snapped to (%.2f), " "was (%.2f)\n", edge1-edges, edge1->opos / 64.0, blue->fit / 64.0, edge1->pos / 64.0 )); edge1->pos = blue->fit; edge1->flags |= AF_EDGE_DONE; if ( edge2 && !edge2->blue_edge ) { af_latin2_align_linked_edge( hints, dim, edge1, edge2 ); edge2->flags |= AF_EDGE_DONE; } if ( !anchor ) { anchor = edge; anchor_drift = (anchor->pos - anchor->opos); if (edge2) anchor_drift = (anchor_drift + (edge2->pos - edge2->opos)) >> 1; } } } /* now we will align all stem edges, trying to maintain the */ /* relative order of stems in the glyph */ for ( edge = edges; edge < edge_limit; edge++ ) { AF_Edge edge2; if ( edge->flags & AF_EDGE_DONE ) continue; /* skip all non-stem edges */ edge2 = edge->link; if ( !edge2 ) { has_serifs++; continue; } /* now align the stem */ /* this should not happen, but it's better to be safe */ if ( edge2->blue_edge ) { FT_TRACE5(( "ASSERTION FAILED for edge %d\n", edge2-edges )); af_latin2_align_linked_edge( hints, dim, edge2, edge ); edge->flags |= AF_EDGE_DONE; continue; } if ( !anchor ) { FT_Pos org_len, org_center, cur_len; FT_Pos cur_pos1, error1, error2, u_off, d_off; org_len = edge2->opos - edge->opos; cur_len = af_latin2_compute_stem_width( hints, dim, org_len, (AF_Edge_Flags)edge->flags, (AF_Edge_Flags)edge2->flags ); if ( cur_len <= 64 ) u_off = d_off = 32; else { u_off = 38; d_off = 26; } if ( cur_len < 96 ) { org_center = edge->opos + ( org_len >> 1 ); cur_pos1 = FT_PIX_ROUND( org_center ); error1 = org_center - ( cur_pos1 - u_off ); if ( error1 < 0 ) error1 = -error1; error2 = org_center - ( cur_pos1 + d_off ); if ( error2 < 0 ) error2 = -error2; if ( error1 < error2 ) cur_pos1 -= u_off; else cur_pos1 += d_off; edge->pos = cur_pos1 - cur_len / 2; edge2->pos = edge->pos + cur_len; } else edge->pos = FT_PIX_ROUND( edge->opos ); FT_TRACE5(( "ANCHOR: edge %d (opos=%.2f) and %d (opos=%.2f)" " snapped to (%.2f) (%.2f)\n", edge-edges, edge->opos / 64.0, edge2-edges, edge2->opos / 64.0, edge->pos / 64.0, edge2->pos / 64.0 )); anchor = edge; edge->flags |= AF_EDGE_DONE; af_latin2_align_linked_edge( hints, dim, edge, edge2 ); edge2->flags |= AF_EDGE_DONE; anchor_drift = ( (anchor->pos - anchor->opos) + (edge2->pos - edge2->opos)) >> 1; FT_TRACE5(( "DRIFT: %.2f\n", anchor_drift/64.0 )); } else { FT_Pos org_pos, org_len, org_center, cur_center, cur_len; FT_Pos org_left, org_right; org_pos = edge->opos + anchor_drift; org_len = edge2->opos - edge->opos; org_center = org_pos + ( org_len >> 1 ); cur_len = af_latin2_compute_stem_width( hints, dim, org_len, (AF_Edge_Flags)edge->flags, (AF_Edge_Flags)edge2->flags ); org_left = org_pos + ((org_len - cur_len) >> 1); org_right = org_pos + ((org_len + cur_len) >> 1); FT_TRACE5(( "ALIGN: left=%.2f right=%.2f ", org_left / 64.0, org_right / 64.0 )); cur_center = org_center; if ( edge2->flags & AF_EDGE_DONE ) { FT_TRACE5(( "\n" )); edge->pos = edge2->pos - cur_len; } else { /* we want to compare several displacement, and choose * the one that increases fitness while minimizing * distortion as well */ FT_Pos displacements[6], scores[6], org, fit, delta; FT_UInt count = 0; /* note: don't even try to fit tiny stems */ if ( cur_len < 32 ) { FT_TRACE5(( "tiny stem\n" )); goto AlignStem; } /* if the span is within a single pixel, don't touch it */ if ( FT_PIX_FLOOR(org_left) == FT_PIX_CEIL(org_right) ) { FT_TRACE5(( "single pixel stem\n" )); goto AlignStem; } if (cur_len <= 96) { /* we want to avoid the absolute worst case which is * when the left and right edges of the span each represent * about 50% of the gray. we'd better want to change this * to 25/75%, since this is much more pleasant to the eye with * very acceptable distortion */ FT_Pos frac_left = (org_left) & 63; FT_Pos frac_right = (org_right) & 63; if ( frac_left >= 22 && frac_left <= 42 && frac_right >= 22 && frac_right <= 42 ) { org = frac_left; fit = (org <= 32) ? 16 : 48; delta = FT_ABS(fit - org); displacements[count] = fit - org; scores[count++] = delta; FT_TRACE5(( "dispA=%.2f (%d) ", (fit - org) / 64.0, delta )); org = frac_right; fit = (org <= 32) ? 16 : 48; delta = FT_ABS(fit - org); displacements[count] = fit - org; scores[count++] = delta; FT_TRACE5(( "dispB=%.2f (%d) ", (fit - org) / 64.0, delta )); } } /* snapping the left edge to the grid */ org = org_left; fit = FT_PIX_ROUND(org); delta = FT_ABS(fit - org); displacements[count] = fit - org; scores[count++] = delta; FT_TRACE5(( "dispC=%.2f (%d) ", (fit - org) / 64.0, delta )); /* snapping the right edge to the grid */ org = org_right; fit = FT_PIX_ROUND(org); delta = FT_ABS(fit - org); displacements[count] = fit - org; scores[count++] = delta; FT_TRACE5(( "dispD=%.2f (%d) ", (fit - org) / 64.0, delta )); /* now find the best displacement */ { FT_Pos best_score = scores[0]; FT_Pos best_disp = displacements[0]; FT_UInt nn; for (nn = 1; nn < count; nn++) { if (scores[nn] < best_score) { best_score = scores[nn]; best_disp = displacements[nn]; } } cur_center = org_center + best_disp; } FT_TRACE5(( "\n" )); } AlignStem: edge->pos = cur_center - (cur_len >> 1); edge2->pos = edge->pos + cur_len; FT_TRACE5(( "STEM1: %d (opos=%.2f) to %d (opos=%.2f)" " snapped to (%.2f) and (%.2f)," " org_len=%.2f cur_len=%.2f\n", edge-edges, edge->opos / 64.0, edge2-edges, edge2->opos / 64.0, edge->pos / 64.0, edge2->pos / 64.0, org_len / 64.0, cur_len / 64.0 )); edge->flags |= AF_EDGE_DONE; edge2->flags |= AF_EDGE_DONE; if ( edge > edges && edge->pos < edge[-1].pos ) { FT_TRACE5(( "BOUND: %d (pos=%.2f) to (%.2f)\n", edge-edges, edge->pos / 64.0, edge[-1].pos / 64.0 )); edge->pos = edge[-1].pos; } } } /* make sure that lowercase m's maintain their symmetry */ /* In general, lowercase m's have six vertical edges if they are sans */ /* serif, or twelve if they are with serifs. This implementation is */ /* based on that assumption, and seems to work very well with most */ /* faces. However, if for a certain face this assumption is not */ /* true, the m is just rendered like before. In addition, any stem */ /* correction will only be applied to symmetrical glyphs (even if the */ /* glyph is not an m), so the potential for unwanted distortion is */ /* relatively low. */ /* We don't handle horizontal edges since we can't easily assure that */ /* the third (lowest) stem aligns with the base line; it might end up */ /* one pixel higher or lower. */ #if 0 { FT_Int n_edges = edge_limit - edges; if ( dim == AF_DIMENSION_HORZ && ( n_edges == 6 || n_edges == 12 ) ) { AF_Edge edge1, edge2, edge3; FT_Pos dist1, dist2, span, delta; if ( n_edges == 6 ) { edge1 = edges; edge2 = edges + 2; edge3 = edges + 4; } else { edge1 = edges + 1; edge2 = edges + 5; edge3 = edges + 9; } dist1 = edge2->opos - edge1->opos; dist2 = edge3->opos - edge2->opos; span = dist1 - dist2; if ( span < 0 ) span = -span; if ( span < 8 ) { delta = edge3->pos - ( 2 * edge2->pos - edge1->pos ); edge3->pos -= delta; if ( edge3->link ) edge3->link->pos -= delta; /* move the serifs along with the stem */ if ( n_edges == 12 ) { ( edges + 8 )->pos -= delta; ( edges + 11 )->pos -= delta; } edge3->flags |= AF_EDGE_DONE; if ( edge3->link ) edge3->link->flags |= AF_EDGE_DONE; } } } #endif if ( has_serifs || !anchor ) { /* * now hint the remaining edges (serifs and single) in order * to complete our processing */ for ( edge = edges; edge < edge_limit; edge++ ) { FT_Pos delta; if ( edge->flags & AF_EDGE_DONE ) continue; delta = 1000; if ( edge->serif ) { delta = edge->serif->opos - edge->opos; if ( delta < 0 ) delta = -delta; } if ( delta < 64 + 16 ) { af_latin2_align_serif_edge( hints, edge->serif, edge ); FT_TRACE5(( "SERIF: edge %d (opos=%.2f) serif to %d (opos=%.2f)" " aligned to (%.2f)\n", edge-edges, edge->opos / 64.0, edge->serif - edges, edge->serif->opos / 64.0, edge->pos / 64.0 )); } else if ( !anchor ) { FT_TRACE5(( "SERIF_ANCHOR: edge %d (opos=%.2f)" " snapped to (%.2f)\n", edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); edge->pos = FT_PIX_ROUND( edge->opos ); anchor = edge; } else { AF_Edge before, after; for ( before = edge - 1; before >= edges; before-- ) if ( before->flags & AF_EDGE_DONE ) break; for ( after = edge + 1; after < edge_limit; after++ ) if ( after->flags & AF_EDGE_DONE ) break; if ( before >= edges && before < edge && after < edge_limit && after > edge ) { if ( after->opos == before->opos ) edge->pos = before->pos; else edge->pos = before->pos + FT_MulDiv( edge->opos - before->opos, after->pos - before->pos, after->opos - before->opos ); FT_TRACE5(( "SERIF_LINK1: edge %d (opos=%.2f) snapped to (%.2f)" " from %d (opos=%.2f)\n", edge-edges, edge->opos / 64.0, edge->pos / 64.0, before - edges, before->opos / 64.0 )); } else { edge->pos = anchor->pos + ( ( edge->opos - anchor->opos + 16 ) & ~31 ); FT_TRACE5(( "SERIF_LINK2: edge %d (opos=%.2f)" " snapped to (%.2f)\n", edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); } } edge->flags |= AF_EDGE_DONE; if ( edge > edges && edge->pos < edge[-1].pos ) edge->pos = edge[-1].pos; if ( edge + 1 < edge_limit && edge[1].flags & AF_EDGE_DONE && edge->pos > edge[1].pos ) edge->pos = edge[1].pos; } } } static FT_Error af_latin2_hints_apply( AF_GlyphHints hints, FT_Outline* outline, AF_LatinMetrics metrics ) { FT_Error error; int dim; error = af_glyph_hints_reload( hints, outline ); if ( error ) goto Exit; /* analyze glyph outline */ #ifdef AF_CONFIG_OPTION_USE_WARPER if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT || AF_HINTS_DO_HORIZONTAL( hints ) ) #else if ( AF_HINTS_DO_HORIZONTAL( hints ) ) #endif { error = af_latin2_hints_detect_features( hints, AF_DIMENSION_HORZ ); if ( error ) goto Exit; } if ( AF_HINTS_DO_VERTICAL( hints ) ) { error = af_latin2_hints_detect_features( hints, AF_DIMENSION_VERT ); if ( error ) goto Exit; af_latin2_hints_compute_blue_edges( hints, metrics ); } /* grid-fit the outline */ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { #ifdef AF_CONFIG_OPTION_USE_WARPER if ( ( dim == AF_DIMENSION_HORZ && metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ) ) { AF_WarperRec warper; FT_Fixed scale; FT_Pos delta; af_warper_compute( &warper, hints, dim, &scale, &delta ); af_glyph_hints_scale_dim( hints, dim, scale, delta ); continue; } #endif if ( ( dim == AF_DIMENSION_HORZ && AF_HINTS_DO_HORIZONTAL( hints ) ) || ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) ) ) { af_latin2_hint_edges( hints, (AF_Dimension)dim ); af_glyph_hints_align_edge_points( hints, (AF_Dimension)dim ); af_glyph_hints_align_strong_points( hints, (AF_Dimension)dim ); af_glyph_hints_align_weak_points( hints, (AF_Dimension)dim ); } } af_glyph_hints_save( hints, outline ); Exit: return error; } /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** L A T I N S C R I P T C L A S S *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ static const AF_Script_UniRangeRec af_latin2_uniranges[] = { AF_UNIRANGE_REC( 32UL, 127UL ), /* TODO: Add new Unicode ranges here! */ AF_UNIRANGE_REC( 160UL, 255UL ), AF_UNIRANGE_REC( 0UL, 0UL ) }; AF_DEFINE_SCRIPT_CLASS( af_latin2_script_class, AF_SCRIPT_LATIN2, af_latin2_uniranges, sizeof ( AF_LatinMetricsRec ), (AF_Script_InitMetricsFunc) af_latin2_metrics_init, (AF_Script_ScaleMetricsFunc)af_latin2_metrics_scale, (AF_Script_DoneMetricsFunc) NULL, (AF_Script_InitHintsFunc) af_latin2_hints_init, (AF_Script_ApplyHintsFunc) af_latin2_hints_apply ) /* END */
freelsen/apv
pdfview/jni/freetype/src/autofit/aflatin2.c
C
gpl-3.0
70,528
YUI.add('moodle-core-formautosubmit', function (Y, NAME) { var CSS, FORMAUTOSUBMITNAME = 'core-formautosubmit', FORMAUTOSUBMIT, INITIALIZED = false; // The CSS selectors we use CSS = { AUTOSUBMIT : 'autosubmit' }; FORMAUTOSUBMIT = function() { FORMAUTOSUBMIT.superclass.constructor.apply(this, arguments); }; Y.extend(FORMAUTOSUBMIT, Y.Base, { /** * Initialize the module */ initializer : function() { // Set up local variables var applyto, thisselect; // We only apply the delegation once if (!INITIALIZED) { INITIALIZED = true; applyto = Y.one('body'); // We don't listen for change events by default as using the keyboard triggers these too. applyto.delegate('key', this.process_changes, 'press:13', 'select.' + CSS.AUTOSUBMIT, this); applyto.delegate('click', this.process_changes, 'select.' + CSS.AUTOSUBMIT, this); if (Y.UA.os === 'macintosh' && Y.UA.webkit) { // Macintosh webkit browsers like change events, but non-macintosh webkit browsers don't. applyto.delegate('change', this.process_changes, 'select.' + CSS.AUTOSUBMIT, this); } if (Y.UA.ios) { // IOS doesn't trigger click events because it's touch-based. applyto.delegate('change', this.process_changes, 'select.' + CSS.AUTOSUBMIT, this); } } // Assign this select items 'nothing' value and lastindex (current value) if (this.get('selectid')) { thisselect = Y.one('select#' + this.get('selectid')); if (thisselect) { if (this.get('nothing')) { thisselect.setData('nothing', this.get('nothing')); } thisselect.setData('startindex', thisselect.get('selectedIndex')); } else { Y.log("Warning: A single_select element was renderered, but the output is not displayed on the page."); } } }, /** * Check whether the select element was changed */ check_changed : function(e) { var select, nothing, startindex, currentindex, previousindex; select = e.target.ancestor('select.' + CSS.AUTOSUBMIT, true); if (!select) { return false; } nothing = select.getData('nothing'); startindex = select.getData('startindex'); currentindex = select.get('selectedIndex'); previousindex = select.getAttribute('data-previousindex'); select.setAttribute('data-previousindex', currentindex); if (!previousindex) { previousindex = startindex; } // Check whether the field has changed, and is not the 'nothing' value if ((nothing===false || select.get('value') !== nothing) && startindex !== select.get('selectedIndex') && currentindex !== previousindex) { return select; } return false; }, /** * Process any changes */ process_changes : function(e) { var select = this.check_changed(e), form; if (select) { form = select.ancestor('form', true); form.submit(); } } }, { NAME : FORMAUTOSUBMITNAME, ATTRS : { selectid : { 'value' : '' }, nothing : { 'value' : '' }, ignorechangeevent : { 'value' : false } } }); M.core = M.core || {}; M.core.init_formautosubmit = M.core.init_formautosubmit || function(config) { return new FORMAUTOSUBMIT(config); }; }, '@VERSION@', {"requires": ["base", "event-key"]});
sorted2323/msi
testauthorize/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-debug.js
JavaScript
gpl-3.0
3,807
url: http://sanskrit.uohyd.ac.in/cgi-bin/scl/sandhi_splitter/sandhi_splitter.cgi?encoding=Unicode&sandhi_type=s&word=तदुक्तम्<div id='finalout' style='border-style:solid; border-width:1px;padding:10px;color:blue;font-size:14px;height:200px'>तदुक्तम् = <a title = "तद् नपुं 1 एक/तद् नपुं 2 एक">तत्</a>+<a title = "उक्त पुं 2 एक/उक्त पुं 2 एक/उक्त नपुं 1 एक/उक्त नपुं 1 एक/उक्त नपुं 2 एक/उक्त नपुं 2 एक">उक्तम्</a>/<script type="text/javascript"> function toggleMe(a){ var e=document.getElementById(a); if(!e)return true; if(e.style.display=="none"){ e.style.display="block";document.getElementById("more").style.display="none"; document.getElementById("less").style.display="block"; } else{ e.style.display="none";document.getElementById("less").style.display="none"; document.getElementById("more").style.display="block"; } return true; } </script> <input type="button" onclick="return toggleMe('para1')" value="More" id="more"> <input type="button" onclick="return toggleMe('para1')" value="Less" id="less" style="display:none;" > <div id="para1" style="display:none; height:15px; border-style:none;border-width:1px;"> <a title = "तद् नपुं 1 एक/तद् नपुं 2 एक">तत्</a>+<a title = "उक्त पुं 2 एक/उक्त पुं 2 एक/उक्त नपुं 1 एक/उक्त नपुं 1 एक/उक्त नपुं 2 एक/उक्त नपुं 2 एक">उक्तम्</a>/<a title = "तद् नपुं 1 एक">तद्</a>+<a title = "उक्त पुं 2 एक/उक्त पुं 2 एक/उक्त नपुं 1 एक/उक्त नपुं 1 एक/उक्त नपुं 2 एक/उक्त नपुं 2 एक">उक्तम्</a>/</div><br />
sanskritiitd/sanskrit
uohCorpus.fil/uoh/uoh.filteredcorpus.txt_output/vyutpattivada-ext.txt.out.dict_18628_sam.html
HTML
gpl-3.0
1,988
<?php /** @version v5.20.9 21-Dec-2016 @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved. @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community Released under both BSD license and Lesser GPL library license. Whenever there is any discrepancy between the two licenses, the BSD license will take precedence. Set tabs to 4 for best viewing. DOCUMENTATION: See adodb/tests/test-datadict.php for docs and examples. */ /* Test script for parser */ // security - hide paths if (!defined('ADODB_DIR')) die(); function Lens_ParseTest() { $str = "`zcol ACOL` NUMBER(32,2) DEFAULT 'The \"cow\" (and Jim''s dog) jumps over the moon' PRIMARY, INTI INT AUTO DEFAULT 0, zcol2\"afs ds"; print "<p>$str</p>"; $a= Lens_ParseArgs($str); print "<pre>"; print_r($a); print "</pre>"; } if (!function_exists('ctype_alnum')) { function ctype_alnum($text) { return preg_match('/^[a-z0-9]*$/i', $text); } } //Lens_ParseTest(); /** Parse arguments, treat "text" (text) and 'text' as quotation marks. To escape, use "" or '' or )) Will read in "abc def" sans quotes, as: abc def Same with 'abc def'. However if `abc def`, then will read in as `abc def` @param endstmtchar Character that indicates end of statement @param tokenchars Include the following characters in tokens apart from A-Z and 0-9 @returns 2 dimensional array containing parsed tokens. */ function Lens_ParseArgs($args,$endstmtchar=',',$tokenchars='_.-') { $pos = 0; $intoken = false; $stmtno = 0; $endquote = false; $tokens = array(); $tokens[$stmtno] = array(); $max = strlen($args); $quoted = false; $tokarr = array(); while ($pos < $max) { $ch = substr($args,$pos,1); switch($ch) { case ' ': case "\t": case "\n": case "\r": if (!$quoted) { if ($intoken) { $intoken = false; $tokens[$stmtno][] = implode('',$tokarr); } break; } $tokarr[] = $ch; break; case '`': if ($intoken) $tokarr[] = $ch; case '(': case ')': case '"': case "'": if ($intoken) { if (empty($endquote)) { $tokens[$stmtno][] = implode('',$tokarr); if ($ch == '(') $endquote = ')'; else $endquote = $ch; $quoted = true; $intoken = true; $tokarr = array(); } else if ($endquote == $ch) { $ch2 = substr($args,$pos+1,1); if ($ch2 == $endquote) { $pos += 1; $tokarr[] = $ch2; } else { $quoted = false; $intoken = false; $tokens[$stmtno][] = implode('',$tokarr); $endquote = ''; } } else $tokarr[] = $ch; }else { if ($ch == '(') $endquote = ')'; else $endquote = $ch; $quoted = true; $intoken = true; $tokarr = array(); if ($ch == '`') $tokarr[] = '`'; } break; default: if (!$intoken) { if ($ch == $endstmtchar) { $stmtno += 1; $tokens[$stmtno] = array(); break; } $intoken = true; $quoted = false; $endquote = false; $tokarr = array(); } if ($quoted) $tokarr[] = $ch; else if (ctype_alnum($ch) || strpos($tokenchars,$ch) !== false) $tokarr[] = $ch; else { if ($ch == $endstmtchar) { $tokens[$stmtno][] = implode('',$tokarr); $stmtno += 1; $tokens[$stmtno] = array(); $intoken = false; $tokarr = array(); break; } $tokens[$stmtno][] = implode('',$tokarr); $tokens[$stmtno][] = $ch; $intoken = false; } } $pos += 1; } if ($intoken) $tokens[$stmtno][] = implode('',$tokarr); return $tokens; } class ADODB_DataDict { var $connection; var $debug = false; var $dropTable = 'DROP TABLE %s'; var $renameTable = 'RENAME TABLE %s TO %s'; var $dropIndex = 'DROP INDEX %s'; var $addCol = ' ADD'; var $alterCol = ' ALTER COLUMN'; var $dropCol = ' DROP COLUMN'; var $renameColumn = 'ALTER TABLE %s RENAME COLUMN %s TO %s'; // table, old-column, new-column, column-definitions (not used by default) var $nameRegex = '\w'; var $nameRegexBrackets = 'a-zA-Z0-9_\(\)'; var $schema = false; var $serverInfo = array(); var $autoIncrement = false; var $dataProvider; var $invalidResizeTypes4 = array('CLOB','BLOB','TEXT','DATE','TIME'); // for changetablesql var $blobSize = 100; /// any varchar/char field this size or greater is treated as a blob /// in other words, we use a text area for editting. function GetCommentSQL($table,$col) { return false; } function SetCommentSQL($table,$col,$cmt) { return false; } function MetaTables() { if (!$this->connection->IsConnected()) return array(); return $this->connection->MetaTables(); } function MetaColumns($tab, $upper=true, $schema=false) { if (!$this->connection->IsConnected()) return array(); return $this->connection->MetaColumns($this->TableName($tab), $upper, $schema); } function MetaPrimaryKeys($tab,$owner=false,$intkey=false) { if (!$this->connection->IsConnected()) return array(); return $this->connection->MetaPrimaryKeys($this->TableName($tab), $owner, $intkey); } function MetaIndexes($table, $primary = false, $owner = false) { if (!$this->connection->IsConnected()) return array(); return $this->connection->MetaIndexes($this->TableName($table), $primary, $owner); } function MetaType($t,$len=-1,$fieldobj=false) { static $typeMap = array( 'VARCHAR' => 'C', 'VARCHAR2' => 'C', 'CHAR' => 'C', 'C' => 'C', 'STRING' => 'C', 'NCHAR' => 'C', 'NVARCHAR' => 'C', 'VARYING' => 'C', 'BPCHAR' => 'C', 'CHARACTER' => 'C', 'INTERVAL' => 'C', # Postgres 'MACADDR' => 'C', # postgres 'VAR_STRING' => 'C', # mysql ## 'LONGCHAR' => 'X', 'TEXT' => 'X', 'NTEXT' => 'X', 'M' => 'X', 'X' => 'X', 'CLOB' => 'X', 'NCLOB' => 'X', 'LVARCHAR' => 'X', ## 'BLOB' => 'B', 'IMAGE' => 'B', 'BINARY' => 'B', 'VARBINARY' => 'B', 'LONGBINARY' => 'B', 'B' => 'B', ## 'YEAR' => 'D', // mysql 'DATE' => 'D', 'D' => 'D', ## 'UNIQUEIDENTIFIER' => 'C', # MS SQL Server ## 'TIME' => 'T', 'TIMESTAMP' => 'T', 'DATETIME' => 'T', 'TIMESTAMPTZ' => 'T', 'SMALLDATETIME' => 'T', 'T' => 'T', 'TIMESTAMP WITHOUT TIME ZONE' => 'T', // postgresql ## 'BOOL' => 'L', 'BOOLEAN' => 'L', 'BIT' => 'L', 'L' => 'L', ## 'COUNTER' => 'R', 'R' => 'R', 'SERIAL' => 'R', // ifx 'INT IDENTITY' => 'R', ## 'INT' => 'I', 'INT2' => 'I', 'INT4' => 'I', 'INT8' => 'I', 'INTEGER' => 'I', 'INTEGER UNSIGNED' => 'I', 'SHORT' => 'I', 'TINYINT' => 'I', 'SMALLINT' => 'I', 'I' => 'I', ## 'LONG' => 'N', // interbase is numeric, oci8 is blob 'BIGINT' => 'N', // this is bigger than PHP 32-bit integers 'DECIMAL' => 'N', 'DEC' => 'N', 'REAL' => 'N', 'DOUBLE' => 'N', 'DOUBLE PRECISION' => 'N', 'SMALLFLOAT' => 'N', 'FLOAT' => 'N', 'NUMBER' => 'N', 'NUM' => 'N', 'NUMERIC' => 'N', 'MONEY' => 'N', ## informix 9.2 'SQLINT' => 'I', 'SQLSERIAL' => 'I', 'SQLSMINT' => 'I', 'SQLSMFLOAT' => 'N', 'SQLFLOAT' => 'N', 'SQLMONEY' => 'N', 'SQLDECIMAL' => 'N', 'SQLDATE' => 'D', 'SQLVCHAR' => 'C', 'SQLCHAR' => 'C', 'SQLDTIME' => 'T', 'SQLINTERVAL' => 'N', 'SQLBYTES' => 'B', 'SQLTEXT' => 'X', ## informix 10 "SQLINT8" => 'I8', "SQLSERIAL8" => 'I8', "SQLNCHAR" => 'C', "SQLNVCHAR" => 'C', "SQLLVARCHAR" => 'X', "SQLBOOL" => 'L' ); if (!$this->connection->IsConnected()) { $t = strtoupper($t); if (isset($typeMap[$t])) return $typeMap[$t]; return 'N'; } return $this->connection->MetaType($t,$len,$fieldobj); } function NameQuote($name = NULL,$allowBrackets=false) { if (!is_string($name)) { return FALSE; } $name = trim($name); if ( !is_object($this->connection) ) { return $name; } $quote = $this->connection->nameQuote; // if name is of the form `name`, quote it if ( preg_match('/^`(.+)`$/', $name, $matches) ) { return $quote . $matches[1] . $quote; } // if name contains special characters, quote it $regex = ($allowBrackets) ? $this->nameRegexBrackets : $this->nameRegex; if ( !preg_match('/^[' . $regex . ']+$/', $name) ) { return $quote . $name . $quote; } return $name; } function TableName($name) { if ( $this->schema ) { return $this->NameQuote($this->schema) .'.'. $this->NameQuote($name); } return $this->NameQuote($name); } // Executes the sql array returned by GetTableSQL and GetIndexSQL function ExecuteSQLArray($sql, $continueOnError = true) { $rez = 2; $conn = $this->connection; $saved = $conn->debug; foreach($sql as $line) { if ($this->debug) $conn->debug = true; $ok = $conn->Execute($line); $conn->debug = $saved; if (!$ok) { if ($this->debug) ADOConnection::outp($conn->ErrorMsg()); if (!$continueOnError) return 0; $rez = 1; } } return $rez; } /** Returns the actual type given a character code. C: varchar X: CLOB (character large object) or largest varchar size if CLOB is not supported C2: Multibyte varchar X2: Multibyte CLOB B: BLOB (binary large object) D: Date T: Date-time L: Integer field suitable for storing booleans (0 or 1) I: Integer F: Floating point number N: Numeric or decimal number */ function ActualType($meta) { return $meta; } function CreateDatabase($dbname,$options=false) { $options = $this->_Options($options); $sql = array(); $s = 'CREATE DATABASE ' . $this->NameQuote($dbname); if (isset($options[$this->upperName])) $s .= ' '.$options[$this->upperName]; $sql[] = $s; return $sql; } /* Generates the SQL to create index. Returns an array of sql strings. */ function CreateIndexSQL($idxname, $tabname, $flds, $idxoptions = false) { if (!is_array($flds)) { $flds = explode(',',$flds); } foreach($flds as $key => $fld) { # some indexes can use partial fields, eg. index first 32 chars of "name" with NAME(32) $flds[$key] = $this->NameQuote($fld,$allowBrackets=true); } return $this->_IndexSQL($this->NameQuote($idxname), $this->TableName($tabname), $flds, $this->_Options($idxoptions)); } function DropIndexSQL ($idxname, $tabname = NULL) { return array(sprintf($this->dropIndex, $this->NameQuote($idxname), $this->TableName($tabname))); } function SetSchema($schema) { $this->schema = $schema; } function AddColumnSQL($tabname, $flds) { $tabname = $this->TableName ($tabname); $sql = array(); list($lines,$pkey,$idxs) = $this->_GenFields($flds); // genfields can return FALSE at times if ($lines == null) $lines = array(); $alter = 'ALTER TABLE ' . $tabname . $this->addCol . ' '; foreach($lines as $v) { $sql[] = $alter . $v; } if (is_array($idxs)) { foreach($idxs as $idx => $idxdef) { $sql_idxs = $this->CreateIndexSql($idx, $tabname, $idxdef['cols'], $idxdef['opts']); $sql = array_merge($sql, $sql_idxs); } } return $sql; } /** * Change the definition of one column * * As some DBM's can't do that on there own, you need to supply the complete defintion of the new table, * to allow, recreating the table and copying the content over to the new table * @param string $tabname table-name * @param string $flds column-name and type for the changed column * @param string $tableflds='' complete defintion of the new table, eg. for postgres, default '' * @param array/string $tableoptions='' options for the new table see CreateTableSQL, default '' * @return array with SQL strings */ function AlterColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') { $tabname = $this->TableName ($tabname); $sql = array(); list($lines,$pkey,$idxs) = $this->_GenFields($flds); // genfields can return FALSE at times if ($lines == null) $lines = array(); $alter = 'ALTER TABLE ' . $tabname . $this->alterCol . ' '; foreach($lines as $v) { $sql[] = $alter . $v; } if (is_array($idxs)) { foreach($idxs as $idx => $idxdef) { $sql_idxs = $this->CreateIndexSql($idx, $tabname, $idxdef['cols'], $idxdef['opts']); $sql = array_merge($sql, $sql_idxs); } } return $sql; } /** * Rename one column * * Some DBM's can only do this together with changeing the type of the column (even if that stays the same, eg. mysql) * @param string $tabname table-name * @param string $oldcolumn column-name to be renamed * @param string $newcolumn new column-name * @param string $flds='' complete column-defintion-string like for AddColumnSQL, only used by mysql atm., default='' * @return array with SQL strings */ function RenameColumnSQL($tabname,$oldcolumn,$newcolumn,$flds='') { $tabname = $this->TableName ($tabname); if ($flds) { list($lines,$pkey,$idxs) = $this->_GenFields($flds); // genfields can return FALSE at times if ($lines == null) $lines = array(); $first = current($lines); list(,$column_def) = preg_split("/[\t ]+/",$first,2); } return array(sprintf($this->renameColumn,$tabname,$this->NameQuote($oldcolumn),$this->NameQuote($newcolumn),$column_def)); } /** * Drop one column * * Some DBM's can't do that on there own, you need to supply the complete defintion of the new table, * to allow, recreating the table and copying the content over to the new table * @param string $tabname table-name * @param string $flds column-name and type for the changed column * @param string $tableflds='' complete defintion of the new table, eg. for postgres, default '' * @param array/string $tableoptions='' options for the new table see CreateTableSQL, default '' * @return array with SQL strings */ function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='') { $tabname = $this->TableName ($tabname); if (!is_array($flds)) $flds = explode(',',$flds); $sql = array(); $alter = 'ALTER TABLE ' . $tabname . $this->dropCol . ' '; foreach($flds as $v) { $sql[] = $alter . $this->NameQuote($v); } return $sql; } function DropTableSQL($tabname) { return array (sprintf($this->dropTable, $this->TableName($tabname))); } function RenameTableSQL($tabname,$newname) { return array (sprintf($this->renameTable, $this->TableName($tabname),$this->TableName($newname))); } /** Generate the SQL to create table. Returns an array of sql strings. */ function CreateTableSQL($tabname, $flds, $tableoptions=array()) { list($lines,$pkey,$idxs) = $this->_GenFields($flds, true); // genfields can return FALSE at times if ($lines == null) $lines = array(); $taboptions = $this->_Options($tableoptions); $tabname = $this->TableName ($tabname); $sql = $this->_TableSQL($tabname,$lines,$pkey,$taboptions); // ggiunta - 2006/10/12 - KLUDGE: // if we are on autoincrement, and table options includes REPLACE, the // autoincrement sequence has already been dropped on table creation sql, so // we avoid passing REPLACE to trigger creation code. This prevents // creating sql that double-drops the sequence if ($this->autoIncrement && isset($taboptions['REPLACE'])) unset($taboptions['REPLACE']); $tsql = $this->_Triggers($tabname,$taboptions); foreach($tsql as $s) $sql[] = $s; if (is_array($idxs)) { foreach($idxs as $idx => $idxdef) { $sql_idxs = $this->CreateIndexSql($idx, $tabname, $idxdef['cols'], $idxdef['opts']); $sql = array_merge($sql, $sql_idxs); } } return $sql; } function _GenFields($flds,$widespacing=false) { if (is_string($flds)) { $padding = ' '; $txt = $flds.$padding; $flds = array(); $flds0 = Lens_ParseArgs($txt,','); $hasparam = false; foreach($flds0 as $f0) { $f1 = array(); foreach($f0 as $token) { switch (strtoupper($token)) { case 'INDEX': $f1['INDEX'] = ''; // fall through intentionally case 'CONSTRAINT': case 'DEFAULT': $hasparam = $token; break; default: if ($hasparam) $f1[$hasparam] = $token; else $f1[] = $token; $hasparam = false; break; } } // 'index' token without a name means single column index: name it after column if (array_key_exists('INDEX', $f1) && $f1['INDEX'] == '') { $f1['INDEX'] = isset($f0['NAME']) ? $f0['NAME'] : $f0[0]; // check if column name used to create an index name was quoted if (($f1['INDEX'][0] == '"' || $f1['INDEX'][0] == "'" || $f1['INDEX'][0] == "`") && ($f1['INDEX'][0] == substr($f1['INDEX'], -1))) { $f1['INDEX'] = $f1['INDEX'][0].'idx_'.substr($f1['INDEX'], 1, -1).$f1['INDEX'][0]; } else $f1['INDEX'] = 'idx_'.$f1['INDEX']; } // reset it, so we don't get next field 1st token as INDEX... $hasparam = false; $flds[] = $f1; } } $this->autoIncrement = false; $lines = array(); $pkey = array(); $idxs = array(); foreach($flds as $fld) { $fld = _array_change_key_case($fld); $fname = false; $fdefault = false; $fautoinc = false; $ftype = false; $fsize = false; $fprec = false; $fprimary = false; $fnoquote = false; $fdefts = false; $fdefdate = false; $fconstraint = false; $fnotnull = false; $funsigned = false; $findex = ''; $funiqueindex = false; //----------------- // Parse attributes foreach($fld as $attr => $v) { if ($attr == 2 && is_numeric($v)) $attr = 'SIZE'; else if (is_numeric($attr) && $attr > 1 && !is_numeric($v)) $attr = strtoupper($v); switch($attr) { case '0': case 'NAME': $fname = $v; break; case '1': case 'TYPE': $ty = $v; $ftype = $this->ActualType(strtoupper($v)); break; case 'SIZE': $dotat = strpos($v,'.'); if ($dotat === false) $dotat = strpos($v,','); if ($dotat === false) $fsize = $v; else { $fsize = substr($v,0,$dotat); $fprec = substr($v,$dotat+1); } break; case 'UNSIGNED': $funsigned = true; break; case 'AUTOINCREMENT': case 'AUTO': $fautoinc = true; $fnotnull = true; break; case 'KEY': // a primary key col can be non unique in itself (if key spans many cols...) case 'PRIMARY': $fprimary = $v; $fnotnull = true; /*$funiqueindex = true;*/ break; case 'DEF': case 'DEFAULT': $fdefault = $v; break; case 'NOTNULL': $fnotnull = $v; break; case 'NOQUOTE': $fnoquote = $v; break; case 'DEFDATE': $fdefdate = $v; break; case 'DEFTIMESTAMP': $fdefts = $v; break; case 'CONSTRAINT': $fconstraint = $v; break; // let INDEX keyword create a 'very standard' index on column case 'INDEX': $findex = $v; break; case 'UNIQUE': $funiqueindex = true; break; } //switch } // foreach $fld //-------------------- // VALIDATE FIELD INFO if (!strlen($fname)) { if ($this->debug) ADOConnection::outp("Undefined NAME"); return false; } $fid = strtoupper(preg_replace('/^`(.+)`$/', '$1', $fname)); $fname = $this->NameQuote($fname); if (!strlen($ftype)) { if ($this->debug) ADOConnection::outp("Undefined TYPE for field '$fname'"); return false; } else { $ftype = strtoupper($ftype); } $ftype = $this->_GetSize($ftype, $ty, $fsize, $fprec); if ($ty == 'X' || $ty == 'X2' || $ty == 'B') $fnotnull = false; // some blob types do not accept nulls if ($fprimary) $pkey[] = $fname; // some databases do not allow blobs to have defaults if ($ty == 'X') $fdefault = false; // build list of indexes if ($findex != '') { if (array_key_exists($findex, $idxs)) { $idxs[$findex]['cols'][] = ($fname); if (in_array('UNIQUE', $idxs[$findex]['opts']) != $funiqueindex) { if ($this->debug) ADOConnection::outp("Index $findex defined once UNIQUE and once not"); } if ($funiqueindex && !in_array('UNIQUE', $idxs[$findex]['opts'])) $idxs[$findex]['opts'][] = 'UNIQUE'; } else { $idxs[$findex] = array(); $idxs[$findex]['cols'] = array($fname); if ($funiqueindex) $idxs[$findex]['opts'] = array('UNIQUE'); else $idxs[$findex]['opts'] = array(); } } //-------------------- // CONSTRUCT FIELD SQL if ($fdefts) { if (substr($this->connection->databaseType,0,5) == 'mysql') { $ftype = 'TIMESTAMP'; } else { $fdefault = $this->connection->sysTimeStamp; } } else if ($fdefdate) { if (substr($this->connection->databaseType,0,5) == 'mysql') { $ftype = 'TIMESTAMP'; } else { $fdefault = $this->connection->sysDate; } } else if ($fdefault !== false && !$fnoquote) { if ($ty == 'C' or $ty == 'X' or ( substr($fdefault,0,1) != "'" && !is_numeric($fdefault))) { if (($ty == 'D' || $ty == 'T') && strtolower($fdefault) != 'null') { // convert default date into database-aware code if ($ty == 'T') { $fdefault = $this->connection->DBTimeStamp($fdefault); } else { $fdefault = $this->connection->DBDate($fdefault); } } else if (strlen($fdefault) != 1 && substr($fdefault,0,1) == ' ' && substr($fdefault,strlen($fdefault)-1) == ' ') $fdefault = trim($fdefault); else if (strtolower($fdefault) != 'null') $fdefault = $this->connection->qstr($fdefault); } } $suffix = $this->_CreateSuffix($fname,$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned); // add index creation if ($widespacing) $fname = str_pad($fname,24); // check for field names appearing twice if (array_key_exists($fid, $lines)) { ADOConnection::outp("Field '$fname' defined twice"); } $lines[$fid] = $fname.' '.$ftype.$suffix; if ($fautoinc) $this->autoIncrement = true; } // foreach $flds return array($lines,$pkey,$idxs); } /** GENERATE THE SIZE PART OF THE DATATYPE $ftype is the actual type $ty is the type defined originally in the DDL */ function _GetSize($ftype, $ty, $fsize, $fprec) { if (strlen($fsize) && $ty != 'X' && $ty != 'B' && strpos($ftype,'(') === false) { $ftype .= "(".$fsize; if (strlen($fprec)) $ftype .= ",".$fprec; $ftype .= ')'; } return $ftype; } // return string must begin with space function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned) { $suffix = ''; if (strlen($fdefault)) $suffix .= " DEFAULT $fdefault"; if ($fnotnull) $suffix .= ' NOT NULL'; if ($fconstraint) $suffix .= ' '.$fconstraint; return $suffix; } function _IndexSQL($idxname, $tabname, $flds, $idxoptions) { $sql = array(); if ( isset($idxoptions['REPLACE']) || isset($idxoptions['DROP']) ) { $sql[] = sprintf ($this->dropIndex, $idxname); if ( isset($idxoptions['DROP']) ) return $sql; } if ( empty ($flds) ) { return $sql; } $unique = isset($idxoptions['UNIQUE']) ? ' UNIQUE' : ''; $s = 'CREATE' . $unique . ' INDEX ' . $idxname . ' ON ' . $tabname . ' '; if ( isset($idxoptions[$this->upperName]) ) $s .= $idxoptions[$this->upperName]; if ( is_array($flds) ) $flds = implode(', ',$flds); $s .= '(' . $flds . ')'; $sql[] = $s; return $sql; } function _DropAutoIncrement($tabname) { return false; } function _TableSQL($tabname,$lines,$pkey,$tableoptions) { $sql = array(); if (isset($tableoptions['REPLACE']) || isset ($tableoptions['DROP'])) { $sql[] = sprintf($this->dropTable,$tabname); if ($this->autoIncrement) { $sInc = $this->_DropAutoIncrement($tabname); if ($sInc) $sql[] = $sInc; } if ( isset ($tableoptions['DROP']) ) { return $sql; } } $s = "CREATE TABLE $tabname (\n"; $s .= implode(",\n", $lines); if (sizeof($pkey)>0) { $s .= ",\n PRIMARY KEY ("; $s .= implode(", ",$pkey).")"; } if (isset($tableoptions['CONSTRAINTS'])) $s .= "\n".$tableoptions['CONSTRAINTS']; if (isset($tableoptions[$this->upperName.'_CONSTRAINTS'])) $s .= "\n".$tableoptions[$this->upperName.'_CONSTRAINTS']; $s .= "\n)"; if (isset($tableoptions[$this->upperName])) $s .= $tableoptions[$this->upperName]; $sql[] = $s; return $sql; } /** GENERATE TRIGGERS IF NEEDED used when table has auto-incrementing field that is emulated using triggers */ function _Triggers($tabname,$taboptions) { return array(); } /** Sanitize options, so that array elements with no keys are promoted to keys */ function _Options($opts) { if (!is_array($opts)) return array(); $newopts = array(); foreach($opts as $k => $v) { if (is_numeric($k)) $newopts[strtoupper($v)] = $v; else $newopts[strtoupper($k)] = $v; } return $newopts; } function _getSizePrec($size) { $fsize = false; $fprec = false; $dotat = strpos($size,'.'); if ($dotat === false) $dotat = strpos($size,','); if ($dotat === false) $fsize = $size; else { $fsize = substr($size,0,$dotat); $fprec = substr($size,$dotat+1); } return array($fsize, $fprec); } /** "Florian Buzin [ easywe ]" <florian.buzin#easywe.de> This function changes/adds new fields to your table. You don't have to know if the col is new or not. It will check on its own. */ function ChangeTableSQL($tablename, $flds, $tableoptions = false, $dropOldFlds=false) { global $ADODB_FETCH_MODE; $save = $ADODB_FETCH_MODE; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; if ($this->connection->fetchMode !== false) $savem = $this->connection->SetFetchMode(false); // check table exists $save_handler = $this->connection->raiseErrorFn; $this->connection->raiseErrorFn = ''; $cols = $this->MetaColumns($tablename); $this->connection->raiseErrorFn = $save_handler; if (isset($savem)) $this->connection->SetFetchMode($savem); $ADODB_FETCH_MODE = $save; if ( empty($cols)) { return $this->CreateTableSQL($tablename, $flds, $tableoptions); } if (is_array($flds)) { // Cycle through the update fields, comparing // existing fields to fields to update. // if the Metatype and size is exactly the // same, ignore - by Mark Newham $holdflds = array(); foreach($flds as $k=>$v) { if ( isset($cols[$k]) && is_object($cols[$k]) ) { // If already not allowing nulls, then don't change $obj = $cols[$k]; if (isset($obj->not_null) && $obj->not_null) $v = str_replace('NOT NULL','',$v); if (isset($obj->auto_increment) && $obj->auto_increment && empty($v['AUTOINCREMENT'])) $v = str_replace('AUTOINCREMENT','',$v); $c = $cols[$k]; $ml = $c->max_length; $mt = $this->MetaType($c->type,$ml); if (isset($c->scale)) $sc = $c->scale; else $sc = 99; // always force change if scale not known. if ($sc == -1) $sc = false; list($fsize, $fprec) = $this->_getSizePrec($v['SIZE']); if ($ml == -1) $ml = ''; if ($mt == 'X') $ml = $v['SIZE']; if (($mt != $v['TYPE']) || ($ml != $fsize || $sc != $fprec) || (isset($v['AUTOINCREMENT']) && $v['AUTOINCREMENT'] != $obj->auto_increment)) { $holdflds[$k] = $v; } } else { $holdflds[$k] = $v; } } $flds = $holdflds; } // already exists, alter table instead list($lines,$pkey,$idxs) = $this->_GenFields($flds); // genfields can return FALSE at times if ($lines == null) $lines = array(); $alter = 'ALTER TABLE ' . $this->TableName($tablename); $sql = array(); foreach ( $lines as $id => $v ) { if ( isset($cols[$id]) && is_object($cols[$id]) ) { $flds = Lens_ParseArgs($v,','); // We are trying to change the size of the field, if not allowed, simply ignore the request. // $flds[1] holds the type, $flds[2] holds the size -postnuke addition if ($flds && in_array(strtoupper(substr($flds[0][1],0,4)),$this->invalidResizeTypes4) && (isset($flds[0][2]) && is_numeric($flds[0][2]))) { if ($this->debug) ADOConnection::outp(sprintf("<h3>%s cannot be changed to %s currently</h3>", $flds[0][0], $flds[0][1])); #echo "<h3>$this->alterCol cannot be changed to $flds currently</h3>"; continue; } $sql[] = $alter . $this->alterCol . ' ' . $v; } else { $sql[] = $alter . $this->addCol . ' ' . $v; } } if ($dropOldFlds) { foreach ( $cols as $id => $v ) if ( !isset($lines[$id]) ) $sql[] = $alter . $this->dropCol . ' ' . $v->name; } return $sql; } } // class
crazyserver/moodle
lib/adodb/adodb-datadict.inc.php
PHP
gpl-3.0
28,121
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * This package provides Genetic Algorithms components and implementations. */ package org.apache.commons.math3.genetics;
happyjack27/autoredistrict
src/org/apache/commons/math3/genetics/package-info.java
Java
gpl-3.0
930
<!DOCTYPE html> <html lang="en" > <head> <meta charset="utf-8"/> <title>CSS3 Text, linebreaks: U+1C3C LEPCHA PUNCTUATION NYET THYOOM TA-ROL</title> <link rel='author' title='Richard Ishida' href='mailto:[email protected]'> <link rel='help' href='https://drafts.csswg.org/css-text-3/#line-breaking'> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <meta name='flags' content='dom'> <meta name="assert" content="[Exploratory] The browser will break a line of text after any Unicode character with the BA Other Terminating Punctuation property."> <style type='text/css'> @font-face { font-family: 'csstest_ascii'; src: url('support/csstest-ascii-webfont.woff') format('woff'); font-weight: normal; font-style: normal; } #breakable { font-family: csstest_ascii; font-size: 25px; width: 800px; line-height: 30px; } </style> </head> <body> <div class="test"> <div id="breakable">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&#x1C3C;bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb</div> </div> <!--Notes: Box height: <span id='debugresult'></span><script>document.getElementById('debugresult').innerHTML = document.getElementById('breakable').offsetHeight;</script> --> <script> test(function() { assert_true(document.getElementById('breakable').offsetHeight > 35); }, " "); </script> <div id='log'></div> </body> </html>
anthgur/servo
tests/wpt/web-platform-tests/css/css-text/i18n/css3-text-line-break-baspglwj-098.html
HTML
mpl-2.0
1,379
# # Copyright (C) 2011 - 2014 Instructure, Inc. # # This file is part of Canvas. # # Canvas is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. # class GroupLeadership attr_reader :group def initialize(target_group) @group = target_group end def member_changed_event(membership) revoke_leadership_if_necessary(membership) propogate_event_for_prior_groups(membership) if auto_leader_enabled? && leadership_spot_empty? auto_assign!(category.auto_leader) end end def auto_assign!(strategy) return if valid_leader_in_place? group.update_attribute(:leader, select_leader(strategy)) end private def select_leader(strategy) return users.first if strategy == "first" return users.sample if strategy == "random" raise(ArgumentError, "Unknown auto leader strategy: '#{strategy}'") end def valid_leader_in_place? group.leader.present? && member_ids.include?(group.leader_id) end def propogate_event_for_prior_groups(membership) old_id = membership.old_group_id if old_id && old_id != group.id propogation_target = self.class.new(Group.find(membership.old_group_id)) propogation_target.member_changed_event(membership) end end def leadership_spot_empty? group.reload.leader_id.nil? end def auto_leader_enabled? category && category.auto_leader.present? end def revoke_leadership_if_necessary(membership) if no_longer_member?(membership) user_id = membership.user_id group.update_attribute(:leader_id, nil) if group.leader_id == user_id end end def no_longer_member?(membership) !membership_ids.include?(membership.id) end def category group.group_category end def users group.users end def member_ids group.group_memberships.pluck(:user_id) end def membership_ids group.reload.group_memberships.pluck(:id) end end
dgynn/canvas-lms
app/models/group_leadership.rb
Ruby
agpl-3.0
2,431
/* * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.util.xml; import com.intellij.openapi.module.Module; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.JavaPsiFacade; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiFile; import com.intellij.psi.search.GlobalSearchScope; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * @author peter */ public class DomJavaUtil { private DomJavaUtil() { } @Nullable public static PsiClass findClass(@Nullable String name, @NotNull PsiFile file, @Nullable final Module module, @Nullable final GlobalSearchScope searchScope) { if (name == null) return null; if (name.indexOf('$')>=0) name = name.replace('$', '.'); final GlobalSearchScope scope; if (searchScope == null) { if (module != null) { file = file.getOriginalFile(); VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) { scope = GlobalSearchScope.moduleRuntimeScope(module, true); } else { ProjectFileIndex fileIndex = ProjectRootManager.getInstance(file.getProject()).getFileIndex(); boolean tests = fileIndex.isInTestSourceContent(virtualFile); scope = module.getModuleRuntimeScope(tests); } } else { scope = file.getResolveScope(); } } else { scope = searchScope; } final PsiClass aClass = JavaPsiFacade.getInstance(file.getProject()).findClass(name, scope); if (aClass != null) { assert aClass.isValid() : name; } return aClass; } @Nullable public static PsiClass findClass(@Nullable String name, @NotNull DomElement element) { assert element.isValid(); if (DomUtil.hasXml(element)) { return findClass(name, DomUtil.getFile(element), element.getModule(), element.getResolveScope()); } return null; } }
caot/intellij-community
java/openapi/src/com/intellij/util/xml/DomJavaUtil.java
Java
apache-2.0
2,595
/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ package org.elasticsearch.xpack.watcher.client; import org.elasticsearch.xpack.core.watcher.client.WatchSourceBuilder; public final class WatchSourceBuilders { private WatchSourceBuilders() { } public static WatchSourceBuilder watchBuilder() { return new WatchSourceBuilder(); } }
gfyoung/elasticsearch
x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/client/WatchSourceBuilders.java
Java
apache-2.0
551
require File.expand_path("../spec_helper", __FILE__) module Selenium module WebDriver describe Error do context "backwards compatibility" do it "aliases StaleElementReferenceError as ObsoleteElementError" do lambda { raise Error::StaleElementReferenceError }.should raise_error(Error::ObsoleteElementError) end it "aliases UnknownError as UnhandledError" do lambda { raise Error::UnknownError }.should raise_error(Error::UnhandledError) end it "aliases JavascriptError as UnexpectedJavascriptError" do lambda { raise Error::JavascriptError }.should raise_error(Error::UnexpectedJavascriptError) end it "aliases NoAlertPresentError as NoAlertOpenError" do lambda { raise Error::NoAlertPresentError }.should raise_error(Error::NoAlertOpenError) end it "aliases ElementNotVisibleError as ElementNotDisplayedError" do lambda { raise Error::ElementNotVisibleError }.should raise_error(Error::ElementNotDisplayedError) end end end end end
jknguyen/josephknguyen-selenium
rb/spec/unit/selenium/webdriver/error_spec.rb
Ruby
apache-2.0
1,204
#!/bin/bash #file : travis.sh #author : ning #date : 2014-05-10 16:54:43 #install deps if we are in travis if [ -n "$TRAVIS" ]; then sudo apt-get install socat #python libs sudo pip install redis sudo pip install nose sudo pip install git+https://github.com/andymccurdy/[email protected] sudo pip install git+https://github.com/idning/python-memcached.git#egg=memcache fi #build twemproxy CFLAGS="-ggdb3 -O0" autoreconf -fvi && ./configure --enable-debug=log && make ln -s `pwd`/src/nutcracker tests/_binaries/ cp `which redis-server` tests/_binaries/ cp `which redis-cli` tests/_binaries/ cp `which memcached` tests/_binaries/ #run test cd tests/ && nosetests --nologcapture -x -v
linearregression/twemproxy
travis.sh
Shell
apache-2.0
721
<!-- /* ** Copyright (c) 2012 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: ** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. ** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ --> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>WebGL GLSL Conformance Tests</title> <link rel="stylesheet" href="../../../resources/js-test-style.css"/> <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/> <script src="../../../resources/js-test-pre.js"></script> <script src="../../resources/webgl-test-utils.js"></script> <script src="../../resources/glsl-conformance-test.js"></script> </head> <body> <div id="description"></div> <div id="console"></div> <script id="vertexShader" type="text/something-not-javascript"> // shader with too-deep struct nesting should fail per WebGL spec struct nesting5 { vec4 vecfield; }; struct nesting4 { nesting5 field5; }; struct nesting3 { nesting4 field4; }; struct nesting2 { nesting3 field3; }; struct nesting1 { nesting2 field2; }; uniform nesting1 uniform1; void main() { gl_Position = uniform1.field2.field3.field4.field5.vecfield; } </script> <script> "use strict"; GLSLConformanceTester.runTest(); var successfullyParsed = true; </script> </body> </html>
crosswalk-project/web-testing-service
wts/tests/webgl/khronos/conformance/glsl/misc/struct-nesting-exceeds-maximum.html
HTML
bsd-3-clause
2,207
<!doctype html> <title>CSS Test Reference</title> <p> Should read "Pass" below </p> <p style="font-kerning: none"> Pass </p>
chromium/chromium
third_party/blink/web_tests/external/wpt/css/css-text/text-transform/text-transform-capitalize-033-ref.html
HTML
bsd-3-clause
129
import Ember from 'ember'; export default Ember.Controller.extend({ notifications: Ember.inject.service(), postInflection: Ember.computed('model.post_count', function () { return this.get('model.post_count') > 1 ? 'posts' : 'post'; }), actions: { confirmAccept: function () { var tag = this.get('model'), name = tag.get('name'), self = this; this.send('closeMenus'); tag.destroyRecord().then(function () { self.get('notifications').showSuccess('Deleted ' + name); }).catch(function (error) { self.get('notifications').showAPIError(error); }); }, confirmReject: function () { return false; } }, confirm: { accept: { text: 'Delete', buttonClass: 'btn btn-red' }, reject: { text: 'Cancel', buttonClass: 'btn btn-default btn-minor' } } });
ddeveloperr/Ghost
core/client/app/controllers/modals/delete-tag.js
JavaScript
mit
1,027
/* * Copyright (c) 2014, Oculus VR, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ /// \file /// \brief Contains the NAT-type detection code for the server /// #include "NativeFeatureIncludes.h" #if _RAKNET_SUPPORT_NatTypeDetectionServer==1 #ifndef __NAT_TYPE_DETECTION_SERVER_H #define __NAT_TYPE_DETECTION_SERVER_H #include "RakNetTypes.h" #include "Export.h" #include "PluginInterface2.h" #include "PacketPriority.h" #include "SocketIncludes.h" #include "DS_OrderedList.h" #include "RakString.h" #include "NatTypeDetectionCommon.h" namespace RakNet { /// Forward declarations class RakPeerInterface; struct Packet; /// \brief Server code for NatTypeDetection /// \details /// Sends to a remote system on certain ports and addresses to determine what type of router, if any, that client is behind /// Requires that the server have 4 external IP addresses /// <OL> /// <LI>Server has 1 instance of RakNet. Server has four external ip addresses S1 to S4. Five ports are used in total P1 to P5. RakNet is bound to S1P1. Sockets are bound to S1P2, S2P3, S3P4, S4P5 /// <LI>Client with one port using RakNet (C1). Another port not using anything (C2). /// <LI>C1 connects to S1P1 for normal communication. /// <LI>S4P5 sends to C2. If arrived, no NAT. Done. (If didn't arrive, S4P5 potentially banned, do not use again). /// <LI>S2P3 sends to C1 (Different address, different port, to previously used port on client). If received, Full-cone nat. Done. (If didn't arrive, S2P3 potentially banned, do not use again). /// <LI>S1P2 sends to C1 (Same address, different port, to previously used port on client). If received, address-restricted cone nat. Done. /// <LI>Server via RakNet connection tells C1 to send to to S3P4. If address of C1 as seen by S3P4 is the same as the address of C1 as seen by S1P1 (RakNet connection), then port-restricted cone nat. Done /// <LI>Else symmetric nat. Done. /// </OL> /// See also http://www.jenkinssoftware.com/raknet/manual/natpunchthrough.html /// \sa NatPunchthroughServer /// \sa NatTypeDetectionClient /// \ingroup NAT_TYPE_DETECTION_GROUP class RAK_DLL_EXPORT NatTypeDetectionServer : public PluginInterface2, public RNS2EventHandler { public: // GetInstance() and DestroyInstance(instance*) STATIC_FACTORY_DECLARATIONS(NatTypeDetectionServer) // Constructor NatTypeDetectionServer(); // Destructor virtual ~NatTypeDetectionServer(); /// Start the system, binding to 3 external IPs not already in useS /// \param[in] nonRakNetIP2 First unused external IP /// \param[in] nonRakNetIP3 Second unused external IP /// \param[in] nonRakNetIP4 Third unused external IP void Startup( const char *nonRakNetIP2, const char *nonRakNetIP3, const char *nonRakNetIP4 #ifdef __native_client__ ,_PP_Instance_ chromeInstance #endif ); // Releases the sockets created in Startup(); void Shutdown(void); /// \internal For plugin handling virtual void Update(void); /// \internal For plugin handling virtual PluginReceiveResult OnReceive(Packet *packet); virtual void OnClosedConnection(const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason ); enum NATDetectionState { STATE_NONE, STATE_TESTING_NONE_1, STATE_TESTING_NONE_2, STATE_TESTING_FULL_CONE_1, STATE_TESTING_FULL_CONE_2, STATE_TESTING_ADDRESS_RESTRICTED_1, STATE_TESTING_ADDRESS_RESTRICTED_2, STATE_TESTING_PORT_RESTRICTED_1, STATE_TESTING_PORT_RESTRICTED_2, STATE_DONE, }; struct NATDetectionAttempt { SystemAddress systemAddress; NATDetectionState detectionState; RakNet::TimeMS nextStateTime; RakNet::TimeMS timeBetweenAttempts; unsigned short c2Port; RakNetGUID guid; }; virtual void OnRNS2Recv(RNS2RecvStruct *recvStruct); virtual void DeallocRNS2RecvStruct(RNS2RecvStruct *s, const char *file, unsigned int line); virtual RNS2RecvStruct *AllocRNS2RecvStruct(const char *file, unsigned int line); protected: DataStructures::Queue<RNS2RecvStruct*> bufferedPackets; SimpleMutex bufferedPacketsMutex; void OnDetectionRequest(Packet *packet); DataStructures::List<NATDetectionAttempt> natDetectionAttempts; unsigned int GetDetectionAttemptIndex(const SystemAddress &sa); unsigned int GetDetectionAttemptIndex(RakNetGUID guid); // s1p1 is rakpeer itself RakNetSocket2 *s1p2,*s2p3,*s3p4,*s4p5; //unsigned short s1p2Port, s2p3Port, s3p4Port, s4p5Port; char s3p4Address[64]; }; } #endif #endif // _RAKNET_SUPPORT_*
Simmesimme/swift2d
src/raknet/raknet/NatTypeDetectionServer.h
C
mit
4,672
<?php namespace Illuminate\Foundation\Support\Providers; use Illuminate\Routing\Router; use Illuminate\Support\ServiceProvider; use Illuminate\Contracts\Routing\UrlGenerator; class RouteServiceProvider extends ServiceProvider { /** * The controller namespace for the application. * * @var string|null */ protected $namespace; /** * Bootstrap any application services. * * @return void */ public function boot() { $this->setRootControllerNamespace(); if ($this->app->routesAreCached()) { $this->loadCachedRoutes(); } else { $this->loadRoutes(); $this->app->booted(function () { $this->app['router']->getRoutes()->refreshNameLookups(); $this->app['router']->getRoutes()->refreshActionLookups(); }); } } /** * Set the root controller namespace for the application. * * @return void */ protected function setRootControllerNamespace() { if (! is_null($this->namespace)) { $this->app[UrlGenerator::class]->setRootControllerNamespace($this->namespace); } } /** * Load the cached routes for the application. * * @return void */ protected function loadCachedRoutes() { $this->app->booted(function () { require $this->app->getCachedRoutesPath(); }); } /** * Load the application routes. * * @return void */ protected function loadRoutes() { if (method_exists($this, 'map')) { $this->app->call([$this, 'map']); } } /** * Register the service provider. * * @return void */ public function register() { // } /** * Pass dynamic methods onto the router instance. * * @param string $method * @param array $parameters * @return mixed */ public function __call($method, $parameters) { return call_user_func_array( [$this->app->make(Router::class), $method], $parameters ); } }
aloha1003/poseitech_assignment
workspace/assignment/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php
PHP
mit
2,160
//////////////////////////////////////////////////////////////////////////////// // // TYPHOON FRAMEWORK // Copyright 2013, Typhoon Framework Contributors // All Rights Reserved. // // NOTICE: The authors permit you to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. // //////////////////////////////////////////////////////////////////////////////// #ifdef __IPHONE_5_0 #import <UIKit/UIKit.h> #import "TyphoonComponentFactory.h" /** * TyphoonStoryboard will inject properties for each viewController created by storyboard. * * Normally, TyphoonStoryboard injection performed by viewController's type. But if you want to specify definition * for viewController injection - use viewController's 'typhoonKey'runtime property. * * To specify 'typhoonKey' in storyboard IB, select your viewController, navigate to 'identity inspector'(cmd+option+3) tab, * section 'User Defined Runtime Attributes'. Add new row with columns: * @code * Key Path : typhoonKey * Type : String * Value : #set your definition selector string here# * @endcode */ @interface TyphoonStoryboard : UIStoryboard @property(nonatomic, strong) id<TyphoonComponentFactory> factory; + (TyphoonStoryboard *)storyboardWithName:(NSString *)name bundle:(NSBundle *)storyboardBundleOrNil; + (TyphoonStoryboard *)storyboardWithName:(NSString *)name factory:(id<TyphoonComponentFactory>)factory bundle:(NSBundle *)bundleOrNil; @end #endif
ilyapuchka/Dependency-Injection-in-Cocoa
Swift-DI/Pods/Typhoon/Source/ios/Storyboard/TyphoonStoryboard.h
C
cc0-1.0
1,497
<div class="page-header"> <h2><?= t('You already have one subtask in progress') ?></h2> </div> <form action="<?= $this->url->href('subtask', 'changeRestrictionStatus', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'subtask_id' => $subtask['id'])) ?>" method="post"> <?= $this->form->csrf() ?> <?= $this->form->hidden('redirect', array('redirect' => $redirect)) ?> <p><?= t('Select the new status of the subtask: "%s"', $subtask_inprogress['title']) ?></p> <?= $this->form->radios('status', $status_list) ?> <?= $this->form->hidden('id', $subtask_inprogress) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-red"/> <?= t('or') ?> <a href="#" class="close-popover"><?= t('cancel') ?></a> </div> </form>
3lywa/gcconnex
kanboard/app/Template/subtask/restriction_change_status.php
PHP
gpl-2.0
829
/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * * v4l2 device driver for philips saa7134 based TV cards * * (c) 2001,02 Gerd Knorr <[email protected]> */ #define SAA7134_VERSION "0, 2, 17" #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/pci.h> #include <linux/i2c.h> #include <linux/videodev2.h> #include <linux/kdev_t.h> #include <linux/input.h> #include <linux/notifier.h> #include <linux/delay.h> #include <linux/mutex.h> #include <linux/pm_qos.h> #include <asm/io.h> #include <media/v4l2-common.h> #include <media/v4l2-ioctl.h> #include <media/v4l2-device.h> #include <media/v4l2-fh.h> #include <media/v4l2-ctrls.h> #include <media/tuner.h> #include <media/rc-core.h> #include <media/i2c/ir-kbd-i2c.h> #include <media/videobuf2-dma-sg.h> #include <sound/core.h> #include <sound/pcm.h> #if IS_ENABLED(CONFIG_VIDEO_SAA7134_DVB) #include <media/videobuf2-dvb.h> #endif #include "tda8290.h" #define UNSET (-1U) /* ----------------------------------------------------------- */ /* enums */ enum saa7134_tvaudio_mode { TVAUDIO_FM_MONO = 1, TVAUDIO_FM_BG_STEREO = 2, TVAUDIO_FM_SAT_STEREO = 3, TVAUDIO_FM_K_STEREO = 4, TVAUDIO_NICAM_AM = 5, TVAUDIO_NICAM_FM = 6, }; enum saa7134_audio_in { TV = 1, LINE1 = 2, LINE2 = 3, LINE2_LEFT, }; enum saa7134_video_out { CCIR656 = 1, }; /* ----------------------------------------------------------- */ /* static data */ struct saa7134_tvnorm { char *name; v4l2_std_id id; /* video decoder */ unsigned int sync_control; unsigned int luma_control; unsigned int chroma_ctrl1; unsigned int chroma_gain; unsigned int chroma_ctrl2; unsigned int vgate_misc; /* video scaler */ unsigned int h_start; unsigned int h_stop; unsigned int video_v_start; unsigned int video_v_stop; unsigned int vbi_v_start_0; unsigned int vbi_v_stop_0; unsigned int src_timing; unsigned int vbi_v_start_1; }; struct saa7134_tvaudio { char *name; v4l2_std_id std; enum saa7134_tvaudio_mode mode; int carr1; int carr2; }; struct saa7134_format { char *name; unsigned int fourcc; unsigned int depth; unsigned int pm; unsigned int vshift; /* vertical downsampling (for planar yuv) */ unsigned int hshift; /* horizontal downsampling (for planar yuv) */ unsigned int bswap:1; unsigned int wswap:1; unsigned int yuv:1; unsigned int planar:1; unsigned int uvswap:1; }; struct saa7134_card_ir { struct rc_dev *dev; char phys[32]; u32 polling; u32 last_gpio; u32 mask_keycode, mask_keydown, mask_keyup; bool running; struct timer_list timer; /* IR core raw decoding */ u32 raw_decode; }; /* ----------------------------------------------------------- */ /* card configuration */ #define SAA7134_BOARD_NOAUTO UNSET #define SAA7134_BOARD_UNKNOWN 0 #define SAA7134_BOARD_PROTEUS_PRO 1 #define SAA7134_BOARD_FLYVIDEO3000 2 #define SAA7134_BOARD_FLYVIDEO2000 3 #define SAA7134_BOARD_EMPRESS 4 #define SAA7134_BOARD_MONSTERTV 5 #define SAA7134_BOARD_MD9717 6 #define SAA7134_BOARD_TVSTATION_RDS 7 #define SAA7134_BOARD_CINERGY400 8 #define SAA7134_BOARD_MD5044 9 #define SAA7134_BOARD_KWORLD 10 #define SAA7134_BOARD_CINERGY600 11 #define SAA7134_BOARD_MD7134 12 #define SAA7134_BOARD_TYPHOON_90031 13 #define SAA7134_BOARD_ELSA 14 #define SAA7134_BOARD_ELSA_500TV 15 #define SAA7134_BOARD_ASUSTeK_TVFM7134 16 #define SAA7134_BOARD_VA1000POWER 17 #define SAA7134_BOARD_BMK_MPEX_NOTUNER 18 #define SAA7134_BOARD_VIDEOMATE_TV 19 #define SAA7134_BOARD_CRONOS_PLUS 20 #define SAA7134_BOARD_10MOONSTVMASTER 21 #define SAA7134_BOARD_MD2819 22 #define SAA7134_BOARD_BMK_MPEX_TUNER 23 #define SAA7134_BOARD_TVSTATION_DVR 24 #define SAA7134_BOARD_ASUSTEK_TVFM7133 25 #define SAA7134_BOARD_PINNACLE_PCTV_STEREO 26 #define SAA7134_BOARD_MANLI_MTV002 27 #define SAA7134_BOARD_MANLI_MTV001 28 #define SAA7134_BOARD_TG3000TV 29 #define SAA7134_BOARD_ECS_TVP3XP 30 #define SAA7134_BOARD_ECS_TVP3XP_4CB5 31 #define SAA7134_BOARD_AVACSSMARTTV 32 #define SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER 33 #define SAA7134_BOARD_NOVAC_PRIMETV7133 34 #define SAA7134_BOARD_AVERMEDIA_STUDIO_305 35 #define SAA7134_BOARD_UPMOST_PURPLE_TV 36 #define SAA7134_BOARD_ITEMS_MTV005 37 #define SAA7134_BOARD_CINERGY200 38 #define SAA7134_BOARD_FLYTVPLATINUM_MINI 39 #define SAA7134_BOARD_VIDEOMATE_TV_PVR 40 #define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS 41 #define SAA7134_BOARD_SABRENT_SBTTVFM 42 #define SAA7134_BOARD_ZOLID_XPERT_TV7134 43 #define SAA7134_BOARD_EMPIRE_PCI_TV_RADIO_LE 44 #define SAA7134_BOARD_AVERMEDIA_STUDIO_307 45 #define SAA7134_BOARD_AVERMEDIA_CARDBUS 46 #define SAA7134_BOARD_CINERGY400_CARDBUS 47 #define SAA7134_BOARD_CINERGY600_MK3 48 #define SAA7134_BOARD_VIDEOMATE_GOLD_PLUS 49 #define SAA7134_BOARD_PINNACLE_300I_DVBT_PAL 50 #define SAA7134_BOARD_PROVIDEO_PV952 51 #define SAA7134_BOARD_AVERMEDIA_305 52 #define SAA7134_BOARD_ASUSTeK_TVFM7135 53 #define SAA7134_BOARD_FLYTVPLATINUM_FM 54 #define SAA7134_BOARD_FLYDVBTDUO 55 #define SAA7134_BOARD_AVERMEDIA_307 56 #define SAA7134_BOARD_AVERMEDIA_GO_007_FM 57 #define SAA7134_BOARD_ADS_INSTANT_TV 58 #define SAA7134_BOARD_KWORLD_VSTREAM_XPERT 59 #define SAA7134_BOARD_FLYDVBT_DUO_CARDBUS 60 #define SAA7134_BOARD_PHILIPS_TOUGH 61 #define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII 62 #define SAA7134_BOARD_KWORLD_XPERT 63 #define SAA7134_BOARD_FLYTV_DIGIMATRIX 64 #define SAA7134_BOARD_KWORLD_TERMINATOR 65 #define SAA7134_BOARD_YUAN_TUN900 66 #define SAA7134_BOARD_BEHOLD_409FM 67 #define SAA7134_BOARD_GOTVIEW_7135 68 #define SAA7134_BOARD_PHILIPS_EUROPA 69 #define SAA7134_BOARD_VIDEOMATE_DVBT_300 70 #define SAA7134_BOARD_VIDEOMATE_DVBT_200 71 #define SAA7134_BOARD_RTD_VFG7350 72 #define SAA7134_BOARD_RTD_VFG7330 73 #define SAA7134_BOARD_FLYTVPLATINUM_MINI2 74 #define SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180 75 #define SAA7134_BOARD_MONSTERTV_MOBILE 76 #define SAA7134_BOARD_PINNACLE_PCTV_110i 77 #define SAA7134_BOARD_ASUSTeK_P7131_DUAL 78 #define SAA7134_BOARD_SEDNA_PC_TV_CARDBUS 79 #define SAA7134_BOARD_ASUSTEK_DIGIMATRIX_TV 80 #define SAA7134_BOARD_PHILIPS_TIGER 81 #define SAA7134_BOARD_MSI_TVATANYWHERE_PLUS 82 #define SAA7134_BOARD_CINERGY250PCI 83 #define SAA7134_BOARD_FLYDVB_TRIO 84 #define SAA7134_BOARD_AVERMEDIA_777 85 #define SAA7134_BOARD_FLYDVBT_LR301 86 #define SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331 87 #define SAA7134_BOARD_TEVION_DVBT_220RF 88 #define SAA7134_BOARD_ELSA_700TV 89 #define SAA7134_BOARD_KWORLD_ATSC110 90 #define SAA7134_BOARD_AVERMEDIA_A169_B 91 #define SAA7134_BOARD_AVERMEDIA_A169_B1 92 #define SAA7134_BOARD_MD7134_BRIDGE_2 93 #define SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS 94 #define SAA7134_BOARD_FLYVIDEO3000_NTSC 95 #define SAA7134_BOARD_MEDION_MD8800_QUADRO 96 #define SAA7134_BOARD_FLYDVBS_LR300 97 #define SAA7134_BOARD_PROTEUS_2309 98 #define SAA7134_BOARD_AVERMEDIA_A16AR 99 #define SAA7134_BOARD_ASUS_EUROPA2_HYBRID 100 #define SAA7134_BOARD_PINNACLE_PCTV_310i 101 #define SAA7134_BOARD_AVERMEDIA_STUDIO_507 102 #define SAA7134_BOARD_VIDEOMATE_DVBT_200A 103 #define SAA7134_BOARD_HAUPPAUGE_HVR1110 104 #define SAA7134_BOARD_CINERGY_HT_PCMCIA 105 #define SAA7134_BOARD_ENCORE_ENLTV 106 #define SAA7134_BOARD_ENCORE_ENLTV_FM 107 #define SAA7134_BOARD_CINERGY_HT_PCI 108 #define SAA7134_BOARD_PHILIPS_TIGER_S 109 #define SAA7134_BOARD_AVERMEDIA_M102 110 #define SAA7134_BOARD_ASUS_P7131_4871 111 #define SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA 112 #define SAA7134_BOARD_ECS_TVP3XP_4CB6 113 #define SAA7134_BOARD_KWORLD_DVBT_210 114 #define SAA7134_BOARD_SABRENT_TV_PCB05 115 #define SAA7134_BOARD_10MOONSTVMASTER3 116 #define SAA7134_BOARD_AVERMEDIA_SUPER_007 117 #define SAA7134_BOARD_BEHOLD_401 118 #define SAA7134_BOARD_BEHOLD_403 119 #define SAA7134_BOARD_BEHOLD_403FM 120 #define SAA7134_BOARD_BEHOLD_405 121 #define SAA7134_BOARD_BEHOLD_405FM 122 #define SAA7134_BOARD_BEHOLD_407 123 #define SAA7134_BOARD_BEHOLD_407FM 124 #define SAA7134_BOARD_BEHOLD_409 125 #define SAA7134_BOARD_BEHOLD_505FM 126 #define SAA7134_BOARD_BEHOLD_507_9FM 127 #define SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM 128 #define SAA7134_BOARD_BEHOLD_607FM_MK3 129 #define SAA7134_BOARD_BEHOLD_M6 130 #define SAA7134_BOARD_TWINHAN_DTV_DVB_3056 131 #define SAA7134_BOARD_GENIUS_TVGO_A11MCE 132 #define SAA7134_BOARD_PHILIPS_SNAKE 133 #define SAA7134_BOARD_CREATIX_CTX953 134 #define SAA7134_BOARD_MSI_TVANYWHERE_AD11 135 #define SAA7134_BOARD_AVERMEDIA_CARDBUS_506 136 #define SAA7134_BOARD_AVERMEDIA_A16D 137 #define SAA7134_BOARD_AVERMEDIA_M115 138 #define SAA7134_BOARD_VIDEOMATE_T750 139 #define SAA7134_BOARD_AVERMEDIA_A700_PRO 140 #define SAA7134_BOARD_AVERMEDIA_A700_HYBRID 141 #define SAA7134_BOARD_BEHOLD_H6 142 #define SAA7134_BOARD_BEHOLD_M63 143 #define SAA7134_BOARD_BEHOLD_M6_EXTRA 144 #define SAA7134_BOARD_AVERMEDIA_M103 145 #define SAA7134_BOARD_ASUSTeK_P7131_ANALOG 146 #define SAA7134_BOARD_ASUSTeK_TIGER_3IN1 147 #define SAA7134_BOARD_ENCORE_ENLTV_FM53 148 #define SAA7134_BOARD_AVERMEDIA_M135A 149 #define SAA7134_BOARD_REAL_ANGEL_220 150 #define SAA7134_BOARD_ADS_INSTANT_HDTV_PCI 151 #define SAA7134_BOARD_ASUSTeK_TIGER 152 #define SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG 153 #define SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS 154 #define SAA7134_BOARD_HAUPPAUGE_HVR1150 155 #define SAA7134_BOARD_HAUPPAUGE_HVR1120 156 #define SAA7134_BOARD_AVERMEDIA_STUDIO_507UA 157 #define SAA7134_BOARD_AVERMEDIA_CARDBUS_501 158 #define SAA7134_BOARD_BEHOLD_505RDS_MK5 159 #define SAA7134_BOARD_BEHOLD_507RDS_MK3 160 #define SAA7134_BOARD_BEHOLD_507RDS_MK5 161 #define SAA7134_BOARD_BEHOLD_607FM_MK5 162 #define SAA7134_BOARD_BEHOLD_609FM_MK3 163 #define SAA7134_BOARD_BEHOLD_609FM_MK5 164 #define SAA7134_BOARD_BEHOLD_607RDS_MK3 165 #define SAA7134_BOARD_BEHOLD_607RDS_MK5 166 #define SAA7134_BOARD_BEHOLD_609RDS_MK3 167 #define SAA7134_BOARD_BEHOLD_609RDS_MK5 168 #define SAA7134_BOARD_VIDEOMATE_S350 169 #define SAA7134_BOARD_AVERMEDIA_STUDIO_505 170 #define SAA7134_BOARD_BEHOLD_X7 171 #define SAA7134_BOARD_ROVERMEDIA_LINK_PRO_FM 172 #define SAA7134_BOARD_ZOLID_HYBRID_PCI 173 #define SAA7134_BOARD_ASUS_EUROPA_HYBRID 174 #define SAA7134_BOARD_LEADTEK_WINFAST_DTV1000S 175 #define SAA7134_BOARD_BEHOLD_505RDS_MK3 176 #define SAA7134_BOARD_HAWELL_HW_404M7 177 #define SAA7134_BOARD_BEHOLD_H7 178 #define SAA7134_BOARD_BEHOLD_A7 179 #define SAA7134_BOARD_AVERMEDIA_M733A 180 #define SAA7134_BOARD_TECHNOTREND_BUDGET_T3000 181 #define SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG 182 #define SAA7134_BOARD_VIDEOMATE_M1F 183 #define SAA7134_BOARD_ENCORE_ENLTV_FM3 184 #define SAA7134_BOARD_MAGICPRO_PROHDTV_PRO2 185 #define SAA7134_BOARD_BEHOLD_501 186 #define SAA7134_BOARD_BEHOLD_503FM 187 #define SAA7134_BOARD_SENSORAY811_911 188 #define SAA7134_BOARD_KWORLD_PC150U 189 #define SAA7134_BOARD_ASUSTeK_PS3_100 190 #define SAA7134_BOARD_HAWELL_HW_9004V1 191 #define SAA7134_BOARD_AVERMEDIA_A706 192 #define SAA7134_BOARD_WIS_VOYAGER 193 #define SAA7134_BOARD_AVERMEDIA_505 194 #define SAA7134_BOARD_LEADTEK_WINFAST_TV2100_FM 195 #define SAA7134_BOARD_SNAZIO_TVPVR_PRO 196 #define SAA7134_MAXBOARDS 32 #define SAA7134_INPUT_MAX 8 /* ----------------------------------------------------------- */ /* Since we support 2 remote types, lets tell them apart */ #define SAA7134_REMOTE_GPIO 1 #define SAA7134_REMOTE_I2C 2 /* ----------------------------------------------------------- */ /* Video Output Port Register Initialization Options */ #define SET_T_CODE_POLARITY_NON_INVERTED (1 << 0) #define SET_CLOCK_NOT_DELAYED (1 << 1) #define SET_CLOCK_INVERTED (1 << 2) #define SET_VSYNC_OFF (1 << 3) enum saa7134_input_types { SAA7134_NO_INPUT = 0, SAA7134_INPUT_MUTE, SAA7134_INPUT_RADIO, SAA7134_INPUT_TV, SAA7134_INPUT_TV_MONO, SAA7134_INPUT_COMPOSITE, SAA7134_INPUT_COMPOSITE0, SAA7134_INPUT_COMPOSITE1, SAA7134_INPUT_COMPOSITE2, SAA7134_INPUT_COMPOSITE3, SAA7134_INPUT_COMPOSITE4, SAA7134_INPUT_SVIDEO, SAA7134_INPUT_SVIDEO0, SAA7134_INPUT_SVIDEO1, SAA7134_INPUT_COMPOSITE_OVER_SVIDEO, }; struct saa7134_input { enum saa7134_input_types type; unsigned int vmux; enum saa7134_audio_in amux; unsigned int gpio; }; enum saa7134_mpeg_type { SAA7134_MPEG_UNUSED, SAA7134_MPEG_EMPRESS, SAA7134_MPEG_DVB, SAA7134_MPEG_GO7007, }; enum saa7134_mpeg_ts_type { SAA7134_MPEG_TS_PARALLEL = 0, SAA7134_MPEG_TS_SERIAL, }; struct saa7134_board { char *name; unsigned int audio_clock; /* input switching */ unsigned int gpiomask; struct saa7134_input inputs[SAA7134_INPUT_MAX]; struct saa7134_input radio; struct saa7134_input mute; /* i2c chip info */ unsigned int tuner_type; unsigned int radio_type; unsigned char tuner_addr; unsigned char radio_addr; unsigned char empress_addr; unsigned char rds_addr; unsigned int tda9887_conf; struct tda829x_config tda829x_conf; /* peripheral I/O */ enum saa7134_video_out video_out; enum saa7134_mpeg_type mpeg; enum saa7134_mpeg_ts_type ts_type; unsigned int vid_port_opts; unsigned int ts_force_val:1; }; #define card_has_radio(dev) (SAA7134_NO_INPUT != saa7134_boards[dev->board].radio.type) #define card_is_empress(dev) (SAA7134_MPEG_EMPRESS == saa7134_boards[dev->board].mpeg) #define card_is_dvb(dev) (SAA7134_MPEG_DVB == saa7134_boards[dev->board].mpeg) #define card_is_go7007(dev) (SAA7134_MPEG_GO7007 == saa7134_boards[dev->board].mpeg) #define card_has_mpeg(dev) (SAA7134_MPEG_UNUSED != saa7134_boards[dev->board].mpeg) #define card(dev) (saa7134_boards[dev->board]) #define card_in(dev,n) (saa7134_boards[dev->board].inputs[n]) #define V4L2_CID_PRIVATE_INVERT (V4L2_CID_USER_SAA7134_BASE + 0) #define V4L2_CID_PRIVATE_Y_ODD (V4L2_CID_USER_SAA7134_BASE + 1) #define V4L2_CID_PRIVATE_Y_EVEN (V4L2_CID_USER_SAA7134_BASE + 2) #define V4L2_CID_PRIVATE_AUTOMUTE (V4L2_CID_USER_SAA7134_BASE + 3) /* ----------------------------------------------------------- */ /* device / file handle status */ #define RESOURCE_OVERLAY 1 #define RESOURCE_VIDEO 2 #define RESOURCE_VBI 4 #define RESOURCE_EMPRESS 8 #define INTERLACE_AUTO 0 #define INTERLACE_ON 1 #define INTERLACE_OFF 2 #define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */ #define TS_BUFFER_TIMEOUT msecs_to_jiffies(1000) /* 1 second */ struct saa7134_dev; struct saa7134_dma; /* saa7134 page table */ struct saa7134_pgtable { unsigned int size; __le32 *cpu; dma_addr_t dma; }; /* tvaudio thread status */ struct saa7134_thread { struct task_struct *thread; unsigned int scan1; unsigned int scan2; unsigned int mode; unsigned int stopped; }; /* buffer for one video/vbi/ts frame */ struct saa7134_buf { /* common v4l buffer stuff -- must be first */ struct vb2_v4l2_buffer vb2; /* saa7134 specific */ unsigned int top_seen; int (*activate)(struct saa7134_dev *dev, struct saa7134_buf *buf, struct saa7134_buf *next); struct list_head entry; }; struct saa7134_dmaqueue { struct saa7134_dev *dev; struct saa7134_buf *curr; struct list_head queue; struct timer_list timeout; unsigned int need_two; unsigned int seq_nr; struct saa7134_pgtable pt; }; /* dmasound dsp status */ struct saa7134_dmasound { struct mutex lock; int minor_mixer; int minor_dsp; unsigned int users_dsp; /* mixer */ enum saa7134_audio_in input; unsigned int count; unsigned int line1; unsigned int line2; /* dsp */ unsigned int afmt; unsigned int rate; unsigned int channels; unsigned int recording_on; unsigned int dma_running; unsigned int blocks; unsigned int blksize; unsigned int bufsize; struct saa7134_pgtable pt; void *vaddr; struct scatterlist *sglist; int sglen; int nr_pages; unsigned int dma_blk; unsigned int read_offset; unsigned int read_count; void * priv_data; struct snd_pcm_substream *substream; }; /* ts/mpeg status */ struct saa7134_ts { /* TS capture */ int nr_packets; int nr_bufs; }; /* ts/mpeg ops */ struct saa7134_mpeg_ops { enum saa7134_mpeg_type type; struct list_head next; int (*init)(struct saa7134_dev *dev); int (*fini)(struct saa7134_dev *dev); void (*signal_change)(struct saa7134_dev *dev); void (*irq_ts_done)(struct saa7134_dev *dev, unsigned long status); }; enum saa7134_pads { SAA7134_PAD_IF_INPUT, SAA7134_PAD_VID_OUT, SAA7134_NUM_PADS }; /* global device status */ struct saa7134_dev { struct list_head devlist; struct mutex lock; spinlock_t slock; struct v4l2_device v4l2_dev; /* workstruct for loading modules */ struct work_struct request_module_wk; /* insmod option/autodetected */ int autodetected; /* various device info */ unsigned int resources; struct video_device *video_dev; struct video_device *radio_dev; struct video_device *vbi_dev; struct saa7134_dmasound dmasound; /* infrared remote */ int has_remote; struct saa7134_card_ir *remote; /* pci i/o */ char name[32]; int nr; struct pci_dev *pci; unsigned char pci_rev,pci_lat; __u32 __iomem *lmmio; __u8 __iomem *bmmio; /* config info */ unsigned int board; unsigned int tuner_type; unsigned int radio_type; unsigned char tuner_addr; unsigned char radio_addr; unsigned int tda9887_conf; unsigned int gpio_value; /* i2c i/o */ struct i2c_adapter i2c_adap; struct i2c_client i2c_client; unsigned char eedata[256]; int has_rds; /* video overlay */ struct v4l2_framebuffer ovbuf; struct saa7134_format *ovfmt; unsigned int ovenable; enum v4l2_field ovfield; struct v4l2_window win; struct v4l2_clip clips[8]; unsigned int nclips; struct v4l2_fh *overlay_owner; /* video+ts+vbi capture */ struct saa7134_dmaqueue video_q; struct vb2_queue video_vbq; struct saa7134_dmaqueue vbi_q; struct vb2_queue vbi_vbq; enum v4l2_field field; struct saa7134_format *fmt; unsigned int width, height; unsigned int vbi_hlen, vbi_vlen; struct pm_qos_request qos_request; /* SAA7134_MPEG_* */ struct saa7134_ts ts; struct saa7134_dmaqueue ts_q; enum v4l2_field ts_field; int ts_started; struct saa7134_mpeg_ops *mops; /* SAA7134_MPEG_EMPRESS only */ struct video_device *empress_dev; struct v4l2_subdev *empress_sd; struct vb2_queue empress_vbq; struct work_struct empress_workqueue; int empress_started; struct v4l2_ctrl_handler empress_ctrl_handler; /* various v4l controls */ struct saa7134_tvnorm *tvnorm; /* video */ struct saa7134_tvaudio *tvaudio; struct v4l2_ctrl_handler ctrl_handler; unsigned int ctl_input; int ctl_bright; int ctl_contrast; int ctl_hue; int ctl_saturation; int ctl_mute; /* audio */ int ctl_volume; int ctl_invert; /* private */ int ctl_mirror; int ctl_y_odd; int ctl_y_even; int ctl_automute; /* crop */ struct v4l2_rect crop_bounds; struct v4l2_rect crop_defrect; struct v4l2_rect crop_current; /* other global state info */ unsigned int automute; struct saa7134_thread thread; struct saa7134_input *input; struct saa7134_input *hw_input; unsigned int hw_mute; int last_carrier; int nosignal; unsigned int insuspend; struct v4l2_ctrl_handler radio_ctrl_handler; /* I2C keyboard data */ struct IR_i2c_init_data init_data; #ifdef CONFIG_MEDIA_CONTROLLER struct media_device *media_dev; struct media_entity input_ent[SAA7134_INPUT_MAX + 1]; struct media_pad input_pad[SAA7134_INPUT_MAX + 1]; struct media_entity demod; struct media_pad demod_pad[SAA7134_NUM_PADS]; struct media_pad video_pad, vbi_pad; struct media_entity *decoder; #endif #if IS_ENABLED(CONFIG_VIDEO_SAA7134_DVB) /* SAA7134_MPEG_DVB only */ struct vb2_dvb_frontends frontends; int (*original_demod_sleep)(struct dvb_frontend *fe); int (*original_set_voltage)(struct dvb_frontend *fe, enum fe_sec_voltage voltage); int (*original_set_high_voltage)(struct dvb_frontend *fe, long arg); #endif void (*gate_ctrl)(struct saa7134_dev *dev, int open); }; /* ----------------------------------------------------------- */ #define saa_readl(reg) readl(dev->lmmio + (reg)) #define saa_writel(reg,value) writel((value), dev->lmmio + (reg)); #define saa_andorl(reg,mask,value) \ writel((readl(dev->lmmio+(reg)) & ~(mask)) |\ ((value) & (mask)), dev->lmmio+(reg)) #define saa_setl(reg,bit) saa_andorl((reg),(bit),(bit)) #define saa_clearl(reg,bit) saa_andorl((reg),(bit),0) #define saa_readb(reg) readb(dev->bmmio + (reg)) #define saa_writeb(reg,value) writeb((value), dev->bmmio + (reg)); #define saa_andorb(reg,mask,value) \ writeb((readb(dev->bmmio+(reg)) & ~(mask)) |\ ((value) & (mask)), dev->bmmio+(reg)) #define saa_setb(reg,bit) saa_andorb((reg),(bit),(bit)) #define saa_clearb(reg,bit) saa_andorb((reg),(bit),0) #define saa_wait(us) { udelay(us); } #define SAA7134_NORMS (\ V4L2_STD_PAL | V4L2_STD_PAL_N | \ V4L2_STD_PAL_Nc | V4L2_STD_SECAM | \ V4L2_STD_NTSC | V4L2_STD_PAL_M | \ V4L2_STD_PAL_60) #define GRP_EMPRESS (1) #define saa_call_all(dev, o, f, args...) do { \ if (dev->gate_ctrl) \ dev->gate_ctrl(dev, 1); \ v4l2_device_call_all(&(dev)->v4l2_dev, 0, o, f , ##args); \ if (dev->gate_ctrl) \ dev->gate_ctrl(dev, 0); \ } while (0) #define saa_call_empress(dev, o, f, args...) ({ \ long _rc; \ if (dev->gate_ctrl) \ dev->gate_ctrl(dev, 1); \ _rc = v4l2_device_call_until_err(&(dev)->v4l2_dev, \ GRP_EMPRESS, o, f , ##args); \ if (dev->gate_ctrl) \ dev->gate_ctrl(dev, 0); \ _rc; \ }) static inline bool is_empress(struct file *file) { struct video_device *vdev = video_devdata(file); struct saa7134_dev *dev = video_get_drvdata(vdev); return vdev->queue == &dev->empress_vbq; } /* ----------------------------------------------------------- */ /* saa7134-core.c */ extern struct list_head saa7134_devlist; extern struct mutex saa7134_devlist_lock; extern int saa7134_no_overlay; extern bool saa7134_userptr; void saa7134_track_gpio(struct saa7134_dev *dev, const char *msg); void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value); #define SAA7134_PGTABLE_SIZE 4096 int saa7134_pgtable_alloc(struct pci_dev *pci, struct saa7134_pgtable *pt); int saa7134_pgtable_build(struct pci_dev *pci, struct saa7134_pgtable *pt, struct scatterlist *list, unsigned int length, unsigned int startpage); void saa7134_pgtable_free(struct pci_dev *pci, struct saa7134_pgtable *pt); int saa7134_buffer_count(unsigned int size, unsigned int count); int saa7134_buffer_startpage(struct saa7134_buf *buf); unsigned long saa7134_buffer_base(struct saa7134_buf *buf); int saa7134_buffer_queue(struct saa7134_dev *dev, struct saa7134_dmaqueue *q, struct saa7134_buf *buf); void saa7134_buffer_finish(struct saa7134_dev *dev, struct saa7134_dmaqueue *q, unsigned int state); void saa7134_buffer_next(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); void saa7134_buffer_timeout(struct timer_list *t); void saa7134_stop_streaming(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); int saa7134_set_dmabits(struct saa7134_dev *dev); extern int (*saa7134_dmasound_init)(struct saa7134_dev *dev); extern int (*saa7134_dmasound_exit)(struct saa7134_dev *dev); /* ----------------------------------------------------------- */ /* saa7134-cards.c */ extern struct saa7134_board saa7134_boards[]; extern const char * const saa7134_input_name[]; extern const unsigned int saa7134_bcount; extern struct pci_device_id saa7134_pci_tbl[]; extern int saa7134_board_init1(struct saa7134_dev *dev); extern int saa7134_board_init2(struct saa7134_dev *dev); int saa7134_tuner_callback(void *priv, int component, int command, int arg); /* ----------------------------------------------------------- */ /* saa7134-i2c.c */ int saa7134_i2c_register(struct saa7134_dev *dev); int saa7134_i2c_unregister(struct saa7134_dev *dev); /* ----------------------------------------------------------- */ /* saa7134-video.c */ extern unsigned int video_debug; extern struct video_device saa7134_video_template; extern struct video_device saa7134_radio_template; void saa7134_vb2_buffer_queue(struct vb2_buffer *vb); int saa7134_vb2_start_streaming(struct vb2_queue *vq, unsigned int count); void saa7134_vb2_stop_streaming(struct vb2_queue *vq); int saa7134_s_std(struct file *file, void *priv, v4l2_std_id id); int saa7134_g_std(struct file *file, void *priv, v4l2_std_id *id); int saa7134_querystd(struct file *file, void *priv, v4l2_std_id *std); int saa7134_enum_input(struct file *file, void *priv, struct v4l2_input *i); int saa7134_g_input(struct file *file, void *priv, unsigned int *i); int saa7134_s_input(struct file *file, void *priv, unsigned int i); int saa7134_querycap(struct file *file, void *priv, struct v4l2_capability *cap); int saa7134_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t); int saa7134_s_tuner(struct file *file, void *priv, const struct v4l2_tuner *t); int saa7134_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f); int saa7134_s_frequency(struct file *file, void *priv, const struct v4l2_frequency *f); int saa7134_videoport_init(struct saa7134_dev *dev); void saa7134_set_tvnorm_hw(struct saa7134_dev *dev); int saa7134_video_init1(struct saa7134_dev *dev); int saa7134_video_init2(struct saa7134_dev *dev); void saa7134_irq_video_signalchange(struct saa7134_dev *dev); void saa7134_irq_video_done(struct saa7134_dev *dev, unsigned long status); void saa7134_video_fini(struct saa7134_dev *dev); /* ----------------------------------------------------------- */ /* saa7134-ts.c */ #define TS_PACKET_SIZE 188 /* TS packets 188 bytes */ int saa7134_ts_buffer_init(struct vb2_buffer *vb2); int saa7134_ts_buffer_prepare(struct vb2_buffer *vb2); int saa7134_ts_queue_setup(struct vb2_queue *q, unsigned int *nbuffers, unsigned int *nplanes, unsigned int sizes[], struct device *alloc_devs[]); int saa7134_ts_start_streaming(struct vb2_queue *vq, unsigned int count); void saa7134_ts_stop_streaming(struct vb2_queue *vq); extern struct vb2_ops saa7134_ts_qops; int saa7134_ts_init1(struct saa7134_dev *dev); int saa7134_ts_fini(struct saa7134_dev *dev); void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status); int saa7134_ts_register(struct saa7134_mpeg_ops *ops); void saa7134_ts_unregister(struct saa7134_mpeg_ops *ops); int saa7134_ts_init_hw(struct saa7134_dev *dev); int saa7134_ts_start(struct saa7134_dev *dev); int saa7134_ts_stop(struct saa7134_dev *dev); /* ----------------------------------------------------------- */ /* saa7134-vbi.c */ extern const struct vb2_ops saa7134_vbi_qops; extern struct video_device saa7134_vbi_template; int saa7134_vbi_init1(struct saa7134_dev *dev); int saa7134_vbi_fini(struct saa7134_dev *dev); void saa7134_irq_vbi_done(struct saa7134_dev *dev, unsigned long status); /* ----------------------------------------------------------- */ /* saa7134-tvaudio.c */ int saa7134_tvaudio_rx2mode(u32 rx); void saa7134_tvaudio_setmute(struct saa7134_dev *dev); void saa7134_tvaudio_setinput(struct saa7134_dev *dev, struct saa7134_input *in); void saa7134_tvaudio_setvolume(struct saa7134_dev *dev, int level); int saa7134_tvaudio_getstereo(struct saa7134_dev *dev); void saa7134_tvaudio_init(struct saa7134_dev *dev); int saa7134_tvaudio_init2(struct saa7134_dev *dev); int saa7134_tvaudio_fini(struct saa7134_dev *dev); int saa7134_tvaudio_do_scan(struct saa7134_dev *dev); int saa7134_tvaudio_close(struct saa7134_dev *dev); int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value); void saa7134_enable_i2s(struct saa7134_dev *dev); /* ----------------------------------------------------------- */ /* saa7134-oss.c */ extern const struct file_operations saa7134_dsp_fops; extern const struct file_operations saa7134_mixer_fops; int saa7134_oss_init1(struct saa7134_dev *dev); int saa7134_oss_fini(struct saa7134_dev *dev); void saa7134_irq_oss_done(struct saa7134_dev *dev, unsigned long status); /* ----------------------------------------------------------- */ /* saa7134-input.c */ #if defined(CONFIG_VIDEO_SAA7134_RC) int saa7134_input_init1(struct saa7134_dev *dev); void saa7134_input_fini(struct saa7134_dev *dev); void saa7134_input_irq(struct saa7134_dev *dev); void saa7134_probe_i2c_ir(struct saa7134_dev *dev); int saa7134_ir_open(struct rc_dev *dev); void saa7134_ir_close(struct rc_dev *dev); #else #define saa7134_input_init1(dev) ((void)0) #define saa7134_input_fini(dev) ((void)0) #define saa7134_input_irq(dev) ((void)0) #define saa7134_probe_i2c_ir(dev) ((void)0) #define saa7134_ir_open(dev) ((void)0) #define saa7134_ir_close(dev) ((void)0) #endif
koct9i/linux
drivers/media/pci/saa7134/saa7134.h
C
gpl-2.0
31,605
// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2008 * Guennadi Liakhovetski, DENX Software Engineering, <[email protected]> * * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/platform_device.h> #include <linux/sched.h> #include <linux/errno.h> #include <linux/string.h> #include <linux/interrupt.h> #include <linux/slab.h> #include <linux/fb.h> #include <linux/delay.h> #include <linux/init.h> #include <linux/ioport.h> #include <linux/dma-mapping.h> #include <linux/dmaengine.h> #include <linux/console.h> #include <linux/clk.h> #include <linux/mutex.h> #include <linux/dma/ipu-dma.h> #include <linux/backlight.h> #include <linux/platform_data/dma-imx.h> #include <linux/platform_data/video-mx3fb.h> #include <asm/io.h> #include <linux/uaccess.h> #define MX3FB_NAME "mx3_sdc_fb" #define MX3FB_REG_OFFSET 0xB4 /* SDC Registers */ #define SDC_COM_CONF (0xB4 - MX3FB_REG_OFFSET) #define SDC_GW_CTRL (0xB8 - MX3FB_REG_OFFSET) #define SDC_FG_POS (0xBC - MX3FB_REG_OFFSET) #define SDC_BG_POS (0xC0 - MX3FB_REG_OFFSET) #define SDC_CUR_POS (0xC4 - MX3FB_REG_OFFSET) #define SDC_PWM_CTRL (0xC8 - MX3FB_REG_OFFSET) #define SDC_CUR_MAP (0xCC - MX3FB_REG_OFFSET) #define SDC_HOR_CONF (0xD0 - MX3FB_REG_OFFSET) #define SDC_VER_CONF (0xD4 - MX3FB_REG_OFFSET) #define SDC_SHARP_CONF_1 (0xD8 - MX3FB_REG_OFFSET) #define SDC_SHARP_CONF_2 (0xDC - MX3FB_REG_OFFSET) /* Register bits */ #define SDC_COM_TFT_COLOR 0x00000001UL #define SDC_COM_FG_EN 0x00000010UL #define SDC_COM_GWSEL 0x00000020UL #define SDC_COM_GLB_A 0x00000040UL #define SDC_COM_KEY_COLOR_G 0x00000080UL #define SDC_COM_BG_EN 0x00000200UL #define SDC_COM_SHARP 0x00001000UL #define SDC_V_SYNC_WIDTH_L 0x00000001UL /* Display Interface registers */ #define DI_DISP_IF_CONF (0x0124 - MX3FB_REG_OFFSET) #define DI_DISP_SIG_POL (0x0128 - MX3FB_REG_OFFSET) #define DI_SER_DISP1_CONF (0x012C - MX3FB_REG_OFFSET) #define DI_SER_DISP2_CONF (0x0130 - MX3FB_REG_OFFSET) #define DI_HSP_CLK_PER (0x0134 - MX3FB_REG_OFFSET) #define DI_DISP0_TIME_CONF_1 (0x0138 - MX3FB_REG_OFFSET) #define DI_DISP0_TIME_CONF_2 (0x013C - MX3FB_REG_OFFSET) #define DI_DISP0_TIME_CONF_3 (0x0140 - MX3FB_REG_OFFSET) #define DI_DISP1_TIME_CONF_1 (0x0144 - MX3FB_REG_OFFSET) #define DI_DISP1_TIME_CONF_2 (0x0148 - MX3FB_REG_OFFSET) #define DI_DISP1_TIME_CONF_3 (0x014C - MX3FB_REG_OFFSET) #define DI_DISP2_TIME_CONF_1 (0x0150 - MX3FB_REG_OFFSET) #define DI_DISP2_TIME_CONF_2 (0x0154 - MX3FB_REG_OFFSET) #define DI_DISP2_TIME_CONF_3 (0x0158 - MX3FB_REG_OFFSET) #define DI_DISP3_TIME_CONF (0x015C - MX3FB_REG_OFFSET) #define DI_DISP0_DB0_MAP (0x0160 - MX3FB_REG_OFFSET) #define DI_DISP0_DB1_MAP (0x0164 - MX3FB_REG_OFFSET) #define DI_DISP0_DB2_MAP (0x0168 - MX3FB_REG_OFFSET) #define DI_DISP0_CB0_MAP (0x016C - MX3FB_REG_OFFSET) #define DI_DISP0_CB1_MAP (0x0170 - MX3FB_REG_OFFSET) #define DI_DISP0_CB2_MAP (0x0174 - MX3FB_REG_OFFSET) #define DI_DISP1_DB0_MAP (0x0178 - MX3FB_REG_OFFSET) #define DI_DISP1_DB1_MAP (0x017C - MX3FB_REG_OFFSET) #define DI_DISP1_DB2_MAP (0x0180 - MX3FB_REG_OFFSET) #define DI_DISP1_CB0_MAP (0x0184 - MX3FB_REG_OFFSET) #define DI_DISP1_CB1_MAP (0x0188 - MX3FB_REG_OFFSET) #define DI_DISP1_CB2_MAP (0x018C - MX3FB_REG_OFFSET) #define DI_DISP2_DB0_MAP (0x0190 - MX3FB_REG_OFFSET) #define DI_DISP2_DB1_MAP (0x0194 - MX3FB_REG_OFFSET) #define DI_DISP2_DB2_MAP (0x0198 - MX3FB_REG_OFFSET) #define DI_DISP2_CB0_MAP (0x019C - MX3FB_REG_OFFSET) #define DI_DISP2_CB1_MAP (0x01A0 - MX3FB_REG_OFFSET) #define DI_DISP2_CB2_MAP (0x01A4 - MX3FB_REG_OFFSET) #define DI_DISP3_B0_MAP (0x01A8 - MX3FB_REG_OFFSET) #define DI_DISP3_B1_MAP (0x01AC - MX3FB_REG_OFFSET) #define DI_DISP3_B2_MAP (0x01B0 - MX3FB_REG_OFFSET) #define DI_DISP_ACC_CC (0x01B4 - MX3FB_REG_OFFSET) #define DI_DISP_LLA_CONF (0x01B8 - MX3FB_REG_OFFSET) #define DI_DISP_LLA_DATA (0x01BC - MX3FB_REG_OFFSET) /* DI_DISP_SIG_POL bits */ #define DI_D3_VSYNC_POL_SHIFT 28 #define DI_D3_HSYNC_POL_SHIFT 27 #define DI_D3_DRDY_SHARP_POL_SHIFT 26 #define DI_D3_CLK_POL_SHIFT 25 #define DI_D3_DATA_POL_SHIFT 24 /* DI_DISP_IF_CONF bits */ #define DI_D3_CLK_IDLE_SHIFT 26 #define DI_D3_CLK_SEL_SHIFT 25 #define DI_D3_DATAMSK_SHIFT 24 enum ipu_panel { IPU_PANEL_SHARP_TFT, IPU_PANEL_TFT, }; struct ipu_di_signal_cfg { unsigned datamask_en:1; unsigned clksel_en:1; unsigned clkidle_en:1; unsigned data_pol:1; /* true = inverted */ unsigned clk_pol:1; /* true = rising edge */ unsigned enable_pol:1; unsigned Hsync_pol:1; /* true = active high */ unsigned Vsync_pol:1; }; static const struct fb_videomode mx3fb_modedb[] = { { /* 240x320 @ 60 Hz */ .name = "Sharp-QVGA", .refresh = 60, .xres = 240, .yres = 320, .pixclock = 185925, .left_margin = 9, .right_margin = 16, .upper_margin = 7, .lower_margin = 9, .hsync_len = 1, .vsync_len = 1, .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_SHARP_MODE | FB_SYNC_CLK_INVERT | FB_SYNC_DATA_INVERT | FB_SYNC_CLK_IDLE_EN, .vmode = FB_VMODE_NONINTERLACED, .flag = 0, }, { /* 240x33 @ 60 Hz */ .name = "Sharp-CLI", .refresh = 60, .xres = 240, .yres = 33, .pixclock = 185925, .left_margin = 9, .right_margin = 16, .upper_margin = 7, .lower_margin = 9 + 287, .hsync_len = 1, .vsync_len = 1, .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_SHARP_MODE | FB_SYNC_CLK_INVERT | FB_SYNC_DATA_INVERT | FB_SYNC_CLK_IDLE_EN, .vmode = FB_VMODE_NONINTERLACED, .flag = 0, }, { /* 640x480 @ 60 Hz */ .name = "NEC-VGA", .refresh = 60, .xres = 640, .yres = 480, .pixclock = 38255, .left_margin = 144, .right_margin = 0, .upper_margin = 34, .lower_margin = 40, .hsync_len = 1, .vsync_len = 1, .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_OE_ACT_HIGH, .vmode = FB_VMODE_NONINTERLACED, .flag = 0, }, { /* NTSC TV output */ .name = "TV-NTSC", .refresh = 60, .xres = 640, .yres = 480, .pixclock = 37538, .left_margin = 38, .right_margin = 858 - 640 - 38 - 3, .upper_margin = 36, .lower_margin = 518 - 480 - 36 - 1, .hsync_len = 3, .vsync_len = 1, .sync = 0, .vmode = FB_VMODE_NONINTERLACED, .flag = 0, }, { /* PAL TV output */ .name = "TV-PAL", .refresh = 50, .xres = 640, .yres = 480, .pixclock = 37538, .left_margin = 38, .right_margin = 960 - 640 - 38 - 32, .upper_margin = 32, .lower_margin = 555 - 480 - 32 - 3, .hsync_len = 32, .vsync_len = 3, .sync = 0, .vmode = FB_VMODE_NONINTERLACED, .flag = 0, }, { /* TV output VGA mode, 640x480 @ 65 Hz */ .name = "TV-VGA", .refresh = 60, .xres = 640, .yres = 480, .pixclock = 40574, .left_margin = 35, .right_margin = 45, .upper_margin = 9, .lower_margin = 1, .hsync_len = 46, .vsync_len = 5, .sync = 0, .vmode = FB_VMODE_NONINTERLACED, .flag = 0, }, }; struct mx3fb_data { struct fb_info *fbi; int backlight_level; void __iomem *reg_base; spinlock_t lock; struct device *dev; struct backlight_device *bl; uint32_t h_start_width; uint32_t v_start_width; enum disp_data_mapping disp_data_fmt; }; struct dma_chan_request { struct mx3fb_data *mx3fb; enum ipu_channel id; }; /* MX3 specific framebuffer information. */ struct mx3fb_info { int blank; enum ipu_channel ipu_ch; uint32_t cur_ipu_buf; u32 pseudo_palette[16]; struct completion flip_cmpl; struct mutex mutex; /* Protects fb-ops */ struct mx3fb_data *mx3fb; struct idmac_channel *idmac_channel; struct dma_async_tx_descriptor *txd; dma_cookie_t cookie; struct scatterlist sg[2]; struct fb_var_screeninfo cur_var; /* current var info */ }; static void sdc_set_brightness(struct mx3fb_data *mx3fb, uint8_t value); static u32 sdc_get_brightness(struct mx3fb_data *mx3fb); static int mx3fb_bl_get_brightness(struct backlight_device *bl) { struct mx3fb_data *fbd = bl_get_data(bl); return sdc_get_brightness(fbd); } static int mx3fb_bl_update_status(struct backlight_device *bl) { struct mx3fb_data *fbd = bl_get_data(bl); int brightness = bl->props.brightness; if (bl->props.power != FB_BLANK_UNBLANK) brightness = 0; if (bl->props.fb_blank != FB_BLANK_UNBLANK) brightness = 0; fbd->backlight_level = (fbd->backlight_level & ~0xFF) | brightness; sdc_set_brightness(fbd, fbd->backlight_level); return 0; } static const struct backlight_ops mx3fb_lcdc_bl_ops = { .update_status = mx3fb_bl_update_status, .get_brightness = mx3fb_bl_get_brightness, }; static void mx3fb_init_backlight(struct mx3fb_data *fbd) { struct backlight_properties props; struct backlight_device *bl; if (fbd->bl) return; memset(&props, 0, sizeof(struct backlight_properties)); props.max_brightness = 0xff; props.type = BACKLIGHT_RAW; sdc_set_brightness(fbd, fbd->backlight_level); bl = backlight_device_register("mx3fb-bl", fbd->dev, fbd, &mx3fb_lcdc_bl_ops, &props); if (IS_ERR(bl)) { dev_err(fbd->dev, "error %ld on backlight register\n", PTR_ERR(bl)); return; } fbd->bl = bl; bl->props.power = FB_BLANK_UNBLANK; bl->props.fb_blank = FB_BLANK_UNBLANK; bl->props.brightness = mx3fb_bl_get_brightness(bl); } static void mx3fb_exit_backlight(struct mx3fb_data *fbd) { backlight_device_unregister(fbd->bl); } static void mx3fb_dma_done(void *); /* Used fb-mode and bpp. Can be set on kernel command line, therefore file-static. */ static const char *fb_mode; static unsigned long default_bpp = 16; static u32 mx3fb_read_reg(struct mx3fb_data *mx3fb, unsigned long reg) { return __raw_readl(mx3fb->reg_base + reg); } static void mx3fb_write_reg(struct mx3fb_data *mx3fb, u32 value, unsigned long reg) { __raw_writel(value, mx3fb->reg_base + reg); } struct di_mapping { uint32_t b0, b1, b2; }; static const struct di_mapping di_mappings[] = { [IPU_DISP_DATA_MAPPING_RGB666] = { 0x0005000f, 0x000b000f, 0x0011000f }, [IPU_DISP_DATA_MAPPING_RGB565] = { 0x0004003f, 0x000a000f, 0x000f003f }, [IPU_DISP_DATA_MAPPING_RGB888] = { 0x00070000, 0x000f0000, 0x00170000 }, }; static void sdc_fb_init(struct mx3fb_info *fbi) { struct mx3fb_data *mx3fb = fbi->mx3fb; uint32_t reg; reg = mx3fb_read_reg(mx3fb, SDC_COM_CONF); mx3fb_write_reg(mx3fb, reg | SDC_COM_BG_EN, SDC_COM_CONF); } /* Returns enabled flag before uninit */ static uint32_t sdc_fb_uninit(struct mx3fb_info *fbi) { struct mx3fb_data *mx3fb = fbi->mx3fb; uint32_t reg; reg = mx3fb_read_reg(mx3fb, SDC_COM_CONF); mx3fb_write_reg(mx3fb, reg & ~SDC_COM_BG_EN, SDC_COM_CONF); return reg & SDC_COM_BG_EN; } static void sdc_enable_channel(struct mx3fb_info *mx3_fbi) { struct mx3fb_data *mx3fb = mx3_fbi->mx3fb; struct idmac_channel *ichan = mx3_fbi->idmac_channel; struct dma_chan *dma_chan = &ichan->dma_chan; unsigned long flags; dma_cookie_t cookie; if (mx3_fbi->txd) dev_dbg(mx3fb->dev, "mx3fbi %p, desc %p, sg %p\n", mx3_fbi, to_tx_desc(mx3_fbi->txd), to_tx_desc(mx3_fbi->txd)->sg); else dev_dbg(mx3fb->dev, "mx3fbi %p, txd = NULL\n", mx3_fbi); /* This enables the channel */ if (mx3_fbi->cookie < 0) { mx3_fbi->txd = dmaengine_prep_slave_sg(dma_chan, &mx3_fbi->sg[0], 1, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT); if (!mx3_fbi->txd) { dev_err(mx3fb->dev, "Cannot allocate descriptor on %d\n", dma_chan->chan_id); return; } mx3_fbi->txd->callback_param = mx3_fbi->txd; mx3_fbi->txd->callback = mx3fb_dma_done; cookie = mx3_fbi->txd->tx_submit(mx3_fbi->txd); dev_dbg(mx3fb->dev, "%d: Submit %p #%d [%c]\n", __LINE__, mx3_fbi->txd, cookie, list_empty(&ichan->queue) ? '-' : '+'); } else { if (!mx3_fbi->txd || !mx3_fbi->txd->tx_submit) { dev_err(mx3fb->dev, "Cannot enable channel %d\n", dma_chan->chan_id); return; } /* Just re-activate the same buffer */ dma_async_issue_pending(dma_chan); cookie = mx3_fbi->cookie; dev_dbg(mx3fb->dev, "%d: Re-submit %p #%d [%c]\n", __LINE__, mx3_fbi->txd, cookie, list_empty(&ichan->queue) ? '-' : '+'); } if (cookie >= 0) { spin_lock_irqsave(&mx3fb->lock, flags); sdc_fb_init(mx3_fbi); mx3_fbi->cookie = cookie; spin_unlock_irqrestore(&mx3fb->lock, flags); } /* * Attention! Without this msleep the channel keeps generating * interrupts. Next sdc_set_brightness() is going to be called * from mx3fb_blank(). */ msleep(2); } static void sdc_disable_channel(struct mx3fb_info *mx3_fbi) { struct mx3fb_data *mx3fb = mx3_fbi->mx3fb; uint32_t enabled; unsigned long flags; if (mx3_fbi->txd == NULL) return; spin_lock_irqsave(&mx3fb->lock, flags); enabled = sdc_fb_uninit(mx3_fbi); spin_unlock_irqrestore(&mx3fb->lock, flags); dmaengine_terminate_all(mx3_fbi->txd->chan); mx3_fbi->txd = NULL; mx3_fbi->cookie = -EINVAL; } /** * sdc_set_window_pos() - set window position of the respective plane. * @mx3fb: mx3fb context. * @channel: IPU DMAC channel ID. * @x_pos: X coordinate relative to the top left corner to place window at. * @y_pos: Y coordinate relative to the top left corner to place window at. * @return: 0 on success or negative error code on failure. */ static int sdc_set_window_pos(struct mx3fb_data *mx3fb, enum ipu_channel channel, int16_t x_pos, int16_t y_pos) { if (channel != IDMAC_SDC_0) return -EINVAL; x_pos += mx3fb->h_start_width; y_pos += mx3fb->v_start_width; mx3fb_write_reg(mx3fb, (x_pos << 16) | y_pos, SDC_BG_POS); return 0; } /** * sdc_init_panel() - initialize a synchronous LCD panel. * @mx3fb: mx3fb context. * @panel: panel type. * @pixel_clk: desired pixel clock frequency in Hz. * @width: width of panel in pixels. * @height: height of panel in pixels. * @h_start_width: number of pixel clocks between the HSYNC signal pulse * and the start of valid data. * @h_sync_width: width of the HSYNC signal in units of pixel clocks. * @h_end_width: number of pixel clocks between the end of valid data * and the HSYNC signal for next line. * @v_start_width: number of lines between the VSYNC signal pulse and the * start of valid data. * @v_sync_width: width of the VSYNC signal in units of lines * @v_end_width: number of lines between the end of valid data and the * VSYNC signal for next frame. * @sig: bitfield of signal polarities for LCD interface. * @return: 0 on success or negative error code on failure. */ static int sdc_init_panel(struct mx3fb_data *mx3fb, enum ipu_panel panel, uint32_t pixel_clk, uint16_t width, uint16_t height, uint16_t h_start_width, uint16_t h_sync_width, uint16_t h_end_width, uint16_t v_start_width, uint16_t v_sync_width, uint16_t v_end_width, struct ipu_di_signal_cfg sig) { unsigned long lock_flags; uint32_t reg; uint32_t old_conf; uint32_t div; struct clk *ipu_clk; const struct di_mapping *map; dev_dbg(mx3fb->dev, "panel size = %d x %d", width, height); if (v_sync_width == 0 || h_sync_width == 0) return -EINVAL; /* Init panel size and blanking periods */ reg = ((uint32_t) (h_sync_width - 1) << 26) | ((uint32_t) (width + h_start_width + h_end_width - 1) << 16); mx3fb_write_reg(mx3fb, reg, SDC_HOR_CONF); #ifdef DEBUG printk(KERN_CONT " hor_conf %x,", reg); #endif reg = ((uint32_t) (v_sync_width - 1) << 26) | SDC_V_SYNC_WIDTH_L | ((uint32_t) (height + v_start_width + v_end_width - 1) << 16); mx3fb_write_reg(mx3fb, reg, SDC_VER_CONF); #ifdef DEBUG printk(KERN_CONT " ver_conf %x\n", reg); #endif mx3fb->h_start_width = h_start_width; mx3fb->v_start_width = v_start_width; switch (panel) { case IPU_PANEL_SHARP_TFT: mx3fb_write_reg(mx3fb, 0x00FD0102L, SDC_SHARP_CONF_1); mx3fb_write_reg(mx3fb, 0x00F500F4L, SDC_SHARP_CONF_2); mx3fb_write_reg(mx3fb, SDC_COM_SHARP | SDC_COM_TFT_COLOR, SDC_COM_CONF); break; case IPU_PANEL_TFT: mx3fb_write_reg(mx3fb, SDC_COM_TFT_COLOR, SDC_COM_CONF); break; default: return -EINVAL; } /* Init clocking */ /* * Calculate divider: fractional part is 4 bits so simply multiple by * 2^4 to get fractional part, as long as we stay under ~250MHz and on * i.MX31 it (HSP_CLK) is <= 178MHz. Currently 128.267MHz */ ipu_clk = clk_get(mx3fb->dev, NULL); if (!IS_ERR(ipu_clk)) { div = clk_get_rate(ipu_clk) * 16 / pixel_clk; clk_put(ipu_clk); } else { div = 0; } if (div < 0x40) { /* Divider less than 4 */ dev_dbg(mx3fb->dev, "InitPanel() - Pixel clock divider less than 4\n"); div = 0x40; } dev_dbg(mx3fb->dev, "pixel clk = %u, divider %u.%u\n", pixel_clk, div >> 4, (div & 7) * 125); spin_lock_irqsave(&mx3fb->lock, lock_flags); /* * DISP3_IF_CLK_DOWN_WR is half the divider value and 2 fraction bits * fewer. Subtract 1 extra from DISP3_IF_CLK_DOWN_WR based on timing * debug. DISP3_IF_CLK_UP_WR is 0 */ mx3fb_write_reg(mx3fb, (((div / 8) - 1) << 22) | div, DI_DISP3_TIME_CONF); /* DI settings */ old_conf = mx3fb_read_reg(mx3fb, DI_DISP_IF_CONF) & 0x78FFFFFF; old_conf |= sig.datamask_en << DI_D3_DATAMSK_SHIFT | sig.clksel_en << DI_D3_CLK_SEL_SHIFT | sig.clkidle_en << DI_D3_CLK_IDLE_SHIFT; mx3fb_write_reg(mx3fb, old_conf, DI_DISP_IF_CONF); old_conf = mx3fb_read_reg(mx3fb, DI_DISP_SIG_POL) & 0xE0FFFFFF; old_conf |= sig.data_pol << DI_D3_DATA_POL_SHIFT | sig.clk_pol << DI_D3_CLK_POL_SHIFT | sig.enable_pol << DI_D3_DRDY_SHARP_POL_SHIFT | sig.Hsync_pol << DI_D3_HSYNC_POL_SHIFT | sig.Vsync_pol << DI_D3_VSYNC_POL_SHIFT; mx3fb_write_reg(mx3fb, old_conf, DI_DISP_SIG_POL); map = &di_mappings[mx3fb->disp_data_fmt]; mx3fb_write_reg(mx3fb, map->b0, DI_DISP3_B0_MAP); mx3fb_write_reg(mx3fb, map->b1, DI_DISP3_B1_MAP); mx3fb_write_reg(mx3fb, map->b2, DI_DISP3_B2_MAP); spin_unlock_irqrestore(&mx3fb->lock, lock_flags); dev_dbg(mx3fb->dev, "DI_DISP_IF_CONF = 0x%08X\n", mx3fb_read_reg(mx3fb, DI_DISP_IF_CONF)); dev_dbg(mx3fb->dev, "DI_DISP_SIG_POL = 0x%08X\n", mx3fb_read_reg(mx3fb, DI_DISP_SIG_POL)); dev_dbg(mx3fb->dev, "DI_DISP3_TIME_CONF = 0x%08X\n", mx3fb_read_reg(mx3fb, DI_DISP3_TIME_CONF)); return 0; } /** * sdc_set_color_key() - set the transparent color key for SDC graphic plane. * @mx3fb: mx3fb context. * @channel: IPU DMAC channel ID. * @enable: boolean to enable or disable color keyl. * @color_key: 24-bit RGB color to use as transparent color key. * @return: 0 on success or negative error code on failure. */ static int sdc_set_color_key(struct mx3fb_data *mx3fb, enum ipu_channel channel, bool enable, uint32_t color_key) { uint32_t reg, sdc_conf; unsigned long lock_flags; spin_lock_irqsave(&mx3fb->lock, lock_flags); sdc_conf = mx3fb_read_reg(mx3fb, SDC_COM_CONF); if (channel == IDMAC_SDC_0) sdc_conf &= ~SDC_COM_GWSEL; else sdc_conf |= SDC_COM_GWSEL; if (enable) { reg = mx3fb_read_reg(mx3fb, SDC_GW_CTRL) & 0xFF000000L; mx3fb_write_reg(mx3fb, reg | (color_key & 0x00FFFFFFL), SDC_GW_CTRL); sdc_conf |= SDC_COM_KEY_COLOR_G; } else { sdc_conf &= ~SDC_COM_KEY_COLOR_G; } mx3fb_write_reg(mx3fb, sdc_conf, SDC_COM_CONF); spin_unlock_irqrestore(&mx3fb->lock, lock_flags); return 0; } /** * sdc_set_global_alpha() - set global alpha blending modes. * @mx3fb: mx3fb context. * @enable: boolean to enable or disable global alpha blending. If disabled, * per pixel blending is used. * @alpha: global alpha value. * @return: 0 on success or negative error code on failure. */ static int sdc_set_global_alpha(struct mx3fb_data *mx3fb, bool enable, uint8_t alpha) { uint32_t reg; unsigned long lock_flags; spin_lock_irqsave(&mx3fb->lock, lock_flags); if (enable) { reg = mx3fb_read_reg(mx3fb, SDC_GW_CTRL) & 0x00FFFFFFL; mx3fb_write_reg(mx3fb, reg | ((uint32_t) alpha << 24), SDC_GW_CTRL); reg = mx3fb_read_reg(mx3fb, SDC_COM_CONF); mx3fb_write_reg(mx3fb, reg | SDC_COM_GLB_A, SDC_COM_CONF); } else { reg = mx3fb_read_reg(mx3fb, SDC_COM_CONF); mx3fb_write_reg(mx3fb, reg & ~SDC_COM_GLB_A, SDC_COM_CONF); } spin_unlock_irqrestore(&mx3fb->lock, lock_flags); return 0; } static u32 sdc_get_brightness(struct mx3fb_data *mx3fb) { u32 brightness; brightness = mx3fb_read_reg(mx3fb, SDC_PWM_CTRL); brightness = (brightness >> 16) & 0xFF; return brightness; } static void sdc_set_brightness(struct mx3fb_data *mx3fb, uint8_t value) { dev_dbg(mx3fb->dev, "%s: value = %d\n", __func__, value); /* This might be board-specific */ mx3fb_write_reg(mx3fb, 0x03000000UL | value << 16, SDC_PWM_CTRL); return; } static uint32_t bpp_to_pixfmt(int bpp) { uint32_t pixfmt = 0; switch (bpp) { case 24: pixfmt = IPU_PIX_FMT_BGR24; break; case 32: pixfmt = IPU_PIX_FMT_BGR32; break; case 16: pixfmt = IPU_PIX_FMT_RGB565; break; } return pixfmt; } static int mx3fb_blank(int blank, struct fb_info *fbi); static int mx3fb_map_video_memory(struct fb_info *fbi, unsigned int mem_len, bool lock); static int mx3fb_unmap_video_memory(struct fb_info *fbi); /** * mx3fb_set_fix() - set fixed framebuffer parameters from variable settings. * @info: framebuffer information pointer * @return: 0 on success or negative error code on failure. */ static int mx3fb_set_fix(struct fb_info *fbi) { struct fb_fix_screeninfo *fix = &fbi->fix; struct fb_var_screeninfo *var = &fbi->var; strncpy(fix->id, "DISP3 BG", 8); fix->line_length = var->xres_virtual * var->bits_per_pixel / 8; fix->type = FB_TYPE_PACKED_PIXELS; fix->accel = FB_ACCEL_NONE; fix->visual = FB_VISUAL_TRUECOLOR; fix->xpanstep = 1; fix->ypanstep = 1; return 0; } static void mx3fb_dma_done(void *arg) { struct idmac_tx_desc *tx_desc = to_tx_desc(arg); struct dma_chan *chan = tx_desc->txd.chan; struct idmac_channel *ichannel = to_idmac_chan(chan); struct mx3fb_data *mx3fb = ichannel->client; struct mx3fb_info *mx3_fbi = mx3fb->fbi->par; dev_dbg(mx3fb->dev, "irq %d callback\n", ichannel->eof_irq); /* We only need one interrupt, it will be re-enabled as needed */ disable_irq_nosync(ichannel->eof_irq); complete(&mx3_fbi->flip_cmpl); } static bool mx3fb_must_set_par(struct fb_info *fbi) { struct mx3fb_info *mx3_fbi = fbi->par; struct fb_var_screeninfo old_var = mx3_fbi->cur_var; struct fb_var_screeninfo new_var = fbi->var; if ((fbi->var.activate & FB_ACTIVATE_FORCE) && (fbi->var.activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) return true; /* * Ignore xoffset and yoffset update, * because pan display handles this case. */ old_var.xoffset = new_var.xoffset; old_var.yoffset = new_var.yoffset; return !!memcmp(&old_var, &new_var, sizeof(struct fb_var_screeninfo)); } static int __set_par(struct fb_info *fbi, bool lock) { u32 mem_len, cur_xoffset, cur_yoffset; struct ipu_di_signal_cfg sig_cfg; enum ipu_panel mode = IPU_PANEL_TFT; struct mx3fb_info *mx3_fbi = fbi->par; struct mx3fb_data *mx3fb = mx3_fbi->mx3fb; struct idmac_channel *ichan = mx3_fbi->idmac_channel; struct idmac_video_param *video = &ichan->params.video; struct scatterlist *sg = mx3_fbi->sg; /* Total cleanup */ if (mx3_fbi->txd) sdc_disable_channel(mx3_fbi); mx3fb_set_fix(fbi); mem_len = fbi->var.yres_virtual * fbi->fix.line_length; if (mem_len > fbi->fix.smem_len) { if (fbi->fix.smem_start) mx3fb_unmap_video_memory(fbi); if (mx3fb_map_video_memory(fbi, mem_len, lock) < 0) return -ENOMEM; } sg_init_table(&sg[0], 1); sg_init_table(&sg[1], 1); sg_dma_address(&sg[0]) = fbi->fix.smem_start; sg_set_page(&sg[0], virt_to_page(fbi->screen_base), fbi->fix.smem_len, offset_in_page(fbi->screen_base)); if (mx3_fbi->ipu_ch == IDMAC_SDC_0) { memset(&sig_cfg, 0, sizeof(sig_cfg)); if (fbi->var.sync & FB_SYNC_HOR_HIGH_ACT) sig_cfg.Hsync_pol = true; if (fbi->var.sync & FB_SYNC_VERT_HIGH_ACT) sig_cfg.Vsync_pol = true; if (fbi->var.sync & FB_SYNC_CLK_INVERT) sig_cfg.clk_pol = true; if (fbi->var.sync & FB_SYNC_DATA_INVERT) sig_cfg.data_pol = true; if (fbi->var.sync & FB_SYNC_OE_ACT_HIGH) sig_cfg.enable_pol = true; if (fbi->var.sync & FB_SYNC_CLK_IDLE_EN) sig_cfg.clkidle_en = true; if (fbi->var.sync & FB_SYNC_CLK_SEL_EN) sig_cfg.clksel_en = true; if (fbi->var.sync & FB_SYNC_SHARP_MODE) mode = IPU_PANEL_SHARP_TFT; dev_dbg(fbi->device, "pixclock = %u Hz\n", (u32) (PICOS2KHZ(fbi->var.pixclock) * 1000UL)); if (sdc_init_panel(mx3fb, mode, (PICOS2KHZ(fbi->var.pixclock)) * 1000UL, fbi->var.xres, fbi->var.yres, fbi->var.left_margin, fbi->var.hsync_len, fbi->var.right_margin + fbi->var.hsync_len, fbi->var.upper_margin, fbi->var.vsync_len, fbi->var.lower_margin + fbi->var.vsync_len, sig_cfg) != 0) { dev_err(fbi->device, "mx3fb: Error initializing panel.\n"); return -EINVAL; } } sdc_set_window_pos(mx3fb, mx3_fbi->ipu_ch, 0, 0); mx3_fbi->cur_ipu_buf = 0; video->out_pixel_fmt = bpp_to_pixfmt(fbi->var.bits_per_pixel); video->out_width = fbi->var.xres; video->out_height = fbi->var.yres; video->out_stride = fbi->var.xres_virtual; if (mx3_fbi->blank == FB_BLANK_UNBLANK) { sdc_enable_channel(mx3_fbi); /* * sg[0] points to fb smem_start address * and is actually active in controller. */ mx3_fbi->cur_var.xoffset = 0; mx3_fbi->cur_var.yoffset = 0; } /* * Preserve xoffset and yoffest in case they are * inactive in controller as fb is blanked. */ cur_xoffset = mx3_fbi->cur_var.xoffset; cur_yoffset = mx3_fbi->cur_var.yoffset; mx3_fbi->cur_var = fbi->var; mx3_fbi->cur_var.xoffset = cur_xoffset; mx3_fbi->cur_var.yoffset = cur_yoffset; return 0; } /** * mx3fb_set_par() - set framebuffer parameters and change the operating mode. * @fbi: framebuffer information pointer. * @return: 0 on success or negative error code on failure. */ static int mx3fb_set_par(struct fb_info *fbi) { struct mx3fb_info *mx3_fbi = fbi->par; struct mx3fb_data *mx3fb = mx3_fbi->mx3fb; struct idmac_channel *ichan = mx3_fbi->idmac_channel; int ret; dev_dbg(mx3fb->dev, "%s [%c]\n", __func__, list_empty(&ichan->queue) ? '-' : '+'); mutex_lock(&mx3_fbi->mutex); ret = mx3fb_must_set_par(fbi) ? __set_par(fbi, true) : 0; mutex_unlock(&mx3_fbi->mutex); return ret; } /** * mx3fb_check_var() - check and adjust framebuffer variable parameters. * @var: framebuffer variable parameters * @fbi: framebuffer information pointer */ static int mx3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *fbi) { struct mx3fb_info *mx3_fbi = fbi->par; u32 vtotal; u32 htotal; dev_dbg(fbi->device, "%s\n", __func__); if (var->xres_virtual < var->xres) var->xres_virtual = var->xres; if (var->yres_virtual < var->yres) var->yres_virtual = var->yres; if ((var->bits_per_pixel != 32) && (var->bits_per_pixel != 24) && (var->bits_per_pixel != 16)) var->bits_per_pixel = default_bpp; switch (var->bits_per_pixel) { case 16: var->red.length = 5; var->red.offset = 11; var->red.msb_right = 0; var->green.length = 6; var->green.offset = 5; var->green.msb_right = 0; var->blue.length = 5; var->blue.offset = 0; var->blue.msb_right = 0; var->transp.length = 0; var->transp.offset = 0; var->transp.msb_right = 0; break; case 24: var->red.length = 8; var->red.offset = 16; var->red.msb_right = 0; var->green.length = 8; var->green.offset = 8; var->green.msb_right = 0; var->blue.length = 8; var->blue.offset = 0; var->blue.msb_right = 0; var->transp.length = 0; var->transp.offset = 0; var->transp.msb_right = 0; break; case 32: var->red.length = 8; var->red.offset = 16; var->red.msb_right = 0; var->green.length = 8; var->green.offset = 8; var->green.msb_right = 0; var->blue.length = 8; var->blue.offset = 0; var->blue.msb_right = 0; var->transp.length = 8; var->transp.offset = 24; var->transp.msb_right = 0; break; } if (var->pixclock < 1000) { htotal = var->xres + var->right_margin + var->hsync_len + var->left_margin; vtotal = var->yres + var->lower_margin + var->vsync_len + var->upper_margin; var->pixclock = (vtotal * htotal * 6UL) / 100UL; var->pixclock = KHZ2PICOS(var->pixclock); dev_dbg(fbi->device, "pixclock set for 60Hz refresh = %u ps\n", var->pixclock); } var->height = -1; var->width = -1; var->grayscale = 0; /* Preserve sync flags */ var->sync |= mx3_fbi->cur_var.sync; mx3_fbi->cur_var.sync |= var->sync; return 0; } static u32 chan_to_field(unsigned int chan, struct fb_bitfield *bf) { chan &= 0xffff; chan >>= 16 - bf->length; return chan << bf->offset; } static int mx3fb_setcolreg(unsigned int regno, unsigned int red, unsigned int green, unsigned int blue, unsigned int trans, struct fb_info *fbi) { struct mx3fb_info *mx3_fbi = fbi->par; u32 val; int ret = 1; dev_dbg(fbi->device, "%s, regno = %u\n", __func__, regno); mutex_lock(&mx3_fbi->mutex); /* * If greyscale is true, then we convert the RGB value * to greyscale no matter what visual we are using. */ if (fbi->var.grayscale) red = green = blue = (19595 * red + 38470 * green + 7471 * blue) >> 16; switch (fbi->fix.visual) { case FB_VISUAL_TRUECOLOR: /* * 16-bit True Colour. We encode the RGB value * according to the RGB bitfield information. */ if (regno < 16) { u32 *pal = fbi->pseudo_palette; val = chan_to_field(red, &fbi->var.red); val |= chan_to_field(green, &fbi->var.green); val |= chan_to_field(blue, &fbi->var.blue); pal[regno] = val; ret = 0; } break; case FB_VISUAL_STATIC_PSEUDOCOLOR: case FB_VISUAL_PSEUDOCOLOR: break; } mutex_unlock(&mx3_fbi->mutex); return ret; } static void __blank(int blank, struct fb_info *fbi) { struct mx3fb_info *mx3_fbi = fbi->par; struct mx3fb_data *mx3fb = mx3_fbi->mx3fb; int was_blank = mx3_fbi->blank; mx3_fbi->blank = blank; /* Attention! * Do not call sdc_disable_channel() for a channel that is disabled * already! This will result in a kernel NULL pointer dereference * (mx3_fbi->txd is NULL). Hide the fact, that all blank modes are * handled equally by this driver. */ if (blank > FB_BLANK_UNBLANK && was_blank > FB_BLANK_UNBLANK) return; switch (blank) { case FB_BLANK_POWERDOWN: case FB_BLANK_VSYNC_SUSPEND: case FB_BLANK_HSYNC_SUSPEND: case FB_BLANK_NORMAL: sdc_set_brightness(mx3fb, 0); memset((char *)fbi->screen_base, 0, fbi->fix.smem_len); /* Give LCD time to update - enough for 50 and 60 Hz */ msleep(25); sdc_disable_channel(mx3_fbi); break; case FB_BLANK_UNBLANK: sdc_enable_channel(mx3_fbi); sdc_set_brightness(mx3fb, mx3fb->backlight_level); break; } } /** * mx3fb_blank() - blank the display. */ static int mx3fb_blank(int blank, struct fb_info *fbi) { struct mx3fb_info *mx3_fbi = fbi->par; dev_dbg(fbi->device, "%s, blank = %d, base %p, len %u\n", __func__, blank, fbi->screen_base, fbi->fix.smem_len); if (mx3_fbi->blank == blank) return 0; mutex_lock(&mx3_fbi->mutex); __blank(blank, fbi); mutex_unlock(&mx3_fbi->mutex); return 0; } /** * mx3fb_pan_display() - pan or wrap the display * @var: variable screen buffer information. * @info: framebuffer information pointer. * * We look only at xoffset, yoffset and the FB_VMODE_YWRAP flag */ static int mx3fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *fbi) { struct mx3fb_info *mx3_fbi = fbi->par; u32 y_bottom; unsigned long base; off_t offset; dma_cookie_t cookie; struct scatterlist *sg = mx3_fbi->sg; struct dma_chan *dma_chan = &mx3_fbi->idmac_channel->dma_chan; struct dma_async_tx_descriptor *txd; int ret; dev_dbg(fbi->device, "%s [%c]\n", __func__, list_empty(&mx3_fbi->idmac_channel->queue) ? '-' : '+'); if (var->xoffset > 0) { dev_dbg(fbi->device, "x panning not supported\n"); return -EINVAL; } if (mx3_fbi->cur_var.xoffset == var->xoffset && mx3_fbi->cur_var.yoffset == var->yoffset) return 0; /* No change, do nothing */ y_bottom = var->yoffset; if (!(var->vmode & FB_VMODE_YWRAP)) y_bottom += fbi->var.yres; if (y_bottom > fbi->var.yres_virtual) return -EINVAL; mutex_lock(&mx3_fbi->mutex); offset = var->yoffset * fbi->fix.line_length + var->xoffset * (fbi->var.bits_per_pixel / 8); base = fbi->fix.smem_start + offset; dev_dbg(fbi->device, "Updating SDC BG buf %d address=0x%08lX\n", mx3_fbi->cur_ipu_buf, base); /* * We enable the End of Frame interrupt, which will free a tx-descriptor, * which we will need for the next dmaengine_prep_slave_sg(). The * IRQ-handler will disable the IRQ again. */ init_completion(&mx3_fbi->flip_cmpl); enable_irq(mx3_fbi->idmac_channel->eof_irq); ret = wait_for_completion_timeout(&mx3_fbi->flip_cmpl, HZ / 10); if (ret <= 0) { mutex_unlock(&mx3_fbi->mutex); dev_info(fbi->device, "Panning failed due to %s\n", ret < 0 ? "user interrupt" : "timeout"); disable_irq(mx3_fbi->idmac_channel->eof_irq); return ret ? : -ETIMEDOUT; } mx3_fbi->cur_ipu_buf = !mx3_fbi->cur_ipu_buf; sg_dma_address(&sg[mx3_fbi->cur_ipu_buf]) = base; sg_set_page(&sg[mx3_fbi->cur_ipu_buf], virt_to_page(fbi->screen_base + offset), fbi->fix.smem_len, offset_in_page(fbi->screen_base + offset)); if (mx3_fbi->txd) async_tx_ack(mx3_fbi->txd); txd = dmaengine_prep_slave_sg(dma_chan, sg + mx3_fbi->cur_ipu_buf, 1, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT); if (!txd) { dev_err(fbi->device, "Error preparing a DMA transaction descriptor.\n"); mutex_unlock(&mx3_fbi->mutex); return -EIO; } txd->callback_param = txd; txd->callback = mx3fb_dma_done; /* * Emulate original mx3fb behaviour: each new call to idmac_tx_submit() * should switch to another buffer */ cookie = txd->tx_submit(txd); dev_dbg(fbi->device, "%d: Submit %p #%d\n", __LINE__, txd, cookie); if (cookie < 0) { dev_err(fbi->device, "Error updating SDC buf %d to address=0x%08lX\n", mx3_fbi->cur_ipu_buf, base); mutex_unlock(&mx3_fbi->mutex); return -EIO; } mx3_fbi->txd = txd; fbi->var.xoffset = var->xoffset; fbi->var.yoffset = var->yoffset; if (var->vmode & FB_VMODE_YWRAP) fbi->var.vmode |= FB_VMODE_YWRAP; else fbi->var.vmode &= ~FB_VMODE_YWRAP; mx3_fbi->cur_var = fbi->var; mutex_unlock(&mx3_fbi->mutex); dev_dbg(fbi->device, "Update complete\n"); return 0; } /* * This structure contains the pointers to the control functions that are * invoked by the core framebuffer driver to perform operations like * blitting, rectangle filling, copy regions and cursor definition. */ static const struct fb_ops mx3fb_ops = { .owner = THIS_MODULE, .fb_set_par = mx3fb_set_par, .fb_check_var = mx3fb_check_var, .fb_setcolreg = mx3fb_setcolreg, .fb_pan_display = mx3fb_pan_display, .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, .fb_imageblit = cfb_imageblit, .fb_blank = mx3fb_blank, }; #ifdef CONFIG_PM /* * Power management hooks. Note that we won't be called from IRQ context, * unlike the blank functions above, so we may sleep. */ /* * Suspends the framebuffer and blanks the screen. Power management support */ static int mx3fb_suspend(struct platform_device *pdev, pm_message_t state) { struct mx3fb_data *mx3fb = platform_get_drvdata(pdev); struct mx3fb_info *mx3_fbi = mx3fb->fbi->par; console_lock(); fb_set_suspend(mx3fb->fbi, 1); console_unlock(); if (mx3_fbi->blank == FB_BLANK_UNBLANK) { sdc_disable_channel(mx3_fbi); sdc_set_brightness(mx3fb, 0); } return 0; } /* * Resumes the framebuffer and unblanks the screen. Power management support */ static int mx3fb_resume(struct platform_device *pdev) { struct mx3fb_data *mx3fb = platform_get_drvdata(pdev); struct mx3fb_info *mx3_fbi = mx3fb->fbi->par; if (mx3_fbi->blank == FB_BLANK_UNBLANK) { sdc_enable_channel(mx3_fbi); sdc_set_brightness(mx3fb, mx3fb->backlight_level); } console_lock(); fb_set_suspend(mx3fb->fbi, 0); console_unlock(); return 0; } #else #define mx3fb_suspend NULL #define mx3fb_resume NULL #endif /* * Main framebuffer functions */ /** * mx3fb_map_video_memory() - allocates the DRAM memory for the frame buffer. * @fbi: framebuffer information pointer * @mem_len: length of mapped memory * @lock: do not lock during initialisation * @return: Error code indicating success or failure * * This buffer is remapped into a non-cached, non-buffered, memory region to * allow palette and pixel writes to occur without flushing the cache. Once this * area is remapped, all virtual memory access to the video memory should occur * at the new region. */ static int mx3fb_map_video_memory(struct fb_info *fbi, unsigned int mem_len, bool lock) { int retval = 0; dma_addr_t addr; fbi->screen_base = dma_alloc_wc(fbi->device, mem_len, &addr, GFP_DMA | GFP_KERNEL); if (!fbi->screen_base) { dev_err(fbi->device, "Cannot allocate %u bytes framebuffer memory\n", mem_len); retval = -EBUSY; goto err0; } if (lock) mutex_lock(&fbi->mm_lock); fbi->fix.smem_start = addr; fbi->fix.smem_len = mem_len; if (lock) mutex_unlock(&fbi->mm_lock); dev_dbg(fbi->device, "allocated fb @ p=0x%08x, v=0x%p, size=%d.\n", (uint32_t) fbi->fix.smem_start, fbi->screen_base, fbi->fix.smem_len); fbi->screen_size = fbi->fix.smem_len; /* Clear the screen */ memset((char *)fbi->screen_base, 0, fbi->fix.smem_len); return 0; err0: fbi->fix.smem_len = 0; fbi->fix.smem_start = 0; fbi->screen_base = NULL; return retval; } /** * mx3fb_unmap_video_memory() - de-allocate frame buffer memory. * @fbi: framebuffer information pointer * @return: error code indicating success or failure */ static int mx3fb_unmap_video_memory(struct fb_info *fbi) { dma_free_wc(fbi->device, fbi->fix.smem_len, fbi->screen_base, fbi->fix.smem_start); fbi->screen_base = NULL; mutex_lock(&fbi->mm_lock); fbi->fix.smem_start = 0; fbi->fix.smem_len = 0; mutex_unlock(&fbi->mm_lock); return 0; } /** * mx3fb_init_fbinfo() - initialize framebuffer information object. * @return: initialized framebuffer structure. */ static struct fb_info *mx3fb_init_fbinfo(struct device *dev, const struct fb_ops *ops) { struct fb_info *fbi; struct mx3fb_info *mx3fbi; int ret; /* Allocate sufficient memory for the fb structure */ fbi = framebuffer_alloc(sizeof(struct mx3fb_info), dev); if (!fbi) return NULL; mx3fbi = fbi->par; mx3fbi->cookie = -EINVAL; mx3fbi->cur_ipu_buf = 0; fbi->var.activate = FB_ACTIVATE_NOW; fbi->fbops = ops; fbi->flags = FBINFO_FLAG_DEFAULT; fbi->pseudo_palette = mx3fbi->pseudo_palette; mutex_init(&mx3fbi->mutex); /* Allocate colormap */ ret = fb_alloc_cmap(&fbi->cmap, 16, 0); if (ret < 0) { framebuffer_release(fbi); return NULL; } return fbi; } static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan) { struct device *dev = mx3fb->dev; struct mx3fb_platform_data *mx3fb_pdata = dev_get_platdata(dev); const char *name = mx3fb_pdata->name; unsigned int irq; struct fb_info *fbi; struct mx3fb_info *mx3fbi; const struct fb_videomode *mode; int ret, num_modes; if (mx3fb_pdata->disp_data_fmt >= ARRAY_SIZE(di_mappings)) { dev_err(dev, "Illegal display data format %d\n", mx3fb_pdata->disp_data_fmt); return -EINVAL; } ichan->client = mx3fb; irq = ichan->eof_irq; if (ichan->dma_chan.chan_id != IDMAC_SDC_0) return -EINVAL; fbi = mx3fb_init_fbinfo(dev, &mx3fb_ops); if (!fbi) return -ENOMEM; if (!fb_mode) fb_mode = name; if (!fb_mode) { ret = -EINVAL; goto emode; } if (mx3fb_pdata->mode && mx3fb_pdata->num_modes) { mode = mx3fb_pdata->mode; num_modes = mx3fb_pdata->num_modes; } else { mode = mx3fb_modedb; num_modes = ARRAY_SIZE(mx3fb_modedb); } if (!fb_find_mode(&fbi->var, fbi, fb_mode, mode, num_modes, NULL, default_bpp)) { ret = -EBUSY; goto emode; } fb_videomode_to_modelist(mode, num_modes, &fbi->modelist); /* Default Y virtual size is 2x panel size */ fbi->var.yres_virtual = fbi->var.yres * 2; mx3fb->fbi = fbi; /* set Display Interface clock period */ mx3fb_write_reg(mx3fb, 0x00100010L, DI_HSP_CLK_PER); /* Might need to trigger HSP clock change - see 44.3.3.8.5 */ sdc_set_brightness(mx3fb, 255); sdc_set_global_alpha(mx3fb, true, 0xFF); sdc_set_color_key(mx3fb, IDMAC_SDC_0, false, 0); mx3fbi = fbi->par; mx3fbi->idmac_channel = ichan; mx3fbi->ipu_ch = ichan->dma_chan.chan_id; mx3fbi->mx3fb = mx3fb; mx3fbi->blank = FB_BLANK_NORMAL; mx3fb->disp_data_fmt = mx3fb_pdata->disp_data_fmt; init_completion(&mx3fbi->flip_cmpl); disable_irq(ichan->eof_irq); dev_dbg(mx3fb->dev, "disabling irq %d\n", ichan->eof_irq); ret = __set_par(fbi, false); if (ret < 0) goto esetpar; __blank(FB_BLANK_UNBLANK, fbi); dev_info(dev, "registered, using mode %s\n", fb_mode); ret = register_framebuffer(fbi); if (ret < 0) goto erfb; return 0; erfb: esetpar: emode: fb_dealloc_cmap(&fbi->cmap); framebuffer_release(fbi); return ret; } static bool chan_filter(struct dma_chan *chan, void *arg) { struct dma_chan_request *rq = arg; struct device *dev; struct mx3fb_platform_data *mx3fb_pdata; if (!imx_dma_is_ipu(chan)) return false; if (!rq) return false; dev = rq->mx3fb->dev; mx3fb_pdata = dev_get_platdata(dev); return rq->id == chan->chan_id && mx3fb_pdata->dma_dev == chan->device->dev; } static void release_fbi(struct fb_info *fbi) { mx3fb_unmap_video_memory(fbi); fb_dealloc_cmap(&fbi->cmap); unregister_framebuffer(fbi); framebuffer_release(fbi); } static int mx3fb_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; int ret; struct resource *sdc_reg; struct mx3fb_data *mx3fb; dma_cap_mask_t mask; struct dma_chan *chan; struct dma_chan_request rq; /* * Display Interface (DI) and Synchronous Display Controller (SDC) * registers */ sdc_reg = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!sdc_reg) return -EINVAL; mx3fb = devm_kzalloc(&pdev->dev, sizeof(*mx3fb), GFP_KERNEL); if (!mx3fb) return -ENOMEM; spin_lock_init(&mx3fb->lock); mx3fb->reg_base = ioremap(sdc_reg->start, resource_size(sdc_reg)); if (!mx3fb->reg_base) { ret = -ENOMEM; goto eremap; } pr_debug("Remapped %pR at %p\n", sdc_reg, mx3fb->reg_base); /* IDMAC interface */ dmaengine_get(); mx3fb->dev = dev; platform_set_drvdata(pdev, mx3fb); rq.mx3fb = mx3fb; dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); dma_cap_set(DMA_PRIVATE, mask); rq.id = IDMAC_SDC_0; chan = dma_request_channel(mask, chan_filter, &rq); if (!chan) { ret = -EBUSY; goto ersdc0; } mx3fb->backlight_level = 255; ret = init_fb_chan(mx3fb, to_idmac_chan(chan)); if (ret < 0) goto eisdc0; mx3fb_init_backlight(mx3fb); return 0; eisdc0: dma_release_channel(chan); ersdc0: dmaengine_put(); iounmap(mx3fb->reg_base); eremap: dev_err(dev, "mx3fb: failed to register fb\n"); return ret; } static int mx3fb_remove(struct platform_device *dev) { struct mx3fb_data *mx3fb = platform_get_drvdata(dev); struct fb_info *fbi = mx3fb->fbi; struct mx3fb_info *mx3_fbi = fbi->par; struct dma_chan *chan; chan = &mx3_fbi->idmac_channel->dma_chan; release_fbi(fbi); mx3fb_exit_backlight(mx3fb); dma_release_channel(chan); dmaengine_put(); iounmap(mx3fb->reg_base); return 0; } static struct platform_driver mx3fb_driver = { .driver = { .name = MX3FB_NAME, }, .probe = mx3fb_probe, .remove = mx3fb_remove, .suspend = mx3fb_suspend, .resume = mx3fb_resume, }; /* * Parse user specified options (`video=mx3fb:') * example: * video=mx3fb:bpp=16 */ static int __init mx3fb_setup(void) { #ifndef MODULE char *opt, *options = NULL; if (fb_get_options("mx3fb", &options)) return -ENODEV; if (!options || !*options) return 0; while ((opt = strsep(&options, ",")) != NULL) { if (!*opt) continue; if (!strncmp(opt, "bpp=", 4)) default_bpp = simple_strtoul(opt + 4, NULL, 0); else fb_mode = opt; } #endif return 0; } static int __init mx3fb_init(void) { int ret = mx3fb_setup(); if (ret < 0) return ret; ret = platform_driver_register(&mx3fb_driver); return ret; } static void __exit mx3fb_exit(void) { platform_driver_unregister(&mx3fb_driver); } module_init(mx3fb_init); module_exit(mx3fb_exit); MODULE_AUTHOR("Freescale Semiconductor, Inc."); MODULE_DESCRIPTION("MX3 framebuffer driver"); MODULE_ALIAS("platform:" MX3FB_NAME); MODULE_LICENSE("GPL v2");
c0d3z3r0/linux-rockchip
drivers/video/fbdev/mx3fb.c
C
gpl-2.0
44,180
/////////////////////////////////////////////////////////////////////////////// /// \file regex_constants.hpp /// Contains definitions for the syntax_option_type, match_flag_type and /// error_type enumerations. // // Copyright 2008 Eric Niebler. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_XPRESSIVE_REGEX_CONSTANTS_HPP_EAN_10_04_2005 #define BOOST_XPRESSIVE_REGEX_CONSTANTS_HPP_EAN_10_04_2005 // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include <boost/mpl/identity.hpp> #ifndef BOOST_XPRESSIVE_DOXYGEN_INVOKED # define icase icase_ #endif namespace boost { namespace xpressive { namespace regex_constants { /// Flags used to customize the regex syntax /// enum syntax_option_type { // these flags are required: ECMAScript = 0, ///< Specifies that the grammar recognized by the regular expression ///< engine uses its normal semantics: that is the same as that given ///< in the ECMA-262, ECMAScript Language Specification, Chapter 15 ///< part 10, RegExp (Regular Expression) Objects (FWD.1). ///< icase = 1 << 1, ///< Specifies that matching of regular expressions against a character ///< container sequence shall be performed without regard to case. ///< nosubs = 1 << 2, ///< Specifies that when a regular expression is matched against a ///< character container sequence, then no sub-expression matches are to ///< be stored in the supplied match_results structure. ///< optimize = 1 << 3, ///< Specifies that the regular expression engine should pay more ///< attention to the speed with which regular expressions are matched, ///< and less to the speed with which regular expression objects are ///< constructed. Otherwise it has no detectable effect on the program ///< output. ///< collate = 1 << 4, ///< Specifies that character ranges of the form "[a-b]" should be ///< locale sensitive. ///< // These flags are optional. If the functionality is supported // then the flags shall take these names. //basic = 1 << 5, ///< Specifies that the grammar recognized by the regular expression // ///< engine is the same as that used by POSIX basic regular expressions // ///< in IEEE Std 1003.1-2001, Portable Operating System Interface // ///< (POSIX), Base Definitions and Headers, Section 9, Regular // ///< Expressions (FWD.1). // ///< //extended = 1 << 6, ///< Specifies that the grammar recognized by the regular expression // ///< engine is the same as that used by POSIX extended regular // ///< expressions in IEEE Std 1003.1-2001, Portable Operating System // ///< Interface (POSIX), Base Definitions and Headers, Section 9, // ///< Regular Expressions (FWD.1). // ///< //awk = 1 << 7, ///< Specifies that the grammar recognized by the regular expression // ///< engine is the same as that used by POSIX utility awk in IEEE Std // ///< 1003.1-2001, Portable Operating System Interface (POSIX), Shells // ///< and Utilities, Section 4, awk (FWD.1). // ///< //grep = 1 << 8, ///< Specifies that the grammar recognized by the regular expression // ///< engine is the same as that used by POSIX utility grep in IEEE Std // ///< 1003.1-2001, Portable Operating System Interface (POSIX), // ///< Shells and Utilities, Section 4, Utilities, grep (FWD.1). // ///< //egrep = 1 << 9, ///< Specifies that the grammar recognized by the regular expression // ///< engine is the same as that used by POSIX utility grep when given // ///< the -E option in IEEE Std 1003.1-2001, Portable Operating System // ///< Interface (POSIX), Shells and Utilities, Section 4, Utilities, // ///< grep (FWD.1). // ///< // these flags are specific to xpressive, and they help with perl compliance. single_line = 1 << 10, ///< Specifies that the ^ and \$ metacharacters DO NOT match at ///< internal line breaks. Note that this is the opposite of the ///< perl default. It is the inverse of perl's /m (multi-line) ///< modifier. ///< not_dot_null = 1 << 11, ///< Specifies that the . metacharacter does not match the null ///< character \\0. ///< not_dot_newline = 1 << 12, ///< Specifies that the . metacharacter does not match the ///< newline character \\n. ///< ignore_white_space = 1 << 13 ///< Specifies that non-escaped white-space is not significant. ///< }; /// Flags used to customize the behavior of the regex algorithms /// enum match_flag_type { match_default = 0, ///< Specifies that matching of regular expressions proceeds ///< without any modification of the normal rules used in ///< ECMA-262, ECMAScript Language Specification, Chapter 15 ///< part 10, RegExp (Regular Expression) Objects (FWD.1) ///< match_not_bol = 1 << 1, ///< Specifies that the expression "^" should not be matched ///< against the sub-sequence [first,first). ///< match_not_eol = 1 << 2, ///< Specifies that the expression "\$" should not be ///< matched against the sub-sequence [last,last). ///< match_not_bow = 1 << 3, ///< Specifies that the expression "\\b" should not be ///< matched against the sub-sequence [first,first). ///< match_not_eow = 1 << 4, ///< Specifies that the expression "\\b" should not be ///< matched against the sub-sequence [last,last). ///< match_any = 1 << 7, ///< Specifies that if more than one match is possible then ///< any match is an acceptable result. ///< match_not_null = 1 << 8, ///< Specifies that the expression can not be matched ///< against an empty sequence. ///< match_continuous = 1 << 10, ///< Specifies that the expression must match a sub-sequence ///< that begins at first. ///< match_partial = 1 << 11, ///< Specifies that if no match can be found, then it is ///< acceptable to return a match [from, last) where ///< from != last, if there exists some sequence of characters ///< [from,to) of which [from,last) is a prefix, and which ///< would result in a full match. ///< match_prev_avail = 1 << 12, ///< Specifies that --first is a valid iterator position, ///< when this flag is set then the flags match_not_bol ///< and match_not_bow are ignored by the regular expression ///< algorithms (RE.7) and iterators (RE.8). ///< format_default = 0, ///< Specifies that when a regular expression match is to be ///< replaced by a new string, that the new string is ///< constructed using the rules used by the ECMAScript ///< replace function in ECMA-262, ECMAScript Language ///< Specification, Chapter 15 part 5.4.11 ///< String.prototype.replace. (FWD.1). In addition during ///< search and replace operations then all non-overlapping ///< occurrences of the regular expression are located and ///< replaced, and sections of the input that did not match ///< the expression, are copied unchanged to the output ///< string. ///< format_sed = 1 << 13, ///< Specifies that when a regular expression match is to be ///< replaced by a new string, that the new string is ///< constructed using the rules used by the Unix sed ///< utility in IEEE Std 1003.1-2001, Portable Operating ///< SystemInterface (POSIX), Shells and Utilities. ///< format_perl = 1 << 14, ///< Specifies that when a regular expression match is to be ///< replaced by a new string, that the new string is ///< constructed using an implementation defined superset ///< of the rules used by the ECMAScript replace function in ///< ECMA-262, ECMAScript Language Specification, Chapter 15 ///< part 5.4.11 String.prototype.replace (FWD.1). ///< format_no_copy = 1 << 15, ///< When specified during a search and replace operation, ///< then sections of the character container sequence being ///< searched that do match the regular expression, are not ///< copied to the output string. ///< format_first_only = 1 << 16, ///< When specified during a search and replace operation, ///< then only the first occurrence of the regular ///< expression is replaced. ///< format_literal = 1 << 17, ///< Treat the format string as a literal. ///< format_all = 1 << 18 ///< Specifies that all syntax extensions are enabled, ///< including conditional (?ddexpression1:expression2) ///< replacements. ///< }; /// Error codes used by the regex_error type /// enum error_type { error_collate, ///< The expression contained an invalid collating element name. ///< error_ctype, ///< The expression contained an invalid character class name. ///< error_escape, ///< The expression contained an invalid escaped character, ///< or a trailing escape. ///< error_subreg, ///< The expression contained an invalid back-reference. ///< error_brack, ///< The expression contained mismatched [ and ]. ///< error_paren, ///< The expression contained mismatched ( and ). ///< error_brace, ///< The expression contained mismatched { and }. ///< error_badbrace, ///< The expression contained an invalid range in a {} expression. ///< error_range, ///< The expression contained an invalid character range, for ///< example [b-a]. ///< error_space, ///< There was insufficient memory to convert the expression into a ///< finite state machine. ///< error_badrepeat, ///< One of *?+{ was not preceded by a valid regular expression. ///< error_complexity, ///< The complexity of an attempted match against a regular ///< expression exceeded a pre-set level. ///< error_stack, ///< There was insufficient memory to determine whether the regular ///< expression could match the specified character sequence. ///< error_badref, ///< An nested regex is uninitialized. ///< error_badmark, ///< An invalid use of a named capture. ///< error_badlookbehind, ///< An attempt to create a variable-width look-behind assertion ///< was detected. ///< error_badrule, ///< An invalid use of a rule was detected. ///< error_badarg, ///< An argument to an action was unbound. ///< error_badattr, ///< Tried to read from an uninitialized attribute. ///< error_internal ///< An internal error has occurred. ///< }; /// INTERNAL ONLY inline syntax_option_type operator &(syntax_option_type b1, syntax_option_type b2) { return static_cast<syntax_option_type>( static_cast<int>(b1) & static_cast<int>(b2)); } /// INTERNAL ONLY inline syntax_option_type operator |(syntax_option_type b1, syntax_option_type b2) { return static_cast<syntax_option_type>(static_cast<int>(b1) | static_cast<int>(b2)); } /// INTERNAL ONLY inline syntax_option_type operator ^(syntax_option_type b1, syntax_option_type b2) { return static_cast<syntax_option_type>(static_cast<int>(b1) ^ static_cast<int>(b2)); } /// INTERNAL ONLY inline syntax_option_type operator ~(syntax_option_type b) { return static_cast<syntax_option_type>(~static_cast<int>(b)); } /// INTERNAL ONLY inline match_flag_type operator &(match_flag_type b1, match_flag_type b2) { return static_cast<match_flag_type>(static_cast<int>(b1) & static_cast<int>(b2)); } /// INTERNAL ONLY inline match_flag_type operator |(match_flag_type b1, match_flag_type b2) { return static_cast<match_flag_type>(static_cast<int>(b1) | static_cast<int>(b2)); } /// INTERNAL ONLY inline match_flag_type operator ^(match_flag_type b1, match_flag_type b2) { return static_cast<match_flag_type>(static_cast<int>(b1) ^ static_cast<int>(b2)); } /// INTERNAL ONLY inline match_flag_type operator ~(match_flag_type b) { return static_cast<match_flag_type>(~static_cast<int>(b)); } }}} // namespace boost::xpressive::regex_constants #ifndef BOOST_XPRESSIVE_DOXYGEN_INVOKED # undef icase #endif #endif
alexisVallet/animation-character-identification
vendors/boost/include/boost/xpressive/regex_constants.hpp
C++
gpl-3.0
17,124
/* * Copyright Andrey Semashev 2007 - 2015. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) */ /*! * \file form_named_scope.cpp * \author Andrey Semashev * \date 07.02.2009 * * \brief This header contains tests for the \c named_scope formatter. */ #define BOOST_TEST_MODULE form_named_scope #include <string> #include <boost/config.hpp> #include <boost/preprocessor/cat.hpp> #include <boost/test/unit_test.hpp> #include <boost/log/attributes/constant.hpp> #include <boost/log/attributes/attribute_set.hpp> #include <boost/log/attributes/named_scope.hpp> #include <boost/log/expressions.hpp> #include <boost/log/utility/formatting_ostream.hpp> #include <boost/log/utility/string_literal.hpp> #include <boost/log/core/record.hpp> #include "char_definitions.hpp" #include "make_record.hpp" namespace logging = boost::log; namespace attrs = logging::attributes; namespace expr = logging::expressions; namespace keywords = logging::keywords; namespace { template< typename CharT > struct named_scope_test_data; struct named_scope_test_data_base { static logging::string_literal scope1() { return logging::str_literal("scope1"); } static logging::string_literal scope2() { return logging::str_literal("scope2"); } static logging::string_literal file() { return logging::str_literal(__FILE__); } static logging::string_literal posix_file() { return logging::str_literal("/home/user/posix_file.cpp"); } static logging::string_literal windows_file1() { return logging::str_literal("C:\\user\\windows_file1.cpp"); } static logging::string_literal windows_file2() { return logging::str_literal("C:/user/windows_file2.cpp"); } }; #ifdef BOOST_LOG_USE_CHAR template< > struct named_scope_test_data< char > : public test_data< char >, public named_scope_test_data_base { static logging::string_literal default_format() { return logging::str_literal("%n"); } static logging::string_literal full_format() { return logging::str_literal("%n (%f:%l)"); } static logging::string_literal short_filename_format() { return logging::str_literal("%n (%F:%l)"); } static logging::string_literal scope_function_name_format() { return logging::str_literal("%c"); } static logging::string_literal function_name_format() { return logging::str_literal("%C"); } static logging::string_literal delimiter1() { return logging::str_literal("|"); } static logging::string_literal incomplete_marker() { return logging::str_literal("<<and more>>"); } static logging::string_literal empty_marker() { return logging::str_literal("[empty]"); } }; #endif // BOOST_LOG_USE_CHAR #ifdef BOOST_LOG_USE_WCHAR_T template< > struct named_scope_test_data< wchar_t > : public test_data< wchar_t >, public named_scope_test_data_base { static logging::wstring_literal default_format() { return logging::str_literal(L"%n"); } static logging::wstring_literal full_format() { return logging::str_literal(L"%n (%f:%l)"); } static logging::wstring_literal short_filename_format() { return logging::str_literal(L"%n (%F:%l)"); } static logging::wstring_literal scope_function_name_format() { return logging::str_literal(L"%c"); } static logging::wstring_literal function_name_format() { return logging::str_literal(L"%C"); } static logging::wstring_literal delimiter1() { return logging::str_literal(L"|"); } static logging::wstring_literal incomplete_marker() { return logging::str_literal(L"<<and more>>"); } static logging::wstring_literal empty_marker() { return logging::str_literal(L"[empty]"); } }; #endif // BOOST_LOG_USE_WCHAR_T template< typename CharT > inline bool check_formatting(logging::basic_string_literal< CharT > const& format, logging::record_view const& rec, std::basic_string< CharT > const& expected) { typedef logging::basic_formatter< CharT > formatter; typedef std::basic_string< CharT > string; typedef logging::basic_formatting_ostream< CharT > osstream; typedef named_scope_test_data< CharT > data; string str; osstream strm(str); formatter f = expr::stream << expr::format_named_scope(data::attr1(), keywords::format = format.c_str()); f(rec, strm); return equal_strings(strm.str(), expected); } } // namespace // The test checks that named scopes stack formatting works BOOST_AUTO_TEST_CASE_TEMPLATE(scopes_formatting, CharT, char_types) { typedef attrs::named_scope named_scope; typedef named_scope::sentry sentry; typedef logging::attribute_set attr_set; typedef std::basic_string< CharT > string; typedef logging::basic_formatting_ostream< CharT > osstream; typedef logging::basic_formatter< CharT > formatter; typedef logging::record_view record_view; typedef named_scope_test_data< CharT > data; named_scope attr; // First scope const unsigned int line1 = __LINE__; sentry scope1(data::scope1(), data::file(), line1); const unsigned int line2 = __LINE__; sentry scope2(data::scope2(), data::file(), line2); attr_set set1; set1[data::attr1()] = attr; record_view rec = make_record_view(set1); // Default format { string str; osstream strm(str); strm << data::scope1() << "->" << data::scope2(); BOOST_CHECK(check_formatting(data::default_format(), rec, strm.str())); } // Full format { string str; osstream strm(str); strm << data::scope1() << " (" << data::file() << ":" << line1 << ")->" << data::scope2() << " (" << data::file() << ":" << line2 << ")"; BOOST_CHECK(check_formatting(data::full_format(), rec, strm.str())); } // Different delimiter { string str1, str2; osstream strm1(str1), strm2(str2); formatter f = expr::stream << expr::format_named_scope(data::attr1(), keywords::format = data::default_format().c_str(), keywords::delimiter = data::delimiter1().c_str()); f(rec, strm1); strm2 << data::scope1() << "|" << data::scope2(); BOOST_CHECK(equal_strings(strm1.str(), strm2.str())); } // Different direction { string str1, str2; osstream strm1(str1), strm2(str2); formatter f = expr::stream << expr::format_named_scope(data::attr1(), keywords::format = data::default_format().c_str(), keywords::iteration = expr::reverse); f(rec, strm1); strm2 << data::scope2() << "<-" << data::scope1(); BOOST_CHECK(equal_strings(strm1.str(), strm2.str())); } { string str1, str2; osstream strm1(str1), strm2(str2); formatter f = expr::stream << expr::format_named_scope(data::attr1(), keywords::format = data::default_format().c_str(), keywords::delimiter = data::delimiter1().c_str(), keywords::iteration = expr::reverse); f(rec, strm1); strm2 << data::scope2() << "|" << data::scope1(); BOOST_CHECK(equal_strings(strm1.str(), strm2.str())); } // Limiting the number of scopes { string str1, str2; osstream strm1(str1), strm2(str2); formatter f = expr::stream << expr::format_named_scope(data::attr1(), keywords::format = data::default_format().c_str(), keywords::depth = 1); f(rec, strm1); strm2 << "..." << data::scope2(); BOOST_CHECK(equal_strings(strm1.str(), strm2.str())); } { string str1, str2; osstream strm1(str1), strm2(str2); formatter f = expr::stream << expr::format_named_scope(data::attr1(), keywords::format = data::default_format().c_str(), keywords::depth = 1, keywords::iteration = expr::reverse); f(rec, strm1); strm2 << data::scope2() << "..."; BOOST_CHECK(equal_strings(strm1.str(), strm2.str())); } { string str1, str2; osstream strm1(str1), strm2(str2); formatter f = expr::stream << expr::format_named_scope(data::attr1(), keywords::format = data::default_format().c_str(), keywords::delimiter = data::delimiter1().c_str(), keywords::depth = 1); f(rec, strm1); strm2 << "..." << data::scope2(); BOOST_CHECK(equal_strings(strm1.str(), strm2.str())); } { string str1, str2; osstream strm1(str1), strm2(str2); formatter f = expr::stream << expr::format_named_scope(data::attr1(), keywords::format = data::default_format().c_str(), keywords::delimiter = data::delimiter1().c_str(), keywords::depth = 1, keywords::iteration = expr::reverse); f(rec, strm1); strm2 << data::scope2() << "..."; BOOST_CHECK(equal_strings(strm1.str(), strm2.str())); } { string str1, str2; osstream strm1(str1), strm2(str2); formatter f = expr::stream << expr::format_named_scope(data::attr1(), keywords::format = data::default_format().c_str(), keywords::incomplete_marker = data::incomplete_marker().c_str(), keywords::depth = 1); f(rec, strm1); strm2 << "<<and more>>" << data::scope2(); BOOST_CHECK(equal_strings(strm1.str(), strm2.str())); } { string str1, str2; osstream strm1(str1), strm2(str2); formatter f = expr::stream << expr::format_named_scope(data::attr1(), keywords::format = data::default_format().c_str(), keywords::incomplete_marker = data::incomplete_marker().c_str(), keywords::depth = 1, keywords::iteration = expr::reverse); f(rec, strm1); strm2 << data::scope2() << "<<and more>>"; BOOST_CHECK(equal_strings(strm1.str(), strm2.str())); } } // The test checks that empty named scopes stack formatting works BOOST_AUTO_TEST_CASE_TEMPLATE(empty_scopes_formatting, CharT, char_types) { typedef attrs::named_scope named_scope; typedef named_scope::sentry sentry; typedef logging::attribute_set attr_set; typedef std::basic_string< CharT > string; typedef logging::basic_formatting_ostream< CharT > osstream; typedef logging::basic_formatter< CharT > formatter; typedef logging::record_view record_view; typedef named_scope_test_data< CharT > data; named_scope attr; attr_set set1; set1[data::attr1()] = attr; record_view rec = make_record_view(set1); formatter f = expr::stream << expr::format_named_scope(data::attr1(), keywords::format = data::default_format().c_str(), keywords::empty_marker = data::empty_marker().c_str()); { string str1, str2; osstream strm1(str1), strm2(str2); f(rec, strm1); strm2 << "[empty]"; BOOST_CHECK(equal_strings(strm1.str(), strm2.str())); } const unsigned int line1 = __LINE__; sentry scope1(data::scope1(), data::file(), line1); const unsigned int line2 = __LINE__; sentry scope2(data::scope2(), data::file(), line2); { string str1, str2; osstream strm1(str1), strm2(str2); f(rec, strm1); strm2 << data::scope1() << "->" << data::scope2(); BOOST_CHECK(equal_strings(strm1.str(), strm2.str())); } } BOOST_AUTO_TEST_CASE_TEMPLATE(scopes_filename_formatting_posix, CharT, char_types) { typedef attrs::named_scope named_scope; typedef named_scope::sentry sentry; typedef logging::attribute_set attr_set; typedef std::basic_string< CharT > string; typedef logging::basic_formatting_ostream< CharT > osstream; typedef logging::record_view record_view; typedef named_scope_test_data< CharT > data; named_scope attr; // First scope const unsigned int line1 = __LINE__; sentry scope1(data::scope1(), data::posix_file(), line1); attr_set set1; set1[data::attr1()] = attr; record_view rec = make_record_view(set1); // File names without the full path { string str; osstream strm(str); strm << data::scope1() << " (posix_file.cpp:" << line1 << ")"; BOOST_CHECK(check_formatting(data::short_filename_format(), rec, strm.str())); } } #if defined(BOOST_WINDOWS) BOOST_AUTO_TEST_CASE_TEMPLATE(scopes_filename_formatting_windows, CharT, char_types) { typedef attrs::named_scope named_scope; typedef named_scope::sentry sentry; typedef logging::attribute_set attr_set; typedef std::basic_string< CharT > string; typedef logging::basic_formatting_ostream< CharT > osstream; typedef logging::record_view record_view; typedef named_scope_test_data< CharT > data; named_scope attr; // First scope const unsigned int line1 = __LINE__; sentry scope1(data::scope1(), data::windows_file1(), line1); const unsigned int line2 = __LINE__; sentry scope2(data::scope2(), data::windows_file2(), line2); attr_set set1; set1[data::attr1()] = attr; record_view rec = make_record_view(set1); // File names without the full path { string str; osstream strm(str); strm << data::scope1() << " (windows_file1.cpp:" << line1 << ")->" << data::scope2() << " (windows_file2.cpp:" << line2 << ")"; BOOST_CHECK(check_formatting(data::short_filename_format(), rec, strm.str())); } } #endif // defined(BOOST_WINDOWS) namespace { struct named_scope_test_case { logging::string_literal scope_name; const char* function_name; const char* function_name_no_scope; }; const named_scope_test_case named_scope_test_cases[] = { // Generic signatures { logging::str_literal("int main(int, char *[])"), "main", "main" }, { logging::str_literal("namespace_name::type foo()"), "foo", "foo" }, { logging::str_literal("namespace_name::type& foo::bar(int[], std::string const&)"), "foo::bar", "bar" }, { logging::str_literal("void* namespc::foo<char>::bar()"), "namespc::foo<char>::bar", "bar" }, { logging::str_literal("void* namespc::foo<char>::bar<int>(int) const"), "namespc::foo<char>::bar<int>", "bar<int>" }, // MSVC-specific { logging::str_literal("int __cdecl main(int, char *[])"), "main", "main" }, { logging::str_literal("struct namespc::strooct __cdecl foo3(int [])"), "foo3", "foo3" }, { logging::str_literal("void (__cdecl *__cdecl foo4(void))(void)"), "foo4", "foo4" }, // function returning pointer to function { logging::str_literal("void (__cdecl *__cdecl foo5(void (__cdecl *)(void)))(void)"), "foo5", "foo5" }, { logging::str_literal("void (__cdecl *__cdecl namespc::my_class<int>::member1(void (__cdecl *)(void)))(void)"), "namespc::my_class<int>::member1", "member1" }, { logging::str_literal("void (__cdecl *__cdecl namespc::my_class<int>::member2<int>(int))(void)"), "namespc::my_class<int>::member2<int>", "member2<int>" }, { logging::str_literal("void (__cdecl *__cdecl namespc::my_class<int>::member2<void(__cdecl *)(void)>(void (__cdecl *)(void)))(void)"), "namespc::my_class<int>::member2<void(__cdecl *)(void)>", "member2<void(__cdecl *)(void)>" }, { logging::str_literal("void (__cdecl *__cdecl namespc::my_class<int>::member3<void __cdecl foo1(void)>(void))(void)"), "namespc::my_class<int>::member3<void __cdecl foo1(void)>", "member3<void __cdecl foo1(void)>" }, { logging::str_literal("void (__cdecl *__cdecl namespc::my_class<void (__cdecl*)(void)>::member1(void (__cdecl *)(void)))(void)"), "namespc::my_class<void (__cdecl*)(void)>::member1", "member1" }, { logging::str_literal("void (__cdecl *__cdecl namespc::my_class<void (__cdecl*)(void)>::member2<int>(int))(void)"), "namespc::my_class<void (__cdecl*)(void)>::member2<int>", "member2<int>" }, { logging::str_literal("void (__cdecl *__cdecl namespc::my_class<void (__cdecl*)(void)>::member2<void(__cdecl *)(void)>(void (__cdecl *)(void)))(void)"), "namespc::my_class<void (__cdecl*)(void)>::member2<void(__cdecl *)(void)>", "member2<void(__cdecl *)(void)>" }, { logging::str_literal("void (__cdecl *__cdecl namespc::my_class<void (__cdecl*)(void)>::member3<void __cdecl foo1(void)>(void))(void)"), "namespc::my_class<void (__cdecl*)(void)>::member3<void __cdecl foo1(void)>", "member3<void __cdecl foo1(void)>" }, { logging::str_literal("void (__cdecl namespc::my_class2::* __cdecl namespc::foo6(void (__cdecl *)(void)))(void)"), "namespc::foo6", "foo6" }, { logging::str_literal("struct namespc::my_class<void __cdecl(int)> __cdecl namespc::foo7(void)"), "namespc::foo7", "foo7" }, { logging::str_literal("void (__cdecl namespc::my_class2::* const (&__cdecl namespc::foo8(void (__cdecl *)(void)))[2])(void)"), "namespc::foo8", "foo8" }, { logging::str_literal("__cdecl namespc::my_class2::my_class2(void)"), "namespc::my_class2::my_class2", "my_class2" }, { logging::str_literal("__cdecl namespc::my_class2::~my_class2(void)"), "namespc::my_class2::~my_class2", "~my_class2" }, { logging::str_literal("void __cdecl namespc::my_class2::operator =(const struct namespc::my_class2 &)"), "namespc::my_class2::operator =", "operator =" }, { logging::str_literal("void __cdecl namespc::my_class2::operator *(void) const"), "namespc::my_class2::operator *", "operator *" }, { logging::str_literal("void __cdecl namespc::my_class2::operator ()(void)"), "namespc::my_class2::operator ()", "operator ()" }, { logging::str_literal("bool __cdecl namespc::my_class2::operator <(int) const"), "namespc::my_class2::operator <", "operator <" }, { logging::str_literal("bool __cdecl namespc::my_class2::operator >(int) const"), "namespc::my_class2::operator >", "operator >" }, { logging::str_literal("bool __cdecl namespc::my_class2::operator <=(int) const"), "namespc::my_class2::operator <=", "operator <=" }, { logging::str_literal("bool __cdecl namespc::my_class2::operator >=(int) const"), "namespc::my_class2::operator >=", "operator >=" }, { logging::str_literal("__cdecl namespc::my_class2::operator bool(void) const"), "namespc::my_class2::operator bool", "operator bool" }, // MSVC generates incorrect strings in case of conversion operators to function types. We don't support these. // { logging::str_literal("__cdecl namespc::my_class2::operator char (__cdecl *)(double)(__cdecl *(void) const)(double)"), "namespc::my_class2::operator char (__cdecl *)(double)", "operator char (__cdecl *)(double)" }, // { logging::str_literal("__cdecl namespc::my_class2::operator char (__cdecl namespc::my_class2::* )(double)(__cdecl namespc::my_class2::* (void) const)(double)"), "namespc::my_class2::operator char (__cdecl namespc::my_class2::* )(double)", "operator char (__cdecl namespc::my_class2::* )(double)" }, { logging::str_literal("class std::basic_ostream<char,struct std::char_traits<char> > &__cdecl namespc::operator <<<char,struct std::char_traits<char>>(class std::basic_ostream<char,struct std::char_traits<char> > &,const struct namespc::my_class2 &)"), "namespc::operator <<<char,struct std::char_traits<char>>", "operator <<<char,struct std::char_traits<char>>" }, { logging::str_literal("class std::basic_istream<char,struct std::char_traits<char> > &__cdecl namespc::operator >><char,struct std::char_traits<char>>(class std::basic_istream<char,struct std::char_traits<char> > &,struct namespc::my_class2 &)"), "namespc::operator >><char,struct std::char_traits<char>>", "operator >><char,struct std::char_traits<char>>" }, // GCC-specific { logging::str_literal("namespc::strooct foo3(int*)"), "foo3", "foo3" }, { logging::str_literal("void (* foo4())()"), "foo4", "foo4" }, // function returning pointer to function { logging::str_literal("void (* foo5(pfun2_t))()"), "foo5", "foo5" }, { logging::str_literal("static void (* namespc::my_class<T>::member1(pfun2_t))() [with T = int; pfun1_t = void (*)(); pfun2_t = void (*)()]"), "namespc::my_class<T>::member1", "member1" }, { logging::str_literal("static void (* namespc::my_class<T>::member2(U))() [with U = int; T = int; pfun2_t = void (*)()]"), "namespc::my_class<T>::member2", "member2" }, { logging::str_literal("static void (* namespc::my_class<T>::member2(U))() [with U = void (*)(); T = int; pfun2_t = void (*)()]"), "namespc::my_class<T>::member2", "member2" }, { logging::str_literal("static void (* namespc::my_class<T>::member3())() [with void (* Fun)() = foo1; T = int; pfun2_t = void (*)()]"), "namespc::my_class<T>::member3", "member3" }, { logging::str_literal("static void (* namespc::my_class<T>::member1(pfun2_t))() [with T = void (*)(); pfun1_t = void (*)(); pfun2_t = void (*)()]"), "namespc::my_class<T>::member1", "member1" }, { logging::str_literal("static void (* namespc::my_class<T>::member2(U))() [with U = int; T = void (*)(); pfun2_t = void (*)()]"), "namespc::my_class<T>::member2", "member2" }, { logging::str_literal("static void (* namespc::my_class<T>::member2(U))() [with U = void (*)(); T = void (*)(); pfun2_t = void (*)()]"), "namespc::my_class<T>::member2", "member2" }, { logging::str_literal("static void (* namespc::my_class<T>::member3())() [with void (* Fun)() = foo1; T = void (*)(); pfun2_t = void (*)()]"), "namespc::my_class<T>::member3", "member3" }, { logging::str_literal("void (namespc::my_class2::* namespc::foo6(pfun2_t))()"), "namespc::foo6", "foo6" }, { logging::str_literal("namespc::my_class<void(int)> namespc::foo7()"), "namespc::foo7", "foo7" }, { logging::str_literal("void (namespc::my_class2::* const (& namespc::foo8(pfun2_t))[2])()"), "namespc::foo8", "foo8" }, { logging::str_literal("namespc::my_class2::my_class2()"), "namespc::my_class2::my_class2", "my_class2" }, // constructor { logging::str_literal("namespc::my_class2::~my_class2()"), "namespc::my_class2::~my_class2", "~my_class2" }, // destructor { logging::str_literal("void namespc::my_class2::operator=(const namespc::my_class2&)"), "namespc::my_class2::operator=", "operator=" }, { logging::str_literal("void namespc::my_class2::operator*() const"), "namespc::my_class2::operator*", "operator*" }, { logging::str_literal("void namespc::my_class2::operator()()"), "namespc::my_class2::operator()", "operator()" }, { logging::str_literal("bool namespc::my_class2::operator<(int) const"), "namespc::my_class2::operator<", "operator<" }, { logging::str_literal("bool namespc::my_class2::operator>(int) const"), "namespc::my_class2::operator>", "operator>" }, { logging::str_literal("bool namespc::my_class2::operator<=(int) const"), "namespc::my_class2::operator<=", "operator<=" }, { logging::str_literal("bool namespc::my_class2::operator>=(int) const"), "namespc::my_class2::operator>=", "operator>=" }, { logging::str_literal("namespc::my_class2::operator bool() const"), "namespc::my_class2::operator bool", "operator bool" }, { logging::str_literal("namespc::my_class2::operator pfun1_t() const"), "namespc::my_class2::operator pfun1_t", "operator pfun1_t" }, { logging::str_literal("std::basic_ostream<_CharT, _Traits>& namespc::operator<<(std::basic_ostream<_CharT, _Traits>&, const namespc::my_class2&) [with CharT = char; TraitsT = std::char_traits<char>]"), "namespc::operator<<", "operator<<" }, { logging::str_literal("std::basic_istream<_CharT, _Traits>& namespc::operator>>(std::basic_istream<_CharT, _Traits>&, namespc::my_class2&) [with CharT = char; TraitsT = std::char_traits<char>]"), "namespc::operator>>", "operator>>" }, // BOOST_CURRENT_FUNCTION fallback value { logging::str_literal("(unknown)"), "(unknown)", "(unknown)" } }; } // namespace // Function name formatting BOOST_AUTO_TEST_CASE_TEMPLATE(scopes_scope_function_name_formatting, CharT, char_types) { typedef attrs::named_scope named_scope; typedef named_scope::sentry sentry; typedef logging::attribute_set attr_set; typedef std::basic_string< CharT > string; typedef logging::basic_formatting_ostream< CharT > osstream; typedef logging::record_view record_view; typedef named_scope_test_data< CharT > data; named_scope attr; // First scope const unsigned int line1 = __LINE__; attr_set set1; set1[data::attr1()] = attr; record_view rec = make_record_view(set1); for (unsigned int i = 0; i < sizeof(named_scope_test_cases) / sizeof(*named_scope_test_cases); ++i) { sentry scope1(named_scope_test_cases[i].scope_name, data::file(), line1, attrs::named_scope_entry::function); string str; osstream strm(str); strm << named_scope_test_cases[i].function_name; BOOST_CHECK_MESSAGE(check_formatting(data::scope_function_name_format(), rec, strm.str()), "Scope name: " << named_scope_test_cases[i].scope_name); } } // Function name without scope formatting BOOST_AUTO_TEST_CASE_TEMPLATE(scopes_function_name_formatting, CharT, char_types) { typedef attrs::named_scope named_scope; typedef named_scope::sentry sentry; typedef logging::attribute_set attr_set; typedef std::basic_string< CharT > string; typedef logging::basic_formatting_ostream< CharT > osstream; typedef logging::record_view record_view; typedef named_scope_test_data< CharT > data; named_scope attr; // First scope const unsigned int line1 = __LINE__; attr_set set1; set1[data::attr1()] = attr; record_view rec = make_record_view(set1); for (unsigned int i = 0; i < sizeof(named_scope_test_cases) / sizeof(*named_scope_test_cases); ++i) { sentry scope1(named_scope_test_cases[i].scope_name, data::file(), line1, attrs::named_scope_entry::function); string str; osstream strm(str); strm << named_scope_test_cases[i].function_name_no_scope; BOOST_CHECK_MESSAGE(check_formatting(data::function_name_format(), rec, strm.str()), "Scope name: " << named_scope_test_cases[i].scope_name); } } // The test checks that function name formatters do not affect scopes denoted with BOOST_LOG_NAMED_SCOPE BOOST_AUTO_TEST_CASE_TEMPLATE(function_name_does_not_affect_non_function_scopes, CharT, char_types) { typedef attrs::named_scope named_scope; typedef logging::attribute_set attr_set; typedef std::basic_string< CharT > string; typedef logging::basic_formatting_ostream< CharT > osstream; typedef logging::record_view record_view; typedef named_scope_test_data< CharT > data; named_scope attr; attr_set set1; set1[data::attr1()] = attr; record_view rec = make_record_view(set1); { BOOST_LOG_NAMED_SCOPE("void foo()"); string str; osstream strm(str); strm << "void foo()"; BOOST_CHECK(check_formatting(data::scope_function_name_format(), rec, strm.str())); BOOST_CHECK(check_formatting(data::function_name_format(), rec, strm.str())); } }
gwq5210/litlib
thirdparty/sources/boost_1_60_0/libs/log/test/run/form_named_scope.cpp
C++
gpl-3.0
27,159
/* === WhiteUpArrow16 ==*/ .mblDomButtonWhiteUpArrow16 { background-image: url(compat/mblDomButtonWhiteUpArrow16.png); background-repeat: no-repeat; } .mblDomButtonWhiteUpArrow16 > div { display: none; }
avz-cmf/zaboy-middleware
www/js/dojox/mobile/themes/common/domButtons/DomButtonWhiteUpArrow16-compat.css
CSS
gpl-3.0
207
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Tests\Form\ChoiceList; use PHPUnit\Framework\TestCase; use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper; use Symfony\Bridge\Doctrine\Tests\Fixtures\GroupableEntity; use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity; use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity; use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList; use Symfony\Component\Form\Extension\Core\View\ChoiceView; use Doctrine\ORM\Tools\SchemaTool; /** * @group legacy */ class GenericEntityChoiceListTest extends TestCase { const SINGLE_INT_ID_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity'; const SINGLE_STRING_ID_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity'; const COMPOSITE_ID_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity'; const GROUPABLE_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\GroupableEntity'; /** * @var \Doctrine\ORM\EntityManager */ private $em; protected function setUp() { $this->em = DoctrineTestHelper::createTestEntityManager(); $schemaTool = new SchemaTool($this->em); $classes = array( $this->em->getClassMetadata(self::SINGLE_INT_ID_CLASS), $this->em->getClassMetadata(self::SINGLE_STRING_ID_CLASS), $this->em->getClassMetadata(self::COMPOSITE_ID_CLASS), $this->em->getClassMetadata(self::GROUPABLE_CLASS), ); try { $schemaTool->dropSchema($classes); } catch (\Exception $e) { } try { $schemaTool->createSchema($classes); } catch (\Exception $e) { } parent::setUp(); } protected function tearDown() { parent::tearDown(); $this->em = null; } /** * @expectedException \Symfony\Component\Form\Exception\StringCastException * @expectedMessage Entity "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity" passed to the choice field must have a "__toString()" method defined (or you can also override the "property" option). */ public function testEntitiesMustHaveAToStringMethod() { $entity1 = new SingleIntIdNoToStringEntity(1, 'Foo'); $entity2 = new SingleIntIdNoToStringEntity(2, 'Bar'); // Persist for managed state $this->em->persist($entity1); $this->em->persist($entity2); $choiceList = new EntityChoiceList( $this->em, self::SINGLE_INT_ID_CLASS, null, null, array( $entity1, $entity2, ) ); $choiceList->getValues(); } /** * @expectedException \Symfony\Component\Form\Exception\RuntimeException */ public function testChoicesMustBeManaged() { $entity1 = new SingleIntIdEntity(1, 'Foo'); $entity2 = new SingleIntIdEntity(2, 'Bar'); // no persist here! $choiceList = new EntityChoiceList( $this->em, self::SINGLE_INT_ID_CLASS, 'name', null, array( $entity1, $entity2, ) ); // triggers loading -> exception $choiceList->getChoices(); } public function testInitExplicitChoices() { $entity1 = new SingleIntIdEntity(1, 'Foo'); $entity2 = new SingleIntIdEntity(2, 'Bar'); // Persist for managed state $this->em->persist($entity1); $this->em->persist($entity2); $choiceList = new EntityChoiceList( $this->em, self::SINGLE_INT_ID_CLASS, 'name', null, array( $entity1, $entity2, ) ); $this->assertSame(array(1 => $entity1, 2 => $entity2), $choiceList->getChoices()); } public function testInitEmptyChoices() { $entity1 = new SingleIntIdEntity(1, 'Foo'); $entity2 = new SingleIntIdEntity(2, 'Bar'); // Persist for managed state $this->em->persist($entity1); $this->em->persist($entity2); $choiceList = new EntityChoiceList( $this->em, self::SINGLE_INT_ID_CLASS, 'name', null, array() ); $this->assertSame(array(), $choiceList->getChoices()); } public function testInitNestedChoices() { $entity1 = new SingleIntIdEntity(1, 'Foo'); $entity2 = new SingleIntIdEntity(2, 'Bar'); // Oh yeah, we're persisting with fire now! $this->em->persist($entity1); $this->em->persist($entity2); $choiceList = new EntityChoiceList( $this->em, self::SINGLE_INT_ID_CLASS, 'name', null, array( 'group1' => array($entity1), 'group2' => array($entity2), ), array() ); $this->assertSame(array(1 => $entity1, 2 => $entity2), $choiceList->getChoices()); $this->assertEquals(array( 'group1' => array(1 => new ChoiceView($entity1, '1', 'Foo')), 'group2' => array(2 => new ChoiceView($entity2, '2', 'Bar')), ), $choiceList->getRemainingViews()); } public function testGroupByPropertyPath() { $item1 = new GroupableEntity(1, 'Foo', 'Group1'); $item2 = new GroupableEntity(2, 'Bar', 'Group1'); $item3 = new GroupableEntity(3, 'Baz', 'Group2'); $item4 = new GroupableEntity(4, 'Boo!', null); $this->em->persist($item1); $this->em->persist($item2); $this->em->persist($item3); $this->em->persist($item4); $choiceList = new EntityChoiceList( $this->em, self::GROUPABLE_CLASS, 'name', null, array( $item1, $item2, $item3, $item4, ), array(), 'groupName' ); $this->assertEquals(array(1 => $item1, 2 => $item2, 3 => $item3, 4 => $item4), $choiceList->getChoices()); $this->assertEquals(array( 'Group1' => array(1 => new ChoiceView($item1, '1', 'Foo'), 2 => new ChoiceView($item2, '2', 'Bar')), 'Group2' => array(3 => new ChoiceView($item3, '3', 'Baz')), 4 => new ChoiceView($item4, '4', 'Boo!'), ), $choiceList->getRemainingViews()); } public function testGroupByInvalidPropertyPathReturnsFlatChoices() { $item1 = new GroupableEntity(1, 'Foo', 'Group1'); $item2 = new GroupableEntity(2, 'Bar', 'Group1'); $this->em->persist($item1); $this->em->persist($item2); $choiceList = new EntityChoiceList( $this->em, self::GROUPABLE_CLASS, 'name', null, array( $item1, $item2, ), array(), 'child.that.does.not.exist' ); $this->assertEquals(array( 1 => $item1, 2 => $item2, ), $choiceList->getChoices()); } public function testInitShorthandEntityName() { $item1 = new SingleIntIdEntity(1, 'Foo'); $item2 = new SingleIntIdEntity(2, 'Bar'); $this->em->persist($item1); $this->em->persist($item2); $choiceList = new EntityChoiceList( $this->em, 'SymfonyTestsDoctrine:SingleIntIdEntity' ); $this->assertEquals(array(1, 2), $choiceList->getValuesForChoices(array($item1, $item2))); } public function testInitShorthandEntityName2() { $item1 = new SingleIntIdEntity(1, 'Foo'); $item2 = new SingleIntIdEntity(2, 'Bar'); $this->em->persist($item1); $this->em->persist($item2); $choiceList = new EntityChoiceList( $this->em, 'SymfonyTestsDoctrine:SingleIntIdEntity' ); $this->assertEquals(array(1, 2), $choiceList->getIndicesForChoices(array($item1, $item2))); } }
McCubo/vroi
vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/GenericEntityChoiceListTest.php
PHP
gpl-3.0
8,425
/*! lightgallery - v1.3.9 - 2017-02-05 * http://sachinchoolur.github.io/lightGallery/ * Copyright (c) 2017 Sachin N; Licensed GPLv3 */ .lg-css3.lg-zoom-in .lg-item { opacity: 0; } .lg-css3.lg-zoom-in .lg-item.lg-prev-slide { -webkit-transform: scale3d(1.3, 1.3, 1.3); transform: scale3d(1.3, 1.3, 1.3); } .lg-css3.lg-zoom-in .lg-item.lg-next-slide { -webkit-transform: scale3d(1.3, 1.3, 1.3); transform: scale3d(1.3, 1.3, 1.3); } .lg-css3.lg-zoom-in .lg-item.lg-current { -webkit-transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1); opacity: 1; } .lg-css3.lg-zoom-in .lg-item.lg-prev-slide, .lg-css3.lg-zoom-in .lg-item.lg-next-slide, .lg-css3.lg-zoom-in .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; } .lg-css3.lg-zoom-in-big .lg-item { opacity: 0; } .lg-css3.lg-zoom-in-big .lg-item.lg-prev-slide { -webkit-transform: scale3d(2, 2, 2); transform: scale3d(2, 2, 2); } .lg-css3.lg-zoom-in-big .lg-item.lg-next-slide { -webkit-transform: scale3d(2, 2, 2); transform: scale3d(2, 2, 2); } .lg-css3.lg-zoom-in-big .lg-item.lg-current { -webkit-transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1); opacity: 1; } .lg-css3.lg-zoom-in-big .lg-item.lg-prev-slide, .lg-css3.lg-zoom-in-big .lg-item.lg-next-slide, .lg-css3.lg-zoom-in-big .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; } .lg-css3.lg-zoom-out .lg-item { opacity: 0; } .lg-css3.lg-zoom-out .lg-item.lg-prev-slide { -webkit-transform: scale3d(0.7, 0.7, 0.7); transform: scale3d(0.7, 0.7, 0.7); } .lg-css3.lg-zoom-out .lg-item.lg-next-slide { -webkit-transform: scale3d(0.7, 0.7, 0.7); transform: scale3d(0.7, 0.7, 0.7); } .lg-css3.lg-zoom-out .lg-item.lg-current { -webkit-transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1); opacity: 1; } .lg-css3.lg-zoom-out .lg-item.lg-prev-slide, .lg-css3.lg-zoom-out .lg-item.lg-next-slide, .lg-css3.lg-zoom-out .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; } .lg-css3.lg-zoom-out-big .lg-item { opacity: 0; } .lg-css3.lg-zoom-out-big .lg-item.lg-prev-slide { -webkit-transform: scale3d(0, 0, 0); transform: scale3d(0, 0, 0); } .lg-css3.lg-zoom-out-big .lg-item.lg-next-slide { -webkit-transform: scale3d(0, 0, 0); transform: scale3d(0, 0, 0); } .lg-css3.lg-zoom-out-big .lg-item.lg-current { -webkit-transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1); opacity: 1; } .lg-css3.lg-zoom-out-big .lg-item.lg-prev-slide, .lg-css3.lg-zoom-out-big .lg-item.lg-next-slide, .lg-css3.lg-zoom-out-big .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; } .lg-css3.lg-zoom-out-in .lg-item { opacity: 0; } .lg-css3.lg-zoom-out-in .lg-item.lg-prev-slide { -webkit-transform: scale3d(0, 0, 0); transform: scale3d(0, 0, 0); } .lg-css3.lg-zoom-out-in .lg-item.lg-next-slide { -webkit-transform: scale3d(2, 2, 2); transform: scale3d(2, 2, 2); } .lg-css3.lg-zoom-out-in .lg-item.lg-current { -webkit-transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1); opacity: 1; } .lg-css3.lg-zoom-out-in .lg-item.lg-prev-slide, .lg-css3.lg-zoom-out-in .lg-item.lg-next-slide, .lg-css3.lg-zoom-out-in .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; } .lg-css3.lg-zoom-in-out .lg-item { opacity: 0; } .lg-css3.lg-zoom-in-out .lg-item.lg-prev-slide { -webkit-transform: scale3d(2, 2, 2); transform: scale3d(2, 2, 2); } .lg-css3.lg-zoom-in-out .lg-item.lg-next-slide { -webkit-transform: scale3d(0, 0, 0); transform: scale3d(0, 0, 0); } .lg-css3.lg-zoom-in-out .lg-item.lg-current { -webkit-transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1); opacity: 1; } .lg-css3.lg-zoom-in-out .lg-item.lg-prev-slide, .lg-css3.lg-zoom-in-out .lg-item.lg-next-slide, .lg-css3.lg-zoom-in-out .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; } .lg-css3.lg-soft-zoom .lg-item { opacity: 0; } .lg-css3.lg-soft-zoom .lg-item.lg-prev-slide { -webkit-transform: scale3d(1.1, 1.1, 1.1); transform: scale3d(1.1, 1.1, 1.1); } .lg-css3.lg-soft-zoom .lg-item.lg-next-slide { -webkit-transform: scale3d(0.9, 0.9, 0.9); transform: scale3d(0.9, 0.9, 0.9); } .lg-css3.lg-soft-zoom .lg-item.lg-current { -webkit-transform: scale3d(1, 1, 1); transform: scale3d(1, 1, 1); opacity: 1; } .lg-css3.lg-soft-zoom .lg-item.lg-prev-slide, .lg-css3.lg-soft-zoom .lg-item.lg-next-slide, .lg-css3.lg-soft-zoom .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; } .lg-css3.lg-scale-up .lg-item { opacity: 0; } .lg-css3.lg-scale-up .lg-item.lg-prev-slide { -moz-transform: scale3d(0.8, 0.8, 0.8) translate3d(0%, 10%, 0); -o-transform: scale3d(0.8, 0.8, 0.8) translate3d(0%, 10%, 0); -ms-transform: scale3d(0.8, 0.8, 0.8) translate3d(0%, 10%, 0); -webkit-transform: scale3d(0.8, 0.8, 0.8) translate3d(0%, 10%, 0); transform: scale3d(0.8, 0.8, 0.8) translate3d(0%, 10%, 0); } .lg-css3.lg-scale-up .lg-item.lg-next-slide { -moz-transform: scale3d(0.8, 0.8, 0.8) translate3d(0%, 10%, 0); -o-transform: scale3d(0.8, 0.8, 0.8) translate3d(0%, 10%, 0); -ms-transform: scale3d(0.8, 0.8, 0.8) translate3d(0%, 10%, 0); -webkit-transform: scale3d(0.8, 0.8, 0.8) translate3d(0%, 10%, 0); transform: scale3d(0.8, 0.8, 0.8) translate3d(0%, 10%, 0); } .lg-css3.lg-scale-up .lg-item.lg-current { -moz-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -o-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -ms-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -webkit-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); transform: scale3d(1, 1, 1) translate3d(0, 0, 0); opacity: 1; } .lg-css3.lg-scale-up .lg-item.lg-prev-slide, .lg-css3.lg-scale-up .lg-item.lg-next-slide, .lg-css3.lg-scale-up .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; } .lg-css3.lg-slide-circular .lg-item { opacity: 0; } .lg-css3.lg-slide-circular .lg-item.lg-prev-slide { -moz-transform: scale3d(0, 0, 0) translate3d(-100%, 0, 0); -o-transform: scale3d(0, 0, 0) translate3d(-100%, 0, 0); -ms-transform: scale3d(0, 0, 0) translate3d(-100%, 0, 0); -webkit-transform: scale3d(0, 0, 0) translate3d(-100%, 0, 0); transform: scale3d(0, 0, 0) translate3d(-100%, 0, 0); } .lg-css3.lg-slide-circular .lg-item.lg-next-slide { -moz-transform: scale3d(0, 0, 0) translate3d(100%, 0, 0); -o-transform: scale3d(0, 0, 0) translate3d(100%, 0, 0); -ms-transform: scale3d(0, 0, 0) translate3d(100%, 0, 0); -webkit-transform: scale3d(0, 0, 0) translate3d(100%, 0, 0); transform: scale3d(0, 0, 0) translate3d(100%, 0, 0); } .lg-css3.lg-slide-circular .lg-item.lg-current { -moz-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -o-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -ms-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -webkit-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); transform: scale3d(1, 1, 1) translate3d(0, 0, 0); opacity: 1; } .lg-css3.lg-slide-circular .lg-item.lg-prev-slide, .lg-css3.lg-slide-circular .lg-item.lg-next-slide, .lg-css3.lg-slide-circular .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; } .lg-css3.lg-slide-circular-up .lg-item { opacity: 0; } .lg-css3.lg-slide-circular-up .lg-item.lg-prev-slide { -moz-transform: scale3d(0, 0, 0) translate3d(-100%, -100%, 0); -o-transform: scale3d(0, 0, 0) translate3d(-100%, -100%, 0); -ms-transform: scale3d(0, 0, 0) translate3d(-100%, -100%, 0); -webkit-transform: scale3d(0, 0, 0) translate3d(-100%, -100%, 0); transform: scale3d(0, 0, 0) translate3d(-100%, -100%, 0); } .lg-css3.lg-slide-circular-up .lg-item.lg-next-slide { -moz-transform: scale3d(0, 0, 0) translate3d(100%, -100%, 0); -o-transform: scale3d(0, 0, 0) translate3d(100%, -100%, 0); -ms-transform: scale3d(0, 0, 0) translate3d(100%, -100%, 0); -webkit-transform: scale3d(0, 0, 0) translate3d(100%, -100%, 0); transform: scale3d(0, 0, 0) translate3d(100%, -100%, 0); } .lg-css3.lg-slide-circular-up .lg-item.lg-current { -moz-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -o-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -ms-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -webkit-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); transform: scale3d(1, 1, 1) translate3d(0, 0, 0); opacity: 1; } .lg-css3.lg-slide-circular-up .lg-item.lg-prev-slide, .lg-css3.lg-slide-circular-up .lg-item.lg-next-slide, .lg-css3.lg-slide-circular-up .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; } .lg-css3.lg-slide-circular-down .lg-item { opacity: 0; } .lg-css3.lg-slide-circular-down .lg-item.lg-prev-slide { -moz-transform: scale3d(0, 0, 0) translate3d(-100%, 100%, 0); -o-transform: scale3d(0, 0, 0) translate3d(-100%, 100%, 0); -ms-transform: scale3d(0, 0, 0) translate3d(-100%, 100%, 0); -webkit-transform: scale3d(0, 0, 0) translate3d(-100%, 100%, 0); transform: scale3d(0, 0, 0) translate3d(-100%, 100%, 0); } .lg-css3.lg-slide-circular-down .lg-item.lg-next-slide { -moz-transform: scale3d(0, 0, 0) translate3d(100%, 100%, 0); -o-transform: scale3d(0, 0, 0) translate3d(100%, 100%, 0); -ms-transform: scale3d(0, 0, 0) translate3d(100%, 100%, 0); -webkit-transform: scale3d(0, 0, 0) translate3d(100%, 100%, 0); transform: scale3d(0, 0, 0) translate3d(100%, 100%, 0); } .lg-css3.lg-slide-circular-down .lg-item.lg-current { -moz-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -o-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -ms-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -webkit-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); transform: scale3d(1, 1, 1) translate3d(0, 0, 0); opacity: 1; } .lg-css3.lg-slide-circular-down .lg-item.lg-prev-slide, .lg-css3.lg-slide-circular-down .lg-item.lg-next-slide, .lg-css3.lg-slide-circular-down .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; } .lg-css3.lg-slide-circular-vertical .lg-item { opacity: 0; } .lg-css3.lg-slide-circular-vertical .lg-item.lg-prev-slide { -moz-transform: scale3d(0, 0, 0) translate3d(0, -100%, 0); -o-transform: scale3d(0, 0, 0) translate3d(0, -100%, 0); -ms-transform: scale3d(0, 0, 0) translate3d(0, -100%, 0); -webkit-transform: scale3d(0, 0, 0) translate3d(0, -100%, 0); transform: scale3d(0, 0, 0) translate3d(0, -100%, 0); } .lg-css3.lg-slide-circular-vertical .lg-item.lg-next-slide { -moz-transform: scale3d(0, 0, 0) translate3d(0, 100%, 0); -o-transform: scale3d(0, 0, 0) translate3d(0, 100%, 0); -ms-transform: scale3d(0, 0, 0) translate3d(0, 100%, 0); -webkit-transform: scale3d(0, 0, 0) translate3d(0, 100%, 0); transform: scale3d(0, 0, 0) translate3d(0, 100%, 0); } .lg-css3.lg-slide-circular-vertical .lg-item.lg-current { -moz-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -o-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -ms-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -webkit-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); transform: scale3d(1, 1, 1) translate3d(0, 0, 0); opacity: 1; } .lg-css3.lg-slide-circular-vertical .lg-item.lg-prev-slide, .lg-css3.lg-slide-circular-vertical .lg-item.lg-next-slide, .lg-css3.lg-slide-circular-vertical .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; } .lg-css3.lg-slide-circular-vertical-left .lg-item { opacity: 0; } .lg-css3.lg-slide-circular-vertical-left .lg-item.lg-prev-slide { -moz-transform: scale3d(0, 0, 0) translate3d(-100%, -100%, 0); -o-transform: scale3d(0, 0, 0) translate3d(-100%, -100%, 0); -ms-transform: scale3d(0, 0, 0) translate3d(-100%, -100%, 0); -webkit-transform: scale3d(0, 0, 0) translate3d(-100%, -100%, 0); transform: scale3d(0, 0, 0) translate3d(-100%, -100%, 0); } .lg-css3.lg-slide-circular-vertical-left .lg-item.lg-next-slide { -moz-transform: scale3d(0, 0, 0) translate3d(-100%, 100%, 0); -o-transform: scale3d(0, 0, 0) translate3d(-100%, 100%, 0); -ms-transform: scale3d(0, 0, 0) translate3d(-100%, 100%, 0); -webkit-transform: scale3d(0, 0, 0) translate3d(-100%, 100%, 0); transform: scale3d(0, 0, 0) translate3d(-100%, 100%, 0); } .lg-css3.lg-slide-circular-vertical-left .lg-item.lg-current { -moz-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -o-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -ms-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -webkit-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); transform: scale3d(1, 1, 1) translate3d(0, 0, 0); opacity: 1; } .lg-css3.lg-slide-circular-vertical-left .lg-item.lg-prev-slide, .lg-css3.lg-slide-circular-vertical-left .lg-item.lg-next-slide, .lg-css3.lg-slide-circular-vertical-left .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; } .lg-css3.lg-slide-circular-vertical-down .lg-item { opacity: 0; } .lg-css3.lg-slide-circular-vertical-down .lg-item.lg-prev-slide { -moz-transform: scale3d(0, 0, 0) translate3d(100%, -100%, 0); -o-transform: scale3d(0, 0, 0) translate3d(100%, -100%, 0); -ms-transform: scale3d(0, 0, 0) translate3d(100%, -100%, 0); -webkit-transform: scale3d(0, 0, 0) translate3d(100%, -100%, 0); transform: scale3d(0, 0, 0) translate3d(100%, -100%, 0); } .lg-css3.lg-slide-circular-vertical-down .lg-item.lg-next-slide { -moz-transform: scale3d(0, 0, 0) translate3d(100%, 100%, 0); -o-transform: scale3d(0, 0, 0) translate3d(100%, 100%, 0); -ms-transform: scale3d(0, 0, 0) translate3d(100%, 100%, 0); -webkit-transform: scale3d(0, 0, 0) translate3d(100%, 100%, 0); transform: scale3d(0, 0, 0) translate3d(100%, 100%, 0); } .lg-css3.lg-slide-circular-vertical-down .lg-item.lg-current { -moz-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -o-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -ms-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -webkit-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); transform: scale3d(1, 1, 1) translate3d(0, 0, 0); opacity: 1; } .lg-css3.lg-slide-circular-vertical-down .lg-item.lg-prev-slide, .lg-css3.lg-slide-circular-vertical-down .lg-item.lg-next-slide, .lg-css3.lg-slide-circular-vertical-down .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 1s ease 0s; } .lg-css3.lg-slide-vertical .lg-item { opacity: 0; } .lg-css3.lg-slide-vertical .lg-item.lg-prev-slide { -webkit-transform: translate3d(0, -100%, 0); transform: translate3d(0, -100%, 0); } .lg-css3.lg-slide-vertical .lg-item.lg-next-slide { -webkit-transform: translate3d(0, 100%, 0); transform: translate3d(0, 100%, 0); } .lg-css3.lg-slide-vertical .lg-item.lg-current { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); opacity: 1; } .lg-css3.lg-slide-vertical .lg-item.lg-prev-slide, .lg-css3.lg-slide-vertical .lg-item.lg-next-slide, .lg-css3.lg-slide-vertical .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-slide-vertical-growth .lg-item { opacity: 0; } .lg-css3.lg-slide-vertical-growth .lg-item.lg-prev-slide { -moz-transform: scale3d(0.5, 0.5, 0.5) translate3d(0, -150%, 0); -o-transform: scale3d(0.5, 0.5, 0.5) translate3d(0, -150%, 0); -ms-transform: scale3d(0.5, 0.5, 0.5) translate3d(0, -150%, 0); -webkit-transform: scale3d(0.5, 0.5, 0.5) translate3d(0, -150%, 0); transform: scale3d(0.5, 0.5, 0.5) translate3d(0, -150%, 0); } .lg-css3.lg-slide-vertical-growth .lg-item.lg-next-slide { -moz-transform: scale3d(0.5, 0.5, 0.5) translate3d(0, 150%, 0); -o-transform: scale3d(0.5, 0.5, 0.5) translate3d(0, 150%, 0); -ms-transform: scale3d(0.5, 0.5, 0.5) translate3d(0, 150%, 0); -webkit-transform: scale3d(0.5, 0.5, 0.5) translate3d(0, 150%, 0); transform: scale3d(0.5, 0.5, 0.5) translate3d(0, 150%, 0); } .lg-css3.lg-slide-vertical-growth .lg-item.lg-current { -moz-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -o-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -ms-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -webkit-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); transform: scale3d(1, 1, 1) translate3d(0, 0, 0); opacity: 1; } .lg-css3.lg-slide-vertical-growth .lg-item.lg-prev-slide, .lg-css3.lg-slide-vertical-growth .lg-item.lg-next-slide, .lg-css3.lg-slide-vertical-growth .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-slide-skew-only .lg-item { opacity: 0; } .lg-css3.lg-slide-skew-only .lg-item.lg-prev-slide { -moz-transform: skew(10deg, 0deg); -o-transform: skew(10deg, 0deg); -ms-transform: skew(10deg, 0deg); -webkit-transform: skew(10deg, 0deg); transform: skew(10deg, 0deg); } .lg-css3.lg-slide-skew-only .lg-item.lg-next-slide { -moz-transform: skew(10deg, 0deg); -o-transform: skew(10deg, 0deg); -ms-transform: skew(10deg, 0deg); -webkit-transform: skew(10deg, 0deg); transform: skew(10deg, 0deg); } .lg-css3.lg-slide-skew-only .lg-item.lg-current { -moz-transform: skew(0deg, 0deg); -o-transform: skew(0deg, 0deg); -ms-transform: skew(0deg, 0deg); -webkit-transform: skew(0deg, 0deg); transform: skew(0deg, 0deg); opacity: 1; } .lg-css3.lg-slide-skew-only .lg-item.lg-prev-slide, .lg-css3.lg-slide-skew-only .lg-item.lg-next-slide, .lg-css3.lg-slide-skew-only .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-slide-skew-only-rev .lg-item { opacity: 0; } .lg-css3.lg-slide-skew-only-rev .lg-item.lg-prev-slide { -moz-transform: skew(-10deg, 0deg); -o-transform: skew(-10deg, 0deg); -ms-transform: skew(-10deg, 0deg); -webkit-transform: skew(-10deg, 0deg); transform: skew(-10deg, 0deg); } .lg-css3.lg-slide-skew-only-rev .lg-item.lg-next-slide { -moz-transform: skew(-10deg, 0deg); -o-transform: skew(-10deg, 0deg); -ms-transform: skew(-10deg, 0deg); -webkit-transform: skew(-10deg, 0deg); transform: skew(-10deg, 0deg); } .lg-css3.lg-slide-skew-only-rev .lg-item.lg-current { -moz-transform: skew(0deg, 0deg); -o-transform: skew(0deg, 0deg); -ms-transform: skew(0deg, 0deg); -webkit-transform: skew(0deg, 0deg); transform: skew(0deg, 0deg); opacity: 1; } .lg-css3.lg-slide-skew-only-rev .lg-item.lg-prev-slide, .lg-css3.lg-slide-skew-only-rev .lg-item.lg-next-slide, .lg-css3.lg-slide-skew-only-rev .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-slide-skew-only-y .lg-item { opacity: 0; } .lg-css3.lg-slide-skew-only-y .lg-item.lg-prev-slide { -moz-transform: skew(0deg, 10deg); -o-transform: skew(0deg, 10deg); -ms-transform: skew(0deg, 10deg); -webkit-transform: skew(0deg, 10deg); transform: skew(0deg, 10deg); } .lg-css3.lg-slide-skew-only-y .lg-item.lg-next-slide { -moz-transform: skew(0deg, 10deg); -o-transform: skew(0deg, 10deg); -ms-transform: skew(0deg, 10deg); -webkit-transform: skew(0deg, 10deg); transform: skew(0deg, 10deg); } .lg-css3.lg-slide-skew-only-y .lg-item.lg-current { -moz-transform: skew(0deg, 0deg); -o-transform: skew(0deg, 0deg); -ms-transform: skew(0deg, 0deg); -webkit-transform: skew(0deg, 0deg); transform: skew(0deg, 0deg); opacity: 1; } .lg-css3.lg-slide-skew-only-y .lg-item.lg-prev-slide, .lg-css3.lg-slide-skew-only-y .lg-item.lg-next-slide, .lg-css3.lg-slide-skew-only-y .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-slide-skew-only-y-rev .lg-item { opacity: 0; } .lg-css3.lg-slide-skew-only-y-rev .lg-item.lg-prev-slide { -moz-transform: skew(0deg, -10deg); -o-transform: skew(0deg, -10deg); -ms-transform: skew(0deg, -10deg); -webkit-transform: skew(0deg, -10deg); transform: skew(0deg, -10deg); } .lg-css3.lg-slide-skew-only-y-rev .lg-item.lg-next-slide { -moz-transform: skew(0deg, -10deg); -o-transform: skew(0deg, -10deg); -ms-transform: skew(0deg, -10deg); -webkit-transform: skew(0deg, -10deg); transform: skew(0deg, -10deg); } .lg-css3.lg-slide-skew-only-y-rev .lg-item.lg-current { -moz-transform: skew(0deg, 0deg); -o-transform: skew(0deg, 0deg); -ms-transform: skew(0deg, 0deg); -webkit-transform: skew(0deg, 0deg); transform: skew(0deg, 0deg); opacity: 1; } .lg-css3.lg-slide-skew-only-y-rev .lg-item.lg-prev-slide, .lg-css3.lg-slide-skew-only-y-rev .lg-item.lg-next-slide, .lg-css3.lg-slide-skew-only-y-rev .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-slide-skew .lg-item { opacity: 0; } .lg-css3.lg-slide-skew .lg-item.lg-prev-slide { -moz-transform: skew(20deg, 0deg) translate3d(-100%, 0%, 0px); -o-transform: skew(20deg, 0deg) translate3d(-100%, 0%, 0px); -ms-transform: skew(20deg, 0deg) translate3d(-100%, 0%, 0px); -webkit-transform: skew(20deg, 0deg) translate3d(-100%, 0%, 0px); transform: skew(20deg, 0deg) translate3d(-100%, 0%, 0px); } .lg-css3.lg-slide-skew .lg-item.lg-next-slide { -moz-transform: skew(20deg, 0deg) translate3d(100%, 0%, 0px); -o-transform: skew(20deg, 0deg) translate3d(100%, 0%, 0px); -ms-transform: skew(20deg, 0deg) translate3d(100%, 0%, 0px); -webkit-transform: skew(20deg, 0deg) translate3d(100%, 0%, 0px); transform: skew(20deg, 0deg) translate3d(100%, 0%, 0px); } .lg-css3.lg-slide-skew .lg-item.lg-current { -moz-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -o-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -ms-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -webkit-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); opacity: 1; } .lg-css3.lg-slide-skew .lg-item.lg-prev-slide, .lg-css3.lg-slide-skew .lg-item.lg-next-slide, .lg-css3.lg-slide-skew .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-slide-skew-rev .lg-item { opacity: 0; } .lg-css3.lg-slide-skew-rev .lg-item.lg-prev-slide { -moz-transform: skew(-20deg, 0deg) translate3d(-100%, 0%, 0px); -o-transform: skew(-20deg, 0deg) translate3d(-100%, 0%, 0px); -ms-transform: skew(-20deg, 0deg) translate3d(-100%, 0%, 0px); -webkit-transform: skew(-20deg, 0deg) translate3d(-100%, 0%, 0px); transform: skew(-20deg, 0deg) translate3d(-100%, 0%, 0px); } .lg-css3.lg-slide-skew-rev .lg-item.lg-next-slide { -moz-transform: skew(-20deg, 0deg) translate3d(100%, 0%, 0px); -o-transform: skew(-20deg, 0deg) translate3d(100%, 0%, 0px); -ms-transform: skew(-20deg, 0deg) translate3d(100%, 0%, 0px); -webkit-transform: skew(-20deg, 0deg) translate3d(100%, 0%, 0px); transform: skew(-20deg, 0deg) translate3d(100%, 0%, 0px); } .lg-css3.lg-slide-skew-rev .lg-item.lg-current { -moz-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -o-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -ms-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -webkit-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); opacity: 1; } .lg-css3.lg-slide-skew-rev .lg-item.lg-prev-slide, .lg-css3.lg-slide-skew-rev .lg-item.lg-next-slide, .lg-css3.lg-slide-skew-rev .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-slide-skew-cross .lg-item { opacity: 0; } .lg-css3.lg-slide-skew-cross .lg-item.lg-prev-slide { -moz-transform: skew(0deg, 60deg) translate3d(-100%, 0%, 0px); -o-transform: skew(0deg, 60deg) translate3d(-100%, 0%, 0px); -ms-transform: skew(0deg, 60deg) translate3d(-100%, 0%, 0px); -webkit-transform: skew(0deg, 60deg) translate3d(-100%, 0%, 0px); transform: skew(0deg, 60deg) translate3d(-100%, 0%, 0px); } .lg-css3.lg-slide-skew-cross .lg-item.lg-next-slide { -moz-transform: skew(0deg, 60deg) translate3d(100%, 0%, 0px); -o-transform: skew(0deg, 60deg) translate3d(100%, 0%, 0px); -ms-transform: skew(0deg, 60deg) translate3d(100%, 0%, 0px); -webkit-transform: skew(0deg, 60deg) translate3d(100%, 0%, 0px); transform: skew(0deg, 60deg) translate3d(100%, 0%, 0px); } .lg-css3.lg-slide-skew-cross .lg-item.lg-current { -moz-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -o-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -ms-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -webkit-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); opacity: 1; } .lg-css3.lg-slide-skew-cross .lg-item.lg-prev-slide, .lg-css3.lg-slide-skew-cross .lg-item.lg-next-slide, .lg-css3.lg-slide-skew-cross .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-slide-skew-cross-rev .lg-item { opacity: 0; } .lg-css3.lg-slide-skew-cross-rev .lg-item.lg-prev-slide { -moz-transform: skew(0deg, -60deg) translate3d(-100%, 0%, 0px); -o-transform: skew(0deg, -60deg) translate3d(-100%, 0%, 0px); -ms-transform: skew(0deg, -60deg) translate3d(-100%, 0%, 0px); -webkit-transform: skew(0deg, -60deg) translate3d(-100%, 0%, 0px); transform: skew(0deg, -60deg) translate3d(-100%, 0%, 0px); } .lg-css3.lg-slide-skew-cross-rev .lg-item.lg-next-slide { -moz-transform: skew(0deg, -60deg) translate3d(100%, 0%, 0px); -o-transform: skew(0deg, -60deg) translate3d(100%, 0%, 0px); -ms-transform: skew(0deg, -60deg) translate3d(100%, 0%, 0px); -webkit-transform: skew(0deg, -60deg) translate3d(100%, 0%, 0px); transform: skew(0deg, -60deg) translate3d(100%, 0%, 0px); } .lg-css3.lg-slide-skew-cross-rev .lg-item.lg-current { -moz-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -o-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -ms-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -webkit-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); opacity: 1; } .lg-css3.lg-slide-skew-cross-rev .lg-item.lg-prev-slide, .lg-css3.lg-slide-skew-cross-rev .lg-item.lg-next-slide, .lg-css3.lg-slide-skew-cross-rev .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-slide-skew-ver .lg-item { opacity: 0; } .lg-css3.lg-slide-skew-ver .lg-item.lg-prev-slide { -moz-transform: skew(60deg, 0deg) translate3d(0, -100%, 0px); -o-transform: skew(60deg, 0deg) translate3d(0, -100%, 0px); -ms-transform: skew(60deg, 0deg) translate3d(0, -100%, 0px); -webkit-transform: skew(60deg, 0deg) translate3d(0, -100%, 0px); transform: skew(60deg, 0deg) translate3d(0, -100%, 0px); } .lg-css3.lg-slide-skew-ver .lg-item.lg-next-slide { -moz-transform: skew(60deg, 0deg) translate3d(0, 100%, 0px); -o-transform: skew(60deg, 0deg) translate3d(0, 100%, 0px); -ms-transform: skew(60deg, 0deg) translate3d(0, 100%, 0px); -webkit-transform: skew(60deg, 0deg) translate3d(0, 100%, 0px); transform: skew(60deg, 0deg) translate3d(0, 100%, 0px); } .lg-css3.lg-slide-skew-ver .lg-item.lg-current { -moz-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -o-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -ms-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -webkit-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); opacity: 1; } .lg-css3.lg-slide-skew-ver .lg-item.lg-prev-slide, .lg-css3.lg-slide-skew-ver .lg-item.lg-next-slide, .lg-css3.lg-slide-skew-ver .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-slide-skew-ver-rev .lg-item { opacity: 0; } .lg-css3.lg-slide-skew-ver-rev .lg-item.lg-prev-slide { -moz-transform: skew(-60deg, 0deg) translate3d(0, -100%, 0px); -o-transform: skew(-60deg, 0deg) translate3d(0, -100%, 0px); -ms-transform: skew(-60deg, 0deg) translate3d(0, -100%, 0px); -webkit-transform: skew(-60deg, 0deg) translate3d(0, -100%, 0px); transform: skew(-60deg, 0deg) translate3d(0, -100%, 0px); } .lg-css3.lg-slide-skew-ver-rev .lg-item.lg-next-slide { -moz-transform: skew(-60deg, 0deg) translate3d(0, 100%, 0px); -o-transform: skew(-60deg, 0deg) translate3d(0, 100%, 0px); -ms-transform: skew(-60deg, 0deg) translate3d(0, 100%, 0px); -webkit-transform: skew(-60deg, 0deg) translate3d(0, 100%, 0px); transform: skew(-60deg, 0deg) translate3d(0, 100%, 0px); } .lg-css3.lg-slide-skew-ver-rev .lg-item.lg-current { -moz-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -o-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -ms-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -webkit-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); opacity: 1; } .lg-css3.lg-slide-skew-ver-rev .lg-item.lg-prev-slide, .lg-css3.lg-slide-skew-ver-rev .lg-item.lg-next-slide, .lg-css3.lg-slide-skew-ver-rev .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-slide-skew-ver-cross .lg-item { opacity: 0; } .lg-css3.lg-slide-skew-ver-cross .lg-item.lg-prev-slide { -moz-transform: skew(0deg, 20deg) translate3d(0, -100%, 0px); -o-transform: skew(0deg, 20deg) translate3d(0, -100%, 0px); -ms-transform: skew(0deg, 20deg) translate3d(0, -100%, 0px); -webkit-transform: skew(0deg, 20deg) translate3d(0, -100%, 0px); transform: skew(0deg, 20deg) translate3d(0, -100%, 0px); } .lg-css3.lg-slide-skew-ver-cross .lg-item.lg-next-slide { -moz-transform: skew(0deg, 20deg) translate3d(0, 100%, 0px); -o-transform: skew(0deg, 20deg) translate3d(0, 100%, 0px); -ms-transform: skew(0deg, 20deg) translate3d(0, 100%, 0px); -webkit-transform: skew(0deg, 20deg) translate3d(0, 100%, 0px); transform: skew(0deg, 20deg) translate3d(0, 100%, 0px); } .lg-css3.lg-slide-skew-ver-cross .lg-item.lg-current { -moz-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -o-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -ms-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -webkit-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); opacity: 1; } .lg-css3.lg-slide-skew-ver-cross .lg-item.lg-prev-slide, .lg-css3.lg-slide-skew-ver-cross .lg-item.lg-next-slide, .lg-css3.lg-slide-skew-ver-cross .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-slide-skew-ver-cross-rev .lg-item { opacity: 0; } .lg-css3.lg-slide-skew-ver-cross-rev .lg-item.lg-prev-slide { -moz-transform: skew(0deg, -20deg) translate3d(0, -100%, 0px); -o-transform: skew(0deg, -20deg) translate3d(0, -100%, 0px); -ms-transform: skew(0deg, -20deg) translate3d(0, -100%, 0px); -webkit-transform: skew(0deg, -20deg) translate3d(0, -100%, 0px); transform: skew(0deg, -20deg) translate3d(0, -100%, 0px); } .lg-css3.lg-slide-skew-ver-cross-rev .lg-item.lg-next-slide { -moz-transform: skew(0deg, -20deg) translate3d(0, 100%, 0px); -o-transform: skew(0deg, -20deg) translate3d(0, 100%, 0px); -ms-transform: skew(0deg, -20deg) translate3d(0, 100%, 0px); -webkit-transform: skew(0deg, -20deg) translate3d(0, 100%, 0px); transform: skew(0deg, -20deg) translate3d(0, 100%, 0px); } .lg-css3.lg-slide-skew-ver-cross-rev .lg-item.lg-current { -moz-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -o-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -ms-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); -webkit-transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); transform: skew(0deg, 0deg) translate3d(0%, 0%, 0px); opacity: 1; } .lg-css3.lg-slide-skew-ver-cross-rev .lg-item.lg-prev-slide, .lg-css3.lg-slide-skew-ver-cross-rev .lg-item.lg-next-slide, .lg-css3.lg-slide-skew-ver-cross-rev .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-lollipop .lg-item { opacity: 0; } .lg-css3.lg-lollipop .lg-item.lg-prev-slide { -webkit-transform: translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0); } .lg-css3.lg-lollipop .lg-item.lg-next-slide { -moz-transform: translate3d(0, 0, 0) scale(0.5); -o-transform: translate3d(0, 0, 0) scale(0.5); -ms-transform: translate3d(0, 0, 0) scale(0.5); -webkit-transform: translate3d(0, 0, 0) scale(0.5); transform: translate3d(0, 0, 0) scale(0.5); } .lg-css3.lg-lollipop .lg-item.lg-current { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); opacity: 1; } .lg-css3.lg-lollipop .lg-item.lg-prev-slide, .lg-css3.lg-lollipop .lg-item.lg-next-slide, .lg-css3.lg-lollipop .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-lollipop-rev .lg-item { opacity: 0; } .lg-css3.lg-lollipop-rev .lg-item.lg-prev-slide { -moz-transform: translate3d(0, 0, 0) scale(0.5); -o-transform: translate3d(0, 0, 0) scale(0.5); -ms-transform: translate3d(0, 0, 0) scale(0.5); -webkit-transform: translate3d(0, 0, 0) scale(0.5); transform: translate3d(0, 0, 0) scale(0.5); } .lg-css3.lg-lollipop-rev .lg-item.lg-next-slide { -webkit-transform: translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0); } .lg-css3.lg-lollipop-rev .lg-item.lg-current { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); opacity: 1; } .lg-css3.lg-lollipop-rev .lg-item.lg-prev-slide, .lg-css3.lg-lollipop-rev .lg-item.lg-next-slide, .lg-css3.lg-lollipop-rev .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-rotate .lg-item { opacity: 0; } .lg-css3.lg-rotate .lg-item.lg-prev-slide { -moz-transform: rotate(-360deg); -o-transform: rotate(-360deg); -ms-transform: rotate(-360deg); -webkit-transform: rotate(-360deg); transform: rotate(-360deg); } .lg-css3.lg-rotate .lg-item.lg-next-slide { -moz-transform: rotate(360deg); -o-transform: rotate(360deg); -ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg); } .lg-css3.lg-rotate .lg-item.lg-current { -moz-transform: rotate(0deg); -o-transform: rotate(0deg); -ms-transform: rotate(0deg); -webkit-transform: rotate(0deg); transform: rotate(0deg); opacity: 1; } .lg-css3.lg-rotate .lg-item.lg-prev-slide, .lg-css3.lg-rotate .lg-item.lg-next-slide, .lg-css3.lg-rotate .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-rotate-rev .lg-item { opacity: 0; } .lg-css3.lg-rotate-rev .lg-item.lg-prev-slide { -moz-transform: rotate(360deg); -o-transform: rotate(360deg); -ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg); } .lg-css3.lg-rotate-rev .lg-item.lg-next-slide { -moz-transform: rotate(-360deg); -o-transform: rotate(-360deg); -ms-transform: rotate(-360deg); -webkit-transform: rotate(-360deg); transform: rotate(-360deg); } .lg-css3.lg-rotate-rev .lg-item.lg-current { -moz-transform: rotate(0deg); -o-transform: rotate(0deg); -ms-transform: rotate(0deg); -webkit-transform: rotate(0deg); transform: rotate(0deg); opacity: 1; } .lg-css3.lg-rotate-rev .lg-item.lg-prev-slide, .lg-css3.lg-rotate-rev .lg-item.lg-next-slide, .lg-css3.lg-rotate-rev .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } .lg-css3.lg-tube .lg-item { opacity: 0; } .lg-css3.lg-tube .lg-item.lg-prev-slide { -moz-transform: scale3d(1, 0, 1) translate3d(-100%, 0, 0); -o-transform: scale3d(1, 0, 1) translate3d(-100%, 0, 0); -ms-transform: scale3d(1, 0, 1) translate3d(-100%, 0, 0); -webkit-transform: scale3d(1, 0, 1) translate3d(-100%, 0, 0); transform: scale3d(1, 0, 1) translate3d(-100%, 0, 0); } .lg-css3.lg-tube .lg-item.lg-next-slide { -moz-transform: scale3d(1, 0, 1) translate3d(100%, 0, 0); -o-transform: scale3d(1, 0, 1) translate3d(100%, 0, 0); -ms-transform: scale3d(1, 0, 1) translate3d(100%, 0, 0); -webkit-transform: scale3d(1, 0, 1) translate3d(100%, 0, 0); transform: scale3d(1, 0, 1) translate3d(100%, 0, 0); } .lg-css3.lg-tube .lg-item.lg-current { -moz-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -o-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -ms-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); -webkit-transform: scale3d(1, 1, 1) translate3d(0, 0, 0); transform: scale3d(1, 1, 1) translate3d(0, 0, 0); opacity: 1; } .lg-css3.lg-tube .lg-item.lg-prev-slide, .lg-css3.lg-tube .lg-item.lg-next-slide, .lg-css3.lg-tube .lg-item.lg-current { -webkit-transition: -webkit-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -moz-transition: -moz-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; -o-transition: -o-transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; transition: transform 1s cubic-bezier(0, 0, 0.25, 1) 0s, opacity 0.1s ease 0s; } /*# sourceMappingURL=lg-transitions.css.map */
avpreserve/avcc
web/lightgallery/css/lg-transitions.css
CSS
agpl-3.0
47,330
<?xml version="1.0"?> <!-- generated on : {$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'} {if $_lang_ != "" }lang : {$_lang_}{/if} {if $_context_ != "" }context : {$_context_}{/if} --> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>{url path="/"}</loc> {* You can also set priority and changefreq <priority>0.8</priority> <changefreq>weekly</changefreq> *} </url> {if $_context_ == "" || $_context_ == "catalog" } <!-- categories --> {loop type="lang" name="category_lang"} {if $_lang_ == "" || $_lang_ == $CODE } {loop type="category" name="category" lang="$ID"} <url> <loc>{$URL}</loc> <lastmod>{format_date date=$UPDATE_DATE format="c"}</lastmod> </url> {/loop} {/if} {/loop} <!-- products --> {loop type="lang" name="product_lang"} {if $_lang_ == "" || $_lang_ == $CODE } {loop type="product" name="product" lang="$ID"} <url> <loc>{$URL}</loc> <lastmod>{format_date date=$UPDATE_DATE format="c"}</lastmod> </url> {/loop} {/if} {/loop} {/if} {if $_context_ == "" || $_context_ == "content" } <!-- folders --> {loop type="lang" name="folder_lang"} {if $_lang_ == "" || $_lang_ == $CODE } {loop type="folder" name="folder" lang="$ID"} <url> <loc>{$URL}</loc> <lastmod>{format_date date=$UPDATE_DATE format="c"}</lastmod> </url> {/loop} {/if} {/loop} <!-- contents --> {loop type="lang" name="content_lang"} {if $_lang_ == "" || $_lang_ == $CODE } {loop type="content" name="content" lang="$ID"} <url> <loc>{$URL}</loc> <lastmod>{format_date date=$UPDATE_DATE format="c"}</lastmod> </url> {/loop} {/if} {/loop} {/if} {hook name="sitemap.bottom" lang="$_lang_" context="$_context_"} </urlset>
lopes-vincent/thelia
templates/frontOffice/modern/sitemap.html
HTML
lgpl-3.0
2,141
<!-- Good morning, Mr. Phelps. --> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>or-tools/src/algorithms/: Member List - Doxy</title> <link rel="shortcut icon" href="../../../favicon.ico"> <!-- Both stylesheets are supplied by Doxygen, with maybe minor tweaks from Google. --> <link href="../../../doxygen.css" rel="stylesheet" type="text/css"> <link href="../../../tabs.css" rel="stylesheet" type="text/css"> </head> <body topmargin=0 leftmargin=20 bottommargin=0 rightmargin=20 marginwidth=20 marginheight=0> <!-- Second part of the secret behind Doxy logo always having the word "Doxy" with the color of the day. --> <style> a.doxy_logo:hover { background-color: #287003 } </style> <table width=100% cellpadding=0 cellspacing=0 border=0> <!-- Top horizontal line with the color of the day. --> <tr valign=top> <td colspan=3 bgcolor=#287003 height=3></td> </tr> <!-- Header row with the links at the right. --> <tr valign=top> <td colspan=3 align=right> <font size=-1> Generated on: <font color=#287003><b>Thu Mar 29 07:46:58 PDT 2012</b></font> for <b>custom file set</b> </font> </td> </tr> <!-- Header row with the logo and the search form. --> <tr valign=top> <!-- Logo. --> <td align=left width=150> <table width=150 height=54 cellpadding=0 cellspacing=0 border=0> <tr valign=top> <!-- First part of the secret behind Doxy logo always having the word "Doxy" with the color of the day. --> <td bgcolor=#287003> <a class="doxy_logo" href="../../../index.html"><img src="../../../doxy_logo.png" alt="Doxy" border=0></a> </td> </tr> </table> </td> </tr> <!-- Tiny vertical space below the form. --> <tr valign=top> <td colspan=3 height=3></td> </tr> </table> <!-- Header navigation row. --> <div class="memproto"> <table width=100% cellpadding=0 cellspacing=0 border=0> <tr> <td align=left style="padding-left: 20px"><font size=+1><b><tt><font color=#333333>// <a href="../../../index.html"><font color=#287003>doxy</font></a>/</font> <a href="../../../or-tools/index.html">or-tools</a>/ <a href="../../../or-tools/src/index.html">src</a>/ <a href="../../../or-tools/src/algorithms/index.html">algorithms</a>/ </tt></b></font> </td> </tr> </table> </div> <br /> <!-- No subdirs found. --> <!-- End of header. --> <!-- Generated by Doxygen 1.5.6 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main&nbsp;Page</span></a></li> <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li> <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li> </ul> </div> </div> <div class="contents"> <h1>operations_research::KnapsackPropagator Member List</h1>This is the complete list of members for <a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a>, including all inherited members.<p><table> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#8133fbb05961e760ed907e1f599966d8">ComputeProfitBounds</a>()=0</td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td><code> [pure virtual]</code></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#8567625fe3844f064a469485c965e663">CopyCurrentStateToSolution</a>(bool has_one_propagator, std::vector&lt; bool &gt; *solution) const </td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#95551ecb408465b2fcf57aaaac393336">CopyCurrentStateToSolutionPropagator</a>(std::vector&lt; bool &gt; *solution) const =0</td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td><code> [protected, pure virtual]</code></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#e3c81bb19d396fb12ff7262585f69306">current_profit</a>() const </td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td><code> [inline]</code></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#44b8bedd2218a210512ab3f8f3172312">GetNextItemId</a>() const =0</td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td><code> [pure virtual]</code></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#eb74436e19f4e74afdeb17f623bb0335">Init</a>(const std::vector&lt; int64 &gt; &amp;profits, const std::vector&lt; int64 &gt; &amp;weights)</td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#eb99e95f19c68257f0b450cfff8fc3d0">InitPropagator</a>()=0</td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td><code> [protected, pure virtual]</code></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#9c932f4f586ab1b7b35dc2b86ff2ac02">items</a>() const </td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td><code> [inline, protected]</code></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#8d55d0c6ac3f05b72100f1635cfd2250">KnapsackPropagator</a>(const KnapsackState &amp;state)</td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td><code> [explicit]</code></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#75629119df27253b732fb1bd6f208112">profit_lower_bound</a>() const </td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td><code> [inline]</code></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#c43c5fca86e7bfbe630f403b26250b84">profit_upper_bound</a>() const </td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td><code> [inline]</code></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#697a86fbe4ab12732c8e6972ebdd5947">set_profit_lower_bound</a>(int64 profit)</td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td><code> [inline, protected]</code></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#7bbc1ccc57318641a01cd253299f5861">set_profit_upper_bound</a>(int64 profit)</td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td><code> [inline, protected]</code></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#f99f78cdf7d5a7fd2f39ecb686053bb3">state</a>() const </td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td><code> [inline, protected]</code></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#5843f83c839a81d039724b6d49ba325a">Update</a>(bool revert, const KnapsackAssignment &amp;assignment)</td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#baf6d9225cde1b0d83d1a54299705ccb">UpdatePropagator</a>(bool revert, const KnapsackAssignment &amp;assignment)=0</td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td><code> [protected, pure virtual]</code></td></tr> <tr class="memlist"><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html#8fce110c9e0d27acfa950f295105db98">~KnapsackPropagator</a>()</td><td><a class="el" href="classoperations__research_1_1KnapsackPropagator.html">operations_research::KnapsackPropagator</a></td><td><code> [virtual]</code></td></tr> </table></div> <!-- Start of footer. --> <table width=100% cellpadding=0 cellspacing=0 border=0> <tr valign=top> <td colspan=2 height=10></td> </tr> <tr valign=top> <td colspan=2 bgcolor=#287003 height=3></td> </tr> </table> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /><br /> </body> </html>
AlperSaltabas/OR_Tools_Google_API
documentation/reference_manual/or-tools/src/algorithms/classoperations__research_1_1KnapsackPropagator-members.html
HTML
apache-2.0
10,798
/* * Copyright (c) 2009-2012 jMonkeyEngine * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of 'jMonkeyEngine' nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.jme3.shader; /** * An attribute is a shader variable mapping to a VertexBuffer data * on the CPU. * * @author Kirill Vainer */ public class Attribute extends ShaderVariable { }
PlanetWaves/clockworkengine
trunk/jme3-core/src/main/java/com/jme3/shader/Attribute.java
Java
apache-2.0
1,773
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.math3.optim.linear; import java.util.ArrayList; import java.util.Collection; import org.apache.commons.math3.TestUtils; import org.apache.commons.math3.optim.nonlinear.scalar.GoalType; import org.junit.Assert; import org.junit.Test; public class SimplexTableauTest { @Test public void testInitialization() { LinearObjectiveFunction f = createFunction(); Collection<LinearConstraint> constraints = createConstraints(); SimplexTableau tableau = new SimplexTableau(f, constraints, GoalType.MAXIMIZE, false, 1.0e-6); double[][] expectedInitialTableau = { {-1, 0, -1, -1, 2, 0, 0, 0, -4}, { 0, 1, -15, -10, 25, 0, 0, 0, 0}, { 0, 0, 1, 0, -1, 1, 0, 0, 2}, { 0, 0, 0, 1, -1, 0, 1, 0, 3}, { 0, 0, 1, 1, -2, 0, 0, 1, 4} }; assertMatrixEquals(expectedInitialTableau, tableau.getData()); } @Test public void testDropPhase1Objective() { LinearObjectiveFunction f = createFunction(); Collection<LinearConstraint> constraints = createConstraints(); SimplexTableau tableau = new SimplexTableau(f, constraints, GoalType.MAXIMIZE, false, 1.0e-6); double[][] expectedTableau = { { 1, -15, -10, 0, 0, 0, 0}, { 0, 1, 0, 1, 0, 0, 2}, { 0, 0, 1, 0, 1, 0, 3}, { 0, 1, 1, 0, 0, 1, 4} }; tableau.dropPhase1Objective(); assertMatrixEquals(expectedTableau, tableau.getData()); } @Test public void testTableauWithNoArtificialVars() { LinearObjectiveFunction f = new LinearObjectiveFunction(new double[] {15, 10}, 0); Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>(); constraints.add(new LinearConstraint(new double[] {1, 0}, Relationship.LEQ, 2)); constraints.add(new LinearConstraint(new double[] {0, 1}, Relationship.LEQ, 3)); constraints.add(new LinearConstraint(new double[] {1, 1}, Relationship.LEQ, 4)); SimplexTableau tableau = new SimplexTableau(f, constraints, GoalType.MAXIMIZE, false, 1.0e-6); double[][] initialTableau = { {1, -15, -10, 25, 0, 0, 0, 0}, {0, 1, 0, -1, 1, 0, 0, 2}, {0, 0, 1, -1, 0, 1, 0, 3}, {0, 1, 1, -2, 0, 0, 1, 4} }; assertMatrixEquals(initialTableau, tableau.getData()); } @Test public void testSerial() { LinearObjectiveFunction f = createFunction(); Collection<LinearConstraint> constraints = createConstraints(); SimplexTableau tableau = new SimplexTableau(f, constraints, GoalType.MAXIMIZE, false, 1.0e-6); Assert.assertEquals(tableau, TestUtils.serializeAndRecover(tableau)); } private LinearObjectiveFunction createFunction() { return new LinearObjectiveFunction(new double[] {15, 10}, 0); } private Collection<LinearConstraint> createConstraints() { Collection<LinearConstraint> constraints = new ArrayList<LinearConstraint>(); constraints.add(new LinearConstraint(new double[] {1, 0}, Relationship.LEQ, 2)); constraints.add(new LinearConstraint(new double[] {0, 1}, Relationship.LEQ, 3)); constraints.add(new LinearConstraint(new double[] {1, 1}, Relationship.EQ, 4)); return constraints; } private void assertMatrixEquals(double[][] expected, double[][] result) { Assert.assertEquals("Wrong number of rows.", expected.length, result.length); for (int i = 0; i < expected.length; i++) { Assert.assertEquals("Wrong number of columns.", expected[i].length, result[i].length); for (int j = 0; j < expected[i].length; j++) { Assert.assertEquals("Wrong value at position [" + i + "," + j + "]", expected[i][j], result[i][j], 1.0e-15); } } } }
venkateshamurthy/java-quantiles
src/test/java/org/apache/commons/math3/optim/linear/SimplexTableauTest.java
Java
apache-2.0
5,138
/* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class com_jme3_bullet_collision_shapes_HeightfieldCollisionShape */ #ifndef _Included_com_jme3_bullet_collision_shapes_HeightfieldCollisionShape #define _Included_com_jme3_bullet_collision_shapes_HeightfieldCollisionShape #ifdef __cplusplus extern "C" { #endif /* * Class: com_jme3_bullet_collision_shapes_HeightfieldCollisionShape * Method: createShape * Signature: (IILjava/nio/ByteBuffer;FFFIZ)J */ JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_HeightfieldCollisionShape_createShape (JNIEnv *, jobject, jint, jint, jobject, jfloat, jfloat, jfloat, jint, jboolean); #ifdef __cplusplus } #endif #endif
PlanetWaves/clockworkengine
trunk/jme3-bullet-native/src/native/cpp/com_jme3_bullet_collision_shapes_HeightfieldCollisionShape.h
C
apache-2.0
719
# Encoding: utf-8 # Cloud Foundry Java Buildpack # Copyright 2013 the original author or authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'spec_helper' require 'integration_helper' describe 'release script', :integration do include_context 'integration_helper' it 'should return zero if success', app_fixture: 'integration_valid' do run("bin/release #{app_dir}") { |status| expect(status).to be_success } end it 'should fail to release when no containers detect' do run("bin/release #{app_dir}") do |status| expect(status).not_to be_success expect(stderr.string).to match(/No container can run this application/) end end end
pcl/java-8-buildpack
spec/bin/release_spec.rb
Ruby
apache-2.0
1,185
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; namespace Benchmarks.Controllers { [Route("mvc")] public class HomeController : Controller { [HttpGet("plaintext")] public IActionResult Plaintext() { return new PlainTextActionResult(); } [HttpGet("json")] [Produces("application/json")] public object Json() { return new { message = "Hello, World!" }; } [HttpGet("view")] public ViewResult Index() { return View(); } private class PlainTextActionResult : IActionResult { private static readonly byte[] _helloWorldPayload = Encoding.UTF8.GetBytes("Hello, World!"); public Task ExecuteResultAsync(ActionContext context) { context.HttpContext.Response.StatusCode = StatusCodes.Status200OK; context.HttpContext.Response.ContentType = "text/plain"; context.HttpContext.Response.ContentLength = _helloWorldPayload.Length; return context.HttpContext.Response.Body.WriteAsync(_helloWorldPayload, 0, _helloWorldPayload.Length); } } } }
actframework/FrameworkBenchmarks
frameworks/CSharp/aspnetcore/Benchmarks/Controllers/HomeController.cs
C#
bsd-3-clause
1,467
# -*- encoding: us-ascii -*- module EnumeratorLazySpecs class SpecificError < Exception; end class YieldsMixed def self.initial_yields [nil, 0, 0, 0, 0, nil, :default_arg, [], [], [0], [0, 1], [0, 1, 2]] end def self.gathered_yields [nil, 0, [0, 1], [0, 1, 2], [0, 1, 2], nil, :default_arg, [], [], [0], [0, 1], [0, 1, 2]] end def self.gathered_yields_with_args(arg, *args) [nil, 0, [0, 1], [0, 1, 2], [0, 1, 2], nil, arg, args, [], [0], [0, 1], [0, 1, 2]] end def each(arg=:default_arg, *args) yield yield 0 yield 0, 1 yield 0, 1, 2 yield(*[0, 1, 2]) yield nil yield arg yield args yield [] yield [0] yield [0, 1] yield [0, 1, 2] end end class EventsMixed def each ScratchPad << :before_yield yield 0 ScratchPad << :after_yield raise SpecificError ScratchPad << :after_error :should_not_reach_here end end end
digitalextremist/rubinius
spec/ruby/core/enumerator/lazy/fixtures/classes.rb
Ruby
bsd-3-clause
998
/*! gridster.js - v0.5.4 - 2014-07-16 * http://gridster.net/ * Copyright (c) 2014 ducksboard; Licensed MIT */ .gridster { position:relative; } .gridster > * { margin: 0 auto; -webkit-transition: height .4s, width .4s; -moz-transition: height .4s, width .4s; -o-transition: height .4s, width .4s; -ms-transition: height .4s, width .4s; transition: height .4s, width .4s; } .gridster .gs-w { z-index: 2; position: absolute; } .ready .gs-w:not(.preview-holder) { -webkit-transition: opacity .3s, left .3s, top .3s; -moz-transition: opacity .3s, left .3s, top .3s; -o-transition: opacity .3s, left .3s, top .3s; transition: opacity .3s, left .3s, top .3s; } .ready .gs-w:not(.preview-holder), .ready .resize-preview-holder { -webkit-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; -moz-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; -o-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; transition: opacity .3s, left .3s, top .3s, width .3s, height .3s; } .gridster .preview-holder { z-index: 1; position: absolute; background-color: #fff; border-color: #fff; opacity: 0.3; } .gridster .player-revert { z-index: 10!important; -webkit-transition: left .3s, top .3s!important; -moz-transition: left .3s, top .3s!important; -o-transition: left .3s, top .3s!important; transition: left .3s, top .3s!important; } .gridster .dragging, .gridster .resizing { z-index: 10!important; -webkit-transition: all 0s !important; -moz-transition: all 0s !important; -o-transition: all 0s !important; transition: all 0s !important; } .gs-resize-handle { position: absolute; z-index: 1; } .gs-resize-handle-both { width: 20px; height: 20px; bottom: -8px; right: -8px; background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pg08IS0tIEdlbmVyYXRvcjogQWRvYmUgRmlyZXdvcmtzIENTNiwgRXhwb3J0IFNWRyBFeHRlbnNpb24gYnkgQWFyb24gQmVhbGwgKGh0dHA6Ly9maXJld29ya3MuYWJlYWxsLmNvbSkgLiBWZXJzaW9uOiAwLjYuMSAgLS0+DTwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DTxzdmcgaWQ9IlVudGl0bGVkLVBhZ2UlMjAxIiB2aWV3Qm94PSIwIDAgNiA2IiBzdHlsZT0iYmFja2dyb3VuZC1jb2xvcjojZmZmZmZmMDAiIHZlcnNpb249IjEuMSINCXhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbDpzcGFjZT0icHJlc2VydmUiDQl4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjZweCIgaGVpZ2h0PSI2cHgiDT4NCTxnIG9wYWNpdHk9IjAuMzAyIj4NCQk8cGF0aCBkPSJNIDYgNiBMIDAgNiBMIDAgNC4yIEwgNCA0LjIgTCA0LjIgNC4yIEwgNC4yIDAgTCA2IDAgTCA2IDYgTCA2IDYgWiIgZmlsbD0iIzAwMDAwMCIvPg0JPC9nPg08L3N2Zz4='); background-position: top left; background-repeat: no-repeat; cursor: se-resize; z-index: 20; } .gs-resize-handle-x { top: 0; bottom: 13px; right: -5px; width: 10px; cursor: e-resize; } .gs-resize-handle-y { left: 0; right: 13px; bottom: -5px; height: 10px; cursor: s-resize; } .gs-w:hover .gs-resize-handle, .resizing .gs-resize-handle { opacity: 1; } .gs-resize-handle, .gs-w.dragging .gs-resize-handle { opacity: 0; } .gs-resize-disabled .gs-resize-handle { display: none!important; } [data-max-sizex="1"] .gs-resize-handle-x, [data-max-sizey="1"] .gs-resize-handle-y, [data-max-sizey="1"][data-max-sizex="1"] .gs-resize-handle { display: none !important; } /* Uncomment this if you set helper : "clone" in draggable options */ /*.gridster .player { opacity:0; } */
cciollaro/brainy
vendor/gridster/jquery.gridster.css
CSS
mit
3,609
/** * @license OData plugin for Free-jqGrid * * Copyright (c) 2014-2015, Mark Babayev (https://github.com/mirik123) [email protected] * License MIT (MIT-LICENSE.txt) * * inspired by Richard Bennett gist code: jqGrid.ODataExtensions.js * https://gist.github.com/dealproc/6678280 */ /*jslint continue: true, nomen: true, plusplus: true, unparam: true, todo: true, vars: true, white: true */ /*global jQuery */ (function ($) { /* *Functions: * parseMetadata - $.jgrid.odataHelper.parseMetadata(rawdata, metadatatype) * metadatatype can be: xml,json,datajs. * this is a generic function that can be used in external packages too, not only in jqGrid. * It parses $metadata ajax response in xml/json format to plain javascript object. * IT can also consume metadata returned from datajs.js method "OData.parseMetadata" * * odataGenColModel - $("#grid").jqGrid('odataGenColModel', {...}); * This function generates jqgrid style columns by requesting odata $metadata. * It is automatically called by odataInit when gencolumns=true. * * Options: * metadatatype: 'xml' - ajax dataType, can be json, jsonp or xml * async: false - set ajax sync/async for $metadata request (when calling from odataInit only async=false is supported) * entitySet: null - required field, the name of the desired entity set * expandable: (none|link|json|subgrid) - the expansion type for ComplexTypes and NavigationProperties, for details see "odata colModel parameters". * metadataurl: (odataurl || p.url) + '/$metadata' * - set ajax url for $metadata request * successfunc: null - odataGenColModel callback to see when metadata request is over and jqgrid can be refreshed * parsecolfunc: null - event for converting parsed metadata data array in form of {name,type,nullable,iskey,...} to the jqgrid colModel array * parsemetadatafunc: null - event for converting unparsed metadata data (xml or json) to the jqgrid colModel array * errorfunc: null - error callback * * jqGrid Events: * jqGridODataParseMetadata - the same as parsemetadatafunc, when no custom function exists the default function is used: $("#grid").jqGrid('parseMetadata', rawdata, dataType) * jqGridODataParseColumns - the same as parsecolfunc, when no custom function exists the default function is used: $("#grid").jqGrid('parseColumns', {...}) * * odataInit - $("#grid").jqGrid('odataInit', {...}); * This is main plugin function. It should be called before colModel is initialized. * When columns are defined manually it can be called from events beforeInitGrid, onInitGrid. * When columns are created automatically it can be called from event beforeInitGrid only. * * Options: * gencolumns: false - automatically generate columns from odata $metadata (calls odataGenColModel) * odataurl: p.url - required field, main odata url * datatype: 'json' - ajax dataType, can be json, jsonp or xml * entitySet: null - required field, the name of the desired entity set * annotations: false - use odata annotations for getting jqgrid parameters: page,records,count,total * annotationName: "@jqgrid.GridModelAnnotate" - odata annotations class and namespace * version - odata version, used to set $count=true or $inlinecount=allpages * errorfunc: null - error callback * metadatatype: datatype || 'xml' - when gencolumns=true, alternative ajax dataType for $metadata request * odataverbs: { - http verbs for odata and their corresponding actions in jqgrid * inlineEditingAdd: 'POST', * inlineEditingEdit: 'PATCH', * formEditingAdd: 'POST', * formEditingEdit: 'PUT' * } * * odata colModel parameters * isnavigation - the column type is a NavigationProperty that points to another entity * iscomplex - the column type is a ComplexType * iscollection - the column is a Collection of entities that can be opened in a new subgrid * nosearch - when true, this column is excluded from odata search * unformat: function (searchField, searchString, searchOper) - works analogous to xmlmap/jsonmap, * for example the function body can be: { return searchString !== '-1' ? 'cltype/Id' : null; } * expand: (link|json|subgrid) - defines data expansion types for complex amd navigation properties, * it works only with custom formatters specified in odata cmTemplates. * link - the link to the property is displayed * json - the property data is displayed in a json string form * subgrid - jquery subgrid is opened when clicking on a link inside column * * odata column templates (cmTemplate) * odataComplexType - column template for odata Complex type. * odataNavigationProperty - column template for odata Navigation property. * *Plugin allows setting custom cmTemplates for any odata type, for example: * $.jgrid.cmTemplate["Edm.GeographyPoint"] = { * editable: false, * formatter: function(cellvalue, options, rowObject) { * if (!cellvalue && this.p.datatype === 'xml') { * var xmlvalue = $(rowObject).filter(function() { * return this.localName.toLowerCase() === options.colModel.name.toLowerCase(); * }); * cellvalue = $.jgrid.odataHelper.convertXmlToJson(xmlvalue[0]); * } * if(cellvalue.crs && cellvalue.coordinates) { * return $.jgrid.format('<div>{0}</div><div>[{1},{2}]</div>', cellvalue.crs.properties.name, cellvalue.coordinates[0], cellvalue.coordinates[1]); * } * return $.jgrid.format('<div>{0}</div>', cellvalue); * } * }; * * Example of using standard service from http://www.odata.org/odata-services: * $("#grid").jqGrid({ * ..., * beforeInitGrid: function () { * $(this).jqGrid('odataInit', { * annotations: false, * metadatatype: 'xml', * datatype: 'jsonp', * version: 4, * gencolumns: true, * expandable: 'json', * entitySet: 'Products', * odataurl: "http://services.odata.org/V4/OData/OData.svc/Products", * metadataurl: 'http://services.odata.org/V4/OData/OData.svc/$metadata', * errorfunc: function (jqXHR, parsedError) { * jqXHR = jqXHR.xhr || jqXHR; * parsedError = $('#errdialog').html() + parsedError; * $('#errdialog').html(parsedError).dialog('open'); * }); * } * }); * * $.ajax({ * url: 'http://services.odata.org/V4/OData/OData.svc/$metadata', * dataType: xml, * type: 'GET' * }).done(function(data, st, xhr) { * var dataType = xhr.getResponseHeader('Content-Type').indexOf('json') >= 0 ? 'json' : 'xml'; * if(dataType === 'json') { * data = $.jgrid.odataHelper.resolveJsonReferences(data); * } * data = $.jgrid.odataHelper.parseMetadata(data, dataType); * var colModels = {}; * for (i in data) { * if (data.hasOwnProperty(i) && i) { * colModels[i] = $(this).jqGrid('parseColumns', data[i], 'subgrid'); * } * } * $("#grid").jqGrid({ * colModel: colModels['Product'], * odata: { * iscollection: true, * subgridCols: colModels * }, * ..., * beforeInitGrid: function () { * $(this).jqGrid('odataInit', { * annotations: false, * datatype: 'jsonp', * version: 4, * gencolumns: false, * entitySet: 'Products', * odataurl: "http://services.odata.org/V4/OData/OData.svc/Products" * }); * } * }); * }); * * Examples of using custom services from https://github.com/mirik123/jqGridSamples: * $("#grid").jqGrid({ * colModel: colModelDefinition, * ..., * // when columns are defined manually (gencolumns=false) the odataInit call can be also put in onInitGrid event. * beforeInitGrid: function () { * $(this).jqGrid('odataInit', { * version: 3, * gencolumns: false, * odataurl: 'http://localhost:56216/odata/ODClient' * }); * } * }); * * $("#grid").jqGrid({ * colModel: colModelDefinition, * ..., * beforeInitGrid: function () { * $(this).jqGrid('odataInit', { * version: 4, * datatype: 'json', * annotations: true, * gencolumns: true, * entitySet: 'ODClient', * odataurl: 'http://localhost:56216/odata/ODClient', * metadataurl: 'http://localhost:56216/odata/$metadata' * }); * } * }); * * $("#grid").jqGrid({ * colModel: colModelDefinition, * ..., * beforeInitGrid: function () { * $(this).jqGrid('odataInit', { * version: 4, * datatype: 'xml', * annotations: false, * gencolumns: true, * entitySet: 'ODClient', * odataurl: 'http://localhost:56216/odata/ODClient', * metadataurl: 'http://localhost:56216/odata/$metadata' * }); * } * }); */ "use strict"; $.jgrid.odataHelper = { //http://stackoverflow.com/questions/15312529/resolve-circular-references-from-json-object resolveJsonReferences: function (json, refs) { var i, ref, byid = {}; // all objects by id refs = refs || []; // references to objects that could not be resolved function recurse(obj, prop, parent) { if (typeof obj !== 'object' || !obj) {// a primitive value return obj; } if (Object.prototype.toString.call(obj) === '[object Array]') { for (i = 0; i < obj.length; i++) { // check also if the array element is not a primitive value if (typeof obj[i] !== 'object' || !obj[i]) {// a primitive value return obj[i]; } if (obj[i].$ref) { obj[i] = recurse(obj[i], i, obj); } else { obj[i] = recurse(obj[i], prop, obj); } } return obj; } if (obj.$ref) { // a reference ref = obj.$ref; if (byid[ref]) { return byid[ref]; } // else we have to make it lazy: refs.push([parent, prop, ref]); return; } if (obj.$id) { var id = obj.$id; delete obj.$id; if (obj.$values) {// an array obj = obj.$values.map(recurse); } else {// a plain object var itm; for (itm in obj) { if (obj.hasOwnProperty(itm)) { obj[itm] = recurse(obj[itm], itm, obj); } } } byid[id] = obj; } return obj; } if (typeof json === 'string') { json = JSON.parse(json); } json = recurse(json); // run it! for (i = 0; i < refs.length; i++) { // resolve previously unknown references ref = refs[i]; ref[0][ref[1]] = byid[ref[2]]; // Notice that this throws if you put in a reference at top-level } return json; }, // Changes XML to JSON //http://davidwalsh.name/convert-xml-json convertXmlToJson: function (xml) { // Create the return object var obj = {}, i, j, attribute, item, nodeName, old; if (!xml) { return null; } if (xml.nodeType === 1) { // element // do attributes if (xml.attributes.length > 0) { obj["@attributes"] = {}; for (j = 0; j < xml.attributes.length; j++) { attribute = xml.attributes.item(j); obj["@attributes"][attribute.nodeName] = attribute.nodeValue; } } } else if (xml.nodeType === 3) { // text obj = xml.nodeValue; } else if (!xml.nodeType) { obj = xml; } // do children if (xml.hasChildNodes && xml.hasChildNodes()) { for (i = 0; i < xml.childNodes.length; i++) { item = xml.childNodes.item(i); if (item.nodeType === 3) { return item.nodeValue; } nodeName = item.nodeName; if (obj[nodeName] === undefined) { obj[nodeName] = $.jgrid.odataHelper.convertXmlToJson(item); } else { if (obj[nodeName].push === undefined) { old = obj[nodeName]; obj[nodeName] = []; obj[nodeName].push(old); } obj[nodeName].push($.jgrid.odataHelper.convertXmlToJson(item)); } } } return $.isEmptyObject(obj) ? null : obj; }, parseMetadata: function (rawdata, metadatatype) { function parseXmlMetadata(data) { var entities = {}, entityValues = [], mdata = {}; var namespace = $('Schema', data).attr('Namespace') + '.'; $('EntityContainer EntitySet', data).each(function (i, itm) { entities[$(itm).attr('EntityType').replace(namespace, '')] = $(itm).attr('Name'); entityValues.push($(itm).attr('Name')); }); $('EntityType, ComplexType', data).each(function () { var cols, props, keys, key, iskey, isComplex, isNav, entityType, attr; props = $(this).find('Property,NavigationProperty'); keys = $('Key PropertyRef', this); key = keys && keys.length > 0 ? keys.first().attr('Name') : ''; entityType = $(this).attr('Name'); if (props) { cols = []; props.each(function (n, itm) { attr = {}; $.each(itm.attributes, function () { attr[this.name] = this.value; }); iskey = attr.Name === key; isNav = itm.tagName === 'NavigationProperty'; isComplex = itm.tagName === 'Property' && $('ComplexType[Name="' + attr.Name + '"]', data).length > 0; cols.push($.extend({ iskey: iskey, isComplex: isComplex, isNavigation: isNav, isCollection: $.inArray(attr.Name, entityValues) >= 0 }, attr)); }); if(entities[entityType]) { mdata[entities[entityType]] = cols; } mdata[entityType] = cols; } }); return mdata; } function parseJsonMetadata(data) { var cols, props, keys, key, iskey, i, j, isComplex, isNav, nullable, type, entityType, mdata = {}, entities = {}, entityValues = []; for (i = 0; i < data.EntityContainer.Elements.length; i++) { entities[data.EntityContainer.Elements[i].Type.ElementType.Definition.Name] = data.EntityContainer.Elements[i].Name; entityValues.push(data.EntityContainer.Elements[i].Name); } for (i = 0; i < data.SchemaElements.length ; i++) { props = Array.prototype.concat(data.SchemaElements[i].DeclaredProperties, data.SchemaElements[i].NavigationProperties).filter(function(itm) {return !!itm;}); keys = data.SchemaElements[i].DeclaredKey; key = keys && keys.length > 0 ? keys[0].Name : ''; entityType = data.SchemaElements[i].Name; if (props) { cols = []; for (j = 0; j < props.length; j++) { iskey = props[j].Name === key; nullable = props[j].Type.IsNullable; type = props[j].Type.Definition.Namespace + props[j].Type.Definition.Name; isComplex = !!props[j].Type.Definition.DeclaredProperties; isNav = !isComplex && !props[j].Type; cols.push({ Name: props[j].Name, Type: type, Nullable: nullable, iskey: iskey, isComplex: isComplex, isNavigation: isNav, isCollection: $.inArray(props[j].Name, entityValues) >= 0 }); } if(entities[entityType]) { mdata[entities[entityType]] = cols; } mdata[entityType] = cols; } } return mdata; } function parseDataJSMetadata(data) { var cols, props, keys, key, iskey, i, j, isComplex, isNav, nullable, type, entityType, mdata = {}, entities = {}, entityValues = [], entityTypes = [], complexTypes = []; var schema = data.dataServices.schema[0]; var namespace = schema.namespace + '.'; for (i = 0; i < schema.entityContainer[0].entitySet.length; i++) { entities[schema.entityContainer[0].entitySet[i].entityType.replace(namespace, '')] = schema.entityContainer[0].entitySet[i].name; entityValues.push(schema.entityContainer[0].entitySet[i].name); } for (i = 0; i < schema.complexType.length; i++) { complexTypes.push(schema.complexType[i].name); } entityTypes = Array.prototype.concat(schema.entityType, schema.complexType).filter(function(itm) {return !!itm;}); for (i = 0; i < entityTypes.length ; i++) { props = Array.prototype.concat(entityTypes[i].property, entityTypes[i].navigationProperty).filter(function(itm) {return !!itm;}); keys = entityTypes[i].key; key = keys && keys.propertyRef.length > 0 ? keys.propertyRef[0].name : ''; entityType = entityTypes[i].name; if (props) { cols = []; for (j = 0; j < props.length; j++) { iskey = props[j].name === key; nullable = props[j].nullable !== "false"; type = props[j].type; isComplex = !!props[j].type && $.inArray(props[j].type.replace(namespace, ''), complexTypes) >= 0; isNav = !props[j].type; cols.push({ Name: props[j].name, Type: type, Nullable: nullable, iskey: iskey, isComplex: isComplex, isNavigation: isNav, isCollection: $.inArray(props[j].name, entityValues) >= 0 }); } if(entities[entityType]) { mdata[entities[entityType]] = cols; } mdata[entityType] = cols; } } return mdata; } var mdata; switch(metadatatype) { case 'xml': mdata = parseXmlMetadata(rawdata); break; case 'json': mdata = parseJsonMetadata(rawdata); break; case 'datajs': mdata = parseDataJSMetadata(rawdata); break; } return mdata; }, loadError: function (jqXHR, textStatus, errorThrown) { var status = jqXHR.status; var title = textStatus; var message = errorThrown; if (!jqXHR.responseJSON) { if (jqXHR.responseXML) { jqXHR.responseText = jqXHR.responseText.replace(/<(\/?)([^:>\s]*:)?([^>]+)>/g, "<$1$3>"); jqXHR.responseXML = $.parseXML(jqXHR.responseText); jqXHR.responseJSON = $.jgrid.odataHelper.convertXmlToJson(jqXHR.responseXML); } else if (jqXHR.responseText) { try { jqXHR.responseJSON = $.parseJSON(jqXHR.responseText); } catch (ignore) { } } } if (jqXHR.responseJSON) { var odataerr = jqXHR.responseJSON["@odata.error"] || jqXHR.responseJSON["odata.error"] || jqXHR.responseJSON.error; if (odataerr) { if (odataerr.innererror) { if (odataerr.innererror.internalexception) { title = odataerr.innererror.internalexception.message; message = odataerr.innererror.internalexception.stacktrace || ''; } else { title = odataerr.innererror.message; message = odataerr.innererror.stacktrace || ''; } } else { title = odataerr.message.value || odataerr.message; message = odataerr.stacktrace || ''; } } } else if (errorThrown && $.isPlainObject(errorThrown)) { title = errorThrown.message; message = errorThrown.stack; status = errorThrown.code; } var errstring = "<div>Status/error code: " + status + "</div><div>Message: " + title + '</div><div style="font-size: 0.8em;">' + message + '</div><br/>'; return errstring; } }; $.jgrid.cmTemplate.odataComplexType = { editable: false, formatter: function (cellvalue, options, rowObject) { return $(this).jqGrid('odataJson', cellvalue, options, rowObject); } }; $.jgrid.cmTemplate.odataNavigationProperty = { editable: false, formatter: function (cellvalue, options, rowObject) { if (!options.colModel.odata.expand || options.colModel.odata.expand === 'link') { return $(this).jqGrid('odataLink', cellvalue, options, rowObject); } if (options.colModel.odata.expand === 'json') { return $(this).jqGrid('odataJson', cellvalue, options, rowObject); } if (options.colModel.odata.expand === 'subgrid') { return $(this).jqGrid('odataSubgrid', cellvalue, options, rowObject); } } }; $.jgrid.cmTemplate["Edm.GeographyPoint"] = { editable: false, formatter: function (cellvalue, options, rowObject) { if (!cellvalue && this.p.datatype === 'xml') { var xmlvalue = $(rowObject).filter(function () { return this.localName.toLowerCase() === options.colModel.name.toLowerCase(); }); cellvalue = $.jgrid.odataHelper.convertXmlToJson(xmlvalue[0]); } if (cellvalue.crs && cellvalue.coordinates) { return $.jgrid.format('<div>{0}</div><div>[{1},{2}]</div>', cellvalue.crs.properties.name, cellvalue.coordinates[0], cellvalue.coordinates[1]); } return $.jgrid.format('<div>{0}</div>', cellvalue); } }; $.jgrid.extend({ odataLink: function (cellvalue, options, rowObject) { var keyValue, result, $p = this[0].p; if ($p.datatype !== 'xml') { if (rowObject[options.colModel.name + '@odata.navigationLink']) { keyValue = rowObject[options.colModel.name + '@odata.navigationLink']; result = $.jgrid.format('<a href="{0}/{1}" target="_self">{2}</a>', $p.odata.baseUrl, keyValue, options.colModel.name); return result; } keyValue = rowObject[$p.jsonReader.id]; } else { keyValue = (function (id) { return $(rowObject).filter(function () { return this.localName && this.localName.toLowerCase() === id; }).text(); }($p.xmlReader.id.toLowerCase())); } if ($p.odata.iscollection) { result = $.jgrid.format('<a href="{0}({1})/{2}" target="_self">{2}</a>', $p.url, keyValue, options.colModel.name); } else { result = $.jgrid.format('<a href="{0}/{1}" target="_self">{1}</a>', $p.url, options.colModel.name); } return result; }, odataJson: function (cellvalue, options, rowObject) { var i, result, $p = this[0].p, tmpObj = {}; if ($p.datatype === 'xml') { var xmlvalue = $(rowObject).filter(function () { return this.localName.toLowerCase() === options.colModel.name.toLowerCase(); }); cellvalue = $.jgrid.odataHelper.convertXmlToJson(xmlvalue[0]); } for (i in cellvalue) { if (cellvalue.hasOwnProperty(i) && i && i.indexOf('@odata.') < 0 && i.indexOf('@attributes') < 0) { tmpObj[i] = cellvalue[i]; } } result = JSON.stringify(tmpObj, null, 1); return result; }, odataSubgrid: function (cellvalue, options, rowObject) { var i, keyValue, result, $p = this[0].p; if ($p.datatype !== 'xml') { keyValue = rowObject[$p.jsonReader.id]; } else { keyValue = (function (id) { return $(rowObject).filter(function () { return this.localName && this.localName.toLowerCase() === id; }).text(); }($p.xmlReader.id.toLowerCase())); } for (i in $p._index) { if ($p._index.hasOwnProperty(i) && i && keyValue === $p._index[i].toString()) { keyValue = i; break; } } var onclick = '\'$(\"#{2}\").jqGrid(\"setGridParam\", { odata: {activeEntitySet: \"{1}\" } });$(\"#{2}\").jqGrid(\"expandSubGridRow\", \"{0}\");return false;\''; result = '<a style="cursor:pointer" data-id="{0}" onclick=' + onclick + '>{1}</a>'; result = $.jgrid.format(result, keyValue, options.colModel.name, options.gid); return result; }, parseColumns: function (cols, expandable) { var i = 0, isInt, isNum, isDate, isBool, cmTemplate, newcol = [], searchrules, searchtype, label; var intTypes = 'Edm.Int16,Edm.Int32,Edm.Int64'; var numTypes = 'Edm.Decimal,Edm.Double,Edm.Single'; var boolTypes = 'Edm.Byte,Edm.SByte'; for (i = 0; i < cols.length; i++) { isInt = intTypes.indexOf(cols[i].Type) >= 0; isNum = numTypes.indexOf(cols[i].Type) >= 0; isBool = boolTypes.indexOf(cols[i].Type) >= 0; isDate = cols[i].Type && (cols[i].Type.indexOf('Edm.') >= 0 && (cols[i].Type.indexOf('Date') >= 0 || cols[i].Type.indexOf('Time') >= 0)); cmTemplate = $.jgrid.cmTemplate[cols[i].Type] ? cols[i].Type : cols[i].isComplex ? 'odataComplexType' : cols[i].isNavigation ? 'odataNavigationProperty' : isInt ? 'integerStr' : isNum ? 'numberStr' : isBool ? 'booleanCheckbox' : 'text'; searchrules = { integer: isInt, number: isNum, date: isDate, required: !cols[i].Nullable || cols[i].Nullable === 'false' }; searchtype = isInt ? 'integer' : isNum ? 'number' : isDate ? 'datetime' : isBool ? 'checkbox' : 'text'; label = (cols[i].isNavigation || cols[i].isComplex) ? '<span class="ui-icon ui-icon-arrowreturn-1-s" style="display:inline-block;vertical-align:middle;"></span>' + cols[i].Name : cols[i].Name; newcol.push($.extend({ label: label, name: cols[i].Name, index: cols[i].Name, editable: !cols[i].isNavigation && !cols[i].iskey, searchrules: searchrules, editrules: searchrules, searchtype: searchtype, inputtype: searchtype, edittype: searchtype, key: cols[i].iskey, odata: { expand: cols[i].isNavigation ? expandable : cols[i].isComplex ? 'json' : null, isnavigation: cols[i].isNavigation, iscomplex: cols[i].isComplex, iscollection: cols[i].isCollection } }, $.jgrid.cmTemplate[cmTemplate])); } return newcol; }, odataInit: function (options) { // builds out OData expressions... the condition. function prepareExpression(p, searchField, searchString, searchOper) { var i, col; // if we want to support "in" clauses, we need to follow this stackoverflow article: //http://stackoverflow.com/questions/7745231/odata-where-id-in-list-query/7745321#7745321 // this is for basic searching, with a single term. if (searchField && (searchString || searchOper === 'nu' || searchOper === 'nn')) { if (searchString) { //append '' when searched field is of the string type for (i = 0; i < p.colModel.length; i++) { col = p.colModel[i]; if (col.name === searchField) { if (col.odata.nosearch) { return; } if (col.odata.unformat) { searchField = $.isFunction(col.odata.unformat) ? col.odata.unformat(searchField, searchString, searchOper) : col.odata.unformat; if (!searchField) { return; } } if (!col.searchrules || (!col.searchrules.integer && !col.searchrules.number && !col.searchrules.date)) { searchString = "'" + searchString + "'"; } else if (col.searchrules && col.searchrules.date) { searchString = (new Date(searchString)).toISOString(); //v3: postData.searchString = "datetimeoffset'" + postData.searchString + "'"; //v2: postData.searchString = "DateTime'" + postData.searchString + "'"; } break; } } } switch (searchOper) { case "in": // is in case "cn": // contains //return "substringof(" + searchString + ", " + searchField + ") eq true"; return "indexof(" + searchField + ",tolower(" + searchString + ")) gt -1"; case "ni": // is not in case "nc": // does not contain. //return "substringof(" + searchString + ", " + searchField + ") eq false"; return "indexof(" + searchField + ",tolower(" + searchString + ")) eq -1"; case "bw": // begins with return "startswith(" + searchField + "," + searchString + ") eq true"; case "bn": // does not begin with return "startswith(" + searchField + "," + searchString + ") eq false"; case "ew": // ends with return "endswith(" + searchField + "," + searchString + ") eq true"; case "en": // does not end with. return "endswith(" + searchField + "," + searchString + ") eq false"; case "nu": // is null return searchField + " eq null"; case "nn": // is not null return searchField + " ne null"; default: // eq,ne,lt,le,gt,ge, return searchField + " " + searchOper + " " + searchString; } } } // when dealing with the advanced query dialog, this parses the encapsulating Json object // which we will then build the advanced OData expression from. function parseFilterGroup(filterGroup, p) { var i, rule, filterText = "", filterRes; if (filterGroup.groups) { if (filterGroup.groups.length) { for (i = 0; i < filterGroup.groups.length; i++) { filterText += "(" + parseFilterGroup(filterGroup.groups[i], p) + ")"; if (i < filterGroup.groups.length - 1) { filterText += " " + filterGroup.groupOp.toLowerCase() + " "; } } if (filterGroup.rules && filterGroup.rules.length) { filterText += " " + filterGroup.groupOp.toLowerCase() + " "; } } } if (filterGroup.rules.length) { for (i = 0; i < filterGroup.rules.length; i++) { rule = filterGroup.rules[i]; filterRes = prepareExpression(p, rule.field, rule.data, rule.op); if (filterRes) { filterText += filterRes + " " + filterGroup.groupOp.toLowerCase() + " "; } } } filterText = filterText.trim().replace(/\s(and|or)$/, '').trim(); return filterText; } function setupWebServiceData(p, o, postData) { var params = {}; //var expandlist = p.colModel.filter(function(itm) { return itm.odata && itm.odata.isnavigation && (itm.odata.expand === 'json' || itm.odata.expand === 'subgrid'); }); //if(expandlist.length > 0) { // params.$expand = expandlist.reduce(function(x,y) { return x+','+ y.name; }, '').substring(1); //} //Query options $orderby, $count, $skip and $top cannot be applied to the requested resource if (!p.odata.iscollection) { if (!o.version || o.version < 4) { params.$format = o.datatype === 'xml' ? 'atom' : 'application/json;odata=fullmetadata'; } else { params.$format = o.datatype === 'xml' ? 'atom' : 'application/json;odata.metadata=full'; } return params; } params = { $top: postData.rows, //- $top removes odata.nextLink parameter $skip: (parseInt(postData.page, 10) - 1) * p.rowNum }; if (o.datatype === 'jsonp') { params.$callback = o.callback; } if (!o.version || o.version < 4) { params.$inlinecount = "allpages"; params.$format = o.datatype === 'xml' ? 'atom' : 'application/json;odata=fullmetadata'; } else { params.$count = true; params.$format = o.datatype === 'xml' ? 'atom' : 'application/json;odata.metadata=full'; } // if we have an order-by clause to use, then we build it. if (postData.sidx) { // two columns have the following data: // postData.sidx = "{ColumnName} {order}, {ColumnName} " // postData.sord = "{order}" // we need to split sidx by the ", " and see if there are multiple columns. If there are, we need to go through // each column and get its parts, then parse that for the appropriate columns to build for the sort. params.$orderby = postData.sidx + " " + postData.sord; } if (!postData._search) { return params; } // complex searching, with a groupOp. This is for if we enable the form for multiple selection criteria. if (postData.filters) { var filterGroup = $.parseJSON(postData.filters); var groupSearch = parseFilterGroup(filterGroup, p); if (groupSearch.length > 0) { params.$filter = groupSearch; } } else { params.$filter = prepareExpression(p, postData.searchField, postData.searchString, postData.searchOper); } return params; } function subgridRowExpanded(p, o, subgrid_id, row_id) { //var rowObject = $(this).jqGrid('getRowData', row_id, p.odata.activeEntitySet), result; //var rowObject = p.data[p._index[row_id]][p.odata.activeEntitySet], result; var result, colModel = p.colModel.filter(function (itm) { return itm.name === p.odata.activeEntitySet; })[0]; row_id = p._index[row_id]; if (p.odata.iscollection) { result = $.jgrid.format('{0}({1})/{2}', p.url, row_id, p.odata.activeEntitySet); } else { result = $.jgrid.format('{0}/{1}', p.url, p.odata.activeEntitySet); } var odatainit = { datatype: o.datatype, version: o.version, gencolumns: false, expandable: o.expandable, odataurl: result, errorfunc: o.errorfunc, annotations: o.annotations, entitySet: p.odata.activeEntitySet }; $("#" + subgrid_id).html('<table id="' + subgrid_id + '_t" class="scroll"></table>'); $("#" + subgrid_id + "_t").jqGrid({ colModel: p.odata.subgridCols[p.odata.activeEntitySet], odata: $.extend({}, p.odata, colModel.odata), loadonce: true, beforeInitGrid: function () { $(this).jqGrid('odataInit', odatainit); }, loadError: function (jqXHR, textStatus, errorThrown) { var parsedError = $.jgrid.odataHelper.loadError(jqXHR, textStatus, errorThrown); parsedError = $('#errdialog').html() + parsedError; $('#errdialog').html(parsedError).dialog('open'); } }); } function initDefaults(p, o) { var i, defaultGetAjaxOptions = { datatype: o.datatype, jsonpCallback: o.callback }, subGridRowExpandedFunc = function (subgrid_id, row_id) { return subgridRowExpanded(p, o, subgrid_id, row_id); }; if (!p.odata) { p.odata = { iscollection: true }; } $.extend(p, { serializeGridData: function (postData) { postData = setupWebServiceData(p, o, postData); this.p.odata.postData = postData; return postData; }, ajaxGridOptions: defaultGetAjaxOptions, mtype: 'GET', url: o.odataurl }, defaultGetAjaxOptions); if (p.colModel) { for (i = 0; i < p.colModel.length; i++) { if (p.colModel[i].odata && p.colModel[i].odata.expand === 'subgrid') { p.subGrid = true; p.subGridRowExpanded = subGridRowExpandedFunc; p.odata.activeEntitySet = p.colModel[i].name; p.loadonce = true; break; } } } var defaultAjaxOptions = { contentType: 'application/' + (o.datatype === 'jsonp' ? 'json' : o.datatype) + ';charset=utf-8', datatype: (o.datatype === 'jsonp' ? 'json' : o.datatype) }; p.inlineEditing = $.extend(true, { beforeSaveRow: function (options, rowid) { if (options.extraparam.oper === 'edit') { options.url = o.odataurl; options.mtype = o.odataverbs.inlineEditingEdit; options.url += '(' + rowid + ')'; } else { options.url = o.odataurl; options.mtype = o.odataverbs.inlineEditingAdd; } return true; }, serializeSaveData: function (postdata) { return JSON.stringify(postdata); }, ajaxSaveOptions: defaultAjaxOptions }, p.inlineEditing || {}); $.extend(p.formEditing, { onclickSubmit: function (options, postdata, frmoper) { if (frmoper === 'add') { options.url = o.odataurl; options.mtype = o.odataverbs.formEditingAdd; } else if (frmoper === 'edit') { options.url = o.odataurl + '(' + postdata[p.id + "_id"] + ')'; options.mtype = o.odataverbs.formEditingEdit; } return postdata; }, ajaxEditOptions: defaultAjaxOptions, serializeEditData: function (postdata) { return JSON.stringify(postdata); } }); $.extend(p.formDeleting, { url: o.odataurl, mtype: "DELETE", serializeDelData: function () { return ""; }, onclickSubmit: function (options, postdata) { options.url += '(' + postdata + ')'; return ''; }, ajaxDelOptions: defaultAjaxOptions }); var keyName = p.colModel.filter(function (itm) { return !!itm.key; })[0]; keyName = keyName ? keyName.name : (p.sortname || 'id'); if (o.datatype === 'xml') { if (o.annotations) { $.extend(true, p, { loadBeforeSend: function (jqXHR) { jqXHR.setRequestHeader("Prefer", 'odata.include-annotations="*"'); } }); } var root = '>feed'; var entry = '>entry'; var cell = '>content>properties'; $.extend(true, p, { xmlReader: { root: function (data) { data = data.childNodes[0]; data.innerHTML = data.innerHTML.replace(/<(\/?)([^:>\s]*:)?([^>]+)>/g, "<$1$3>"); var param = $(data).attr('m:context'); if (param) { p.odata.baseUrl = param.substring(0, param.indexOf('/$metadata')); p.odata.entityType = param.substring(param.indexOf('#') + 1).replace('/$entity', ''); } param = $(data).attr('m:type'); if (param) { p.odata.entityType = param.replace('#', ''); } return data; }, row: function (data) { if (data.localName === 'entry') { data = [data]; } else { data = $(entry, data); } return data; }, cell: function (data) { return $(cell, data).get(0).childNodes; }, records: function (data) { return $(root + entry, data).length; //$('count', data).text() }, page: function () { var skip = p.odata.postData.$skip + p.rowNum; return Math.ceil(skip / p.rowNum); }, total: function (data) { var records = $(root + entry, data).length; //$('count', data).text() var skip = p.odata.postData.$skip + p.rowNum; return Math.ceil(skip / p.rowNum) + (records > 0 ? 1 : 0); }, repeatitems: true, userdata: 'userdata', id: keyName } }); } else { $.extend(true, p, { jsonReader: { root: function (data) { var param = data['@odata.context']; if (param) { p.odata.baseUrl = param.substring(0, param.indexOf('/$metadata')); p.odata.entityType = param.substring(param.indexOf('#') + 1).replace('/$entity', ''); } param = data['@odata.type']; if (param) { p.odata.entityType = param.replace('#', ''); } //data = $.jgrid.odataHelper.resolveJsonReferences(data); return data.value || [data]; }, repeatitems: true, id: keyName } }); if (o.annotations) { $.extend(true, p, { loadBeforeSend: function (jqXHR) { jqXHR.setRequestHeader("Prefer", 'odata.include-annotations="*"'); }, jsonReader: { records: function (data) { return data[o.annotationName].records; }, page: function (data) { return data[o.annotationName].page; }, total: function (data) { return data[o.annotationName].total; }, userdata: function (data) { return data[o.annotationName].userdata; } } }); } else { $.extend(true, p, { jsonReader: { records: function (data) { return data["odata.count"] || data["@odata.count"]; }, page: function (data) { var skip; if (data["odata.nextLink"]) { skip = parseInt(data["odata.nextLink"].split('skip=')[1], 10); } else { skip = p.odata.postData.$skip + p.rowNum; var total = data["odata.count"] || data["@odata.count"]; if (skip > total) { skip = total; } } return Math.ceil(skip / p.rowNum); }, total: function (data) { var total = data["odata.count"] || data["@odata.count"]; return Math.ceil(total / p.rowNum); }, userdata: "userdata" } }); } } } return this.each(function () { var $t = this, $self = $(this), p = this.p; if (!$t.grid || !p) { return; } var o = $.extend(true, { gencolumns: false, odataurl: p.url, datatype: 'json', //json,jsonp,xml entitySet: null, annotations: false, annotationName: "@jqgrid.GridModelAnnotate", odataverbs: { inlineEditingAdd: 'POST', inlineEditingEdit: 'PATCH', formEditingAdd: 'POST', formEditingEdit: 'PUT' } }, options || {}); if (o.datatype === 'jsonp') { o.callback = "jsonpCallback"; } if (!o.entitySet) { if ($.isFunction(o.errorfunc)) { o.errorfunc({}, 'entitySet cannot be empty', 0); } return; } if (o.gencolumns) { var gencol = $.extend(true, { parsecolfunc: null, parsemetadatafunc: null, successfunc: null, errorfunc: null, async: false, entitySet: null, metadatatype: options.datatype || 'xml', metadataurl: (options.odataurl || p.url) + '/$metadata' }, options || {}); if (gencol.async) { gencol.successfunc = function () { if ($t.grid.hDiv) { $t.grid.hDiv.loading = false; } $self.jqGrid('setGridParam', { datatype: o.datatype }).trigger('reloadGrid'); }; if ($t.grid.hDiv) { $t.grid.hDiv.loading = true; } } $self.jqGrid('odataGenColModel', gencol); } initDefaults(p, o); }); }, odataGenColModel: function (options) { var $t = this[0], p = $t.p, $self = $($t), mdata, coldata; var o = $.extend(true, { parsecolfunc: null, parsemetadatafunc: null, successfunc: null, errorfunc: null, entitySet: null, metadataurl: p.url + '/$metadata', metadatatype: 'xml', //json,jsonp,xml expandable: 'link', async: false }, options || {}); if (o.metadatatype === 'jsonp') { o.callback = "jsonpCallback"; } if (!o.entitySet) { if ($.isFunction(o.errorfunc)) { o.errorfunc({}, 'entitySet cannot be empty', 0); } return; } $.ajax({ url: o.metadataurl, type: 'GET', dataType: o.metadatatype, jsonpCallback: o.callback, //contentType: 'application/' + o.metadatatype + ';charset=utf-8', //headers: { //"OData-Version": "4.0" //"Accept": "application/json;odata=light;q=1,application/json;odata=verbose;q=0.5" //}, async: o.async, cache: false }) .done(function (data, st, xhr) { var i = 0, j = 0, k = 0; //var data = $.parseXML(data.responseText); if (o.metadatatype === 'json' || o.metadatatype === 'jsonp') { data = $.jgrid.odataHelper.resolveJsonReferences(data); } mdata = $self.triggerHandler("jqGridODataParseMetadata", data); if (!mdata && $.isFunction(o.parsemetadatafunc)) { mdata = o.parsemetadatafunc(data, st, xhr); } if (!mdata) { mdata = $.jgrid.odataHelper.parseMetadata(data, o.metadatatype); if (mdata) { coldata = $self.triggerHandler("jqGridODataParseColumns", [o, mdata]); if (!coldata && $.isFunction(o.parsecolfunc)) { coldata = o.parsecolfunc(o, mdata); } if (!coldata) { coldata = {}; for (i in mdata) { if (mdata.hasOwnProperty(i) && i) { coldata[i] = $self.jqGrid('parseColumns', mdata[i], o.expandable); } } } } } else { coldata = mdata; } if (coldata) { for (k in coldata) { if (coldata.hasOwnProperty(k) && k) { for (i = 0; i < p.colModel.length; i++) { for (j = 0; j < coldata[k].length; j++) { if (coldata[k][j].name === p.colModel[i].name) { $.extend(true, coldata[k][j], p.colModel[i]); break; } } } } } p.colModel = coldata[o.entitySet]; if (!p.colModel) { if ($.isFunction(o.errorfunc)) { o.errorfunc({ data: data, status: st, xhr: xhr }, 'EntitySet ' + o.entitySet + ' is not found'); } } if (!p.odata) { p.odata = { iscollection: true }; } p.odata.subgridCols = coldata; if ($.isFunction(o.successfunc)) { o.successfunc(); } } else { if ($.isFunction(o.errorfunc)) { o.errorfunc({ data: data, status: st, xhr: xhr }, 'parse $metadata error'); } } }) .fail(function (xhr, err, code) { if ($.isFunction(o.errorfunc)) { var parsedError = $.jgrid.odataHelper.loadError(xhr, err, code); o.errorfunc({ xhr: xhr, error: err, code: code }, parsedError); } }); return coldata; } //TODO: make function that checks allowed types of "odata.metadata" /*getAllowedDataTypes: function(url, callback) { $.ajax({ url: url, type: 'HEAD' }) .done(function (data, st, xhr) { if($.isFunction(callback)) { var result = []; callback(result); } }); }*/ }); }(jQuery));
gswalden/jsdelivr
files/free-jqgrid/4.11.1/plugins/grid.odata.js
JavaScript
mit
60,460
/* Copyright (C) 2008 Gregoire Gentil <[email protected]> Portions Copyright (C) 2009 Howard Chu <[email protected]> This file adds an optimized vo output to mplayer for the OMAP platform. This is a first pass and an attempt to help to improve media playing on the OMAP platform. The usual disclaimer comes here: this code is provided without any warranty. Many bugs and issues still exist. Feed-back is welcome. This output uses the yuv420_to_yuv422 conversion from Mans Rullgard, and is heavily inspired from the work of Siarhei Siamashka. I would like to thank those two persons here, without them this code would certainly not exist. Two options of the output are available: fb_overlay_only (disabled by default): only the overlay is drawn. X11 stuff is ignored. dbl_buffer (disabled by default): add double buffering. Some tearsync flags are probably missing in the code. Syntax is the following: mplayer -ao alsa -vo omapfb /test.avi mplayer -nosound -vo omapfb:fb_overlay_only:dbl_buffer /test.avi You need to have two planes on your system. On beagleboard, it means something like: video=omapfb:vram:2M,vram:4M Known issues: 1) A green line or some vertical lines (if mplayer decides to draw bands instead of frame) may appear. It's an interpolation bug in the color conversion that needs to be fixed 2) The color conversion accepts only 16-pixel multiple for width and height. 3) The scaling down is disabled as the scaling down kernel patch for the OMAP3 platform doesn't seem to work yet. * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> #include <sys/mman.h> #include <sys/ioctl.h> #include <linux/fb.h> #include "config.h" #include "video_out.h" #include "video_out_internal.h" #include "fastmemcpy.h" #include "sub.h" #include "mp_msg.h" #include "omapfb.h" #include "x11_common.h" #include "libswscale/swscale.h" #include "libmpcodecs/vf_scale.h" #include "libavcodec/avcodec.h" #include "aspect.h" #include "subopt-helper.h" #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xatom.h> #include "wskeys.h" static vo_info_t info = { "omapfb video driver", "omapfb", "", "" }; LIBVO_EXTERN(omapfb) static int fb_overlay_only = 0; // if set, we need only framebuffer overlay, but do not need any x11 code static int dbl_buffer = 0; static int fullscreen_flag = 0; static int plane_ready = 0; static uint32_t drwX, drwY; extern void yuv420_to_yuv422(uint8_t *yuv, uint8_t *y, uint8_t *u, uint8_t *v, int w, int h, int yw, int cw, int dw); static struct fb_var_screeninfo sinfo_p0; static struct fb_var_screeninfo sinfo; static struct fb_var_screeninfo sinfo2; static struct fb_fix_screeninfo finfo; static struct omapfb_mem_info minfo; static struct omapfb_plane_info pinfo; static int xoff, yoff; static struct { unsigned x; unsigned y; uint8_t *buf; } fb_pages[2]; static int dev_fd = -1; static int fb_page_flip = 0; static int page = 0; static void omapfb_update(int x, int y, int out_w, int out_h, int show); extern void mplayer_put_key( int code ); #include "osdep/keycodes.h" #define TRANSPARENT_COLOR_KEY 0xff0 static Display *display = NULL; // pointer to X Display structure. static int screen_num; // number of screen to place the window on. static Window win = 0; static Window parent = 0; // pointer to the newly created window. /* This is used to intercept window closing requests. */ static Atom wm_delete_window; void vo_calc_drwXY(uint32_t *drwX, uint32_t *drwY) { *drwX = *drwY = 0; if (vo_fs) { aspect(&vo_dwidth, &vo_dheight, A_ZOOM); vo_dwidth = FFMIN(vo_dwidth, vo_screenwidth); vo_dheight = FFMIN(vo_dheight, vo_screenheight); *drwX = (vo_screenwidth - vo_dwidth) / 2; *drwY = (vo_screenheight - vo_dheight) / 2; mp_msg(MSGT_VO, MSGL_V, "[vo-fs] dx: %d dy: %d dw: %d dh: %d\n", *drwX, *drwY, vo_dwidth, vo_dheight); } else if (WinID == 0) { *drwX = vo_dx; *drwY = vo_dy; } } static void getPrimaryPlaneInfo() { int dev_fd = open("/dev/fb0", O_RDWR); if (dev_fd == -1) { mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Error /dev/fb0\n"); return -1; } ioctl(dev_fd, FBIOGET_VSCREENINFO, &sinfo_p0); close(dev_fd); } /** * Function to get the offset to be used when in windowed mode * or when using -wid option */ static void x11_get_window_abs_position(Display *display, Window window, int *wx, int *wy, int *ww, int *wh) { Window root, parent; Window *child; unsigned int n_children; XWindowAttributes attribs; /* Get window attributes */ XGetWindowAttributes(display, window, &attribs); /* Get relative position of given window */ *wx = attribs.x; *wy = attribs.y; if (ww) *ww = attribs.width; if (wh) *wh = attribs.height; /* Query window tree information */ XQueryTree(display, window, &root, &parent, &child, &n_children); if (parent) { int x, y; /* If we have a parent we must go there and discover his position*/ x11_get_window_abs_position(display, parent, &x, &y, NULL, NULL); *wx += x; *wy += y; } /* If we had children, free it */ if(n_children) XFree(child); } static void x11_check_events(void) { int e = vo_x11_check_events(mDisplay); if (e & VO_EVENT_RESIZE) vo_calc_drwXY(&drwX, &drwY); if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) { vo_xv_draw_colorkey(drwX, drwY, vo_dwidth - 1, vo_dheight - 1); omapfb_update(0, 0, 0, 0, 1); } } static void x11_uninit() { if (display) { XCloseDisplay(display); display = NULL; } } /** * Initialize framebuffer */ static int preinit(const char *arg) { opt_t subopts[] = { {"fb_overlay_only", OPT_ARG_BOOL, &fb_overlay_only, NULL}, {"dbl_buffer", OPT_ARG_BOOL, &dbl_buffer, NULL}, {NULL} }; if (subopt_parse(arg, subopts) != 0) { mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] unknown suboptions: %s\n", arg); return -1; } getPrimaryPlaneInfo(); dev_fd = open("/dev/fb1", O_RDWR); if (dev_fd == -1) { mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Error /dev/fb1\n"); return -1; } ioctl(dev_fd, FBIOGET_VSCREENINFO, &sinfo); ioctl(dev_fd, OMAPFB_QUERY_PLANE, &pinfo); ioctl(dev_fd, OMAPFB_QUERY_MEM, &minfo); if (!fb_overlay_only && !vo_init()) { mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Could not open X, overlay only...\n"); fb_overlay_only = 1; } return 0; } static void omapfb_update(int x, int y, int out_w, int out_h, int show) { int xres, yres; if (!fb_overlay_only) x11_get_window_abs_position(mDisplay, vo_window, &x, &y, &out_w, &out_h); /* Check for new screen rotation */ ioctl(dev_fd, FBIOGET_VSCREENINFO, &sinfo2); if (sinfo2.rotate != sinfo_p0.rotate) getPrimaryPlaneInfo(); if ( (!x && !y && !out_w && !out_h) || (out_w < sinfo.xres_virtual / 4) || (out_h < sinfo.yres_virtual / 4) || /* HW can't scale down by more than 4x */ (out_w > sinfo.xres_virtual * 8) || (out_h > sinfo.yres_virtual * 8) ) { /* HW can't scale up by more than 8x */ pinfo.enabled = 0; pinfo.pos_x = 0; pinfo.pos_y = 0; ioctl(dev_fd, OMAPFB_SETUP_PLANE, &pinfo); return; } xres = sinfo.xres_virtual; yres = sinfo.yres_virtual; /* Handle clipping: if the left or top edge of the window goes * offscreen, clamp the overlay to the left or top edge of the * screen, and set the difference into the frame offset. Also * decrease the overlay size by the offset. The offset must * take window scaling into account as well. * * Likewise, if the right or bottom edge of the window goes * offscreen, clamp the overlay to the right or bottom edge of * the screen, and decrease the overlay size accordingly. The * hardware will truncate the output accordingly, so no offset * is needed. Also take window scaling into account. -- hyc */ if (x < 0) { /* clamp to left edge */ xoff = -x; if (out_w != sinfo.xres_virtual) { /* account for scaling */ xoff *= sinfo.xres_virtual; xoff /= out_w; } xres -= xoff; out_w += x; x = 0; } else { xoff = 0; if (x + out_w > sinfo_p0.xres) { /* clamp to right edge */ int diff = sinfo_p0.xres - x; if (out_w != sinfo.xres_virtual) { /* account for scaling */ xres = diff * sinfo.xres_virtual; xres /= out_w; } else { xres = diff; } out_w = diff; } } if (y < 0) { /* clamp to top edge - this seldom occurs since the window * titlebar is usually forced to stay visible */ yoff = -y; if (out_h != sinfo.yres_virtual) { /* account for scaling */ yoff *= sinfo.yres_virtual; yoff /= out_h; } yres -= yoff; out_h += y; y = 0; } else { yoff = 0; if (y + out_h > sinfo_p0.yres) { /* clamp to bottom edge */ int diff = sinfo_p0.yres - y; if (out_h != sinfo.yres_virtual) { /* account for scaling */ yres = diff * sinfo.yres_virtual; yres /= out_h; } else { yres = diff; } out_h = diff; } } if (xoff & 1) xoff++; if (xres & 1) xres--; pinfo.enabled = show; pinfo.pos_x = x; pinfo.pos_y = y; pinfo.out_width = out_w; pinfo.out_height = out_h; sinfo.xoffset = fb_pages[page].x + xoff; sinfo.yoffset = fb_pages[page].y + yoff; /* If we had to change the overlay dimensions, update it */ if (xres != sinfo2.xres || yres != sinfo2.yres || sinfo.xoffset != sinfo2.xoffset || sinfo.yoffset != sinfo2.yoffset) { sinfo.xres = xres; sinfo.yres = yres; sinfo.rotate = sinfo2.rotate; ioctl(dev_fd, FBIOPUT_VSCREENINFO, &sinfo); } ioctl(dev_fd, OMAPFB_SETUP_PLANE, &pinfo); } static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) { uint8_t *fbmem; int i; struct omapfb_color_key color_key; XVisualInfo vinfo; XSetWindowAttributes xswa; XWindowAttributes attribs; unsigned long xswamask; int depth; Window root, parent; Window *child; unsigned int n_children; fullscreen_flag = flags & VOFLAG_FULLSCREEN; if (!fb_overlay_only) { if (!title) title = "MPlayer OMAPFB (X11/FB) render"; XGetWindowAttributes(mDisplay, mRootWin, &attribs); depth = attribs.depth; if (depth != 15 && depth != 16 && depth != 24 && depth != 32) depth = 24; XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); xswa.border_pixel = 0; xswa.background_pixel = xv_colorkey = TRANSPARENT_COLOR_KEY; xswamask = CWBackPixel | CWBorderPixel; xv_ck_info.method = CK_METHOD_BACKGROUND; vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, vo_dwidth, vo_dheight, flags, CopyFromParent, "omapfb", title); XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); /* Need to receive events on the parent window -- so when it is moved / resized / etc., we know. */ if(WinID > 0) { /* Query window tree information */ XQueryTree(mDisplay, vo_window, &root, &parent, &child, &n_children); if (n_children) XFree(child); XUnmapWindow(mDisplay, vo_window); if (parent) XSelectInput(mDisplay, parent, StructureNotifyMask); XMapWindow(mDisplay, vo_window); } vo_calc_drwXY(&drwX, &drwY); vo_xv_draw_colorkey(drwX, drwY, vo_dwidth - 1, vo_dheight - 1); } fbmem = mmap(NULL, minfo.size, PROT_READ|PROT_WRITE, MAP_SHARED, dev_fd, 0); if (fbmem == MAP_FAILED) { mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Error mmap\n"); return -1; } for (i = 0; i < minfo.size / 4; i++) ((uint32_t*)fbmem)[i] = 0x80008000; sinfo.xres = width & ~15; sinfo.yres = height & ~15; sinfo.xoffset = 0; sinfo.yoffset = 0; sinfo.nonstd = OMAPFB_COLOR_YUY422; fb_pages[0].x = 0; fb_pages[0].y = 0; fb_pages[0].buf = fbmem; if (dbl_buffer && minfo.size >= sinfo.xres * sinfo.yres * 2) { sinfo.xres_virtual = sinfo.xres; sinfo.yres_virtual = sinfo.yres * 2; fb_pages[1].x = 0; fb_pages[1].y = sinfo.yres; fb_pages[1].buf = fbmem + sinfo.xres * sinfo.yres * 2; fb_page_flip = 1; } else { sinfo.xres_virtual = sinfo.xres; sinfo.yres_virtual = sinfo.yres; fb_page_flip = 0; } ioctl(dev_fd, FBIOPUT_VSCREENINFO, &sinfo); ioctl(dev_fd, FBIOGET_FSCREENINFO, &finfo); if (WinID <= 0) { if (fullscreen_flag) { omapfb_update(0, 0, sinfo_p0.xres, sinfo_p0.yres, 1); } else { omapfb_update(sinfo_p0.xres / 2 - sinfo.xres / 2, sinfo_p0.yres / 2 - sinfo.yres / 2, sinfo.xres, sinfo.yres, 1); } } color_key.channel_out = OMAPFB_CHANNEL_OUT_LCD; color_key.background = 0x0; color_key.trans_key = TRANSPARENT_COLOR_KEY; if (fb_overlay_only) color_key.key_type = OMAPFB_COLOR_KEY_DISABLED; else color_key.key_type = OMAPFB_COLOR_KEY_GFX_DST; ioctl(dev_fd, OMAPFB_SET_COLOR_KEY, &color_key); plane_ready = 1; return 0; } static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigned char *srca, int stride) { vo_draw_alpha_yuy2(w, h, src, srca, stride, fb_pages[page].buf + y0 * finfo.line_length + x0 * 2, finfo.line_length); } static void draw_osd(void) { vo_draw_text(sinfo.xres, sinfo.yres, draw_alpha); } static int draw_frame(uint8_t *src[]) { return 1; } static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y) { if (x!=0) return 0; if (!plane_ready) return 0; ioctl(dev_fd, OMAPFB_SYNC_GFX); yuv420_to_yuv422(fb_pages[page].buf + y * finfo.line_length, src[0], src[1], src[2], w & ~15, h, stride[0], stride[1], finfo.line_length); return 0; } static void flip_page(void) { if (fb_page_flip) { sinfo.xoffset = fb_pages[page].x + xoff; sinfo.yoffset = fb_pages[page].y + yoff; ioctl(dev_fd, FBIOPAN_DISPLAY, &sinfo); page ^= fb_page_flip; } } static int query_format(uint32_t format) { // For simplicity pretend that we can only do YV12, support for // other formats can be added quite easily if/when needed if (format != IMGFMT_YV12) return 0; return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | VFCAP_SWSCALE | VFCAP_ACCEPT_STRIDE; } /** * Uninitialize framebuffer */ static void uninit() { pinfo.enabled = 0; ioctl(dev_fd, OMAPFB_SETUP_PLANE, &pinfo); if (!fb_overlay_only) { struct omapfb_color_key color_key; color_key.channel_out = OMAPFB_CHANNEL_OUT_LCD; color_key.key_type = OMAPFB_COLOR_KEY_DISABLED; ioctl(dev_fd, OMAPFB_SET_COLOR_KEY, &color_key); } close(dev_fd); if (!fb_overlay_only) x11_uninit(); } static int control(uint32_t request, void *data, ...) { switch (request) { case VOCTRL_QUERY_FORMAT: return query_format(*((uint32_t*)data)); case VOCTRL_FULLSCREEN: { if (WinID > 0) return VO_FALSE; if (fullscreen_flag) { if (!fb_overlay_only) vo_x11_fullscreen(); fullscreen_flag = 0; omapfb_update(sinfo_p0.xres / 2 - sinfo.xres / 2, sinfo_p0.yres / 2 - sinfo.yres / 2, sinfo.xres, sinfo.yres, 1); } else { if (!fb_overlay_only) vo_x11_fullscreen(); fullscreen_flag = 1; omapfb_update(0, 0, sinfo_p0.xres, sinfo_p0.yres, 1); } return VO_TRUE; } case VOCTRL_UPDATE_SCREENINFO: update_xinerama_info(); return VO_TRUE; } return VO_NOTIMPL; } static void check_events(void) { if (!fb_overlay_only) x11_check_events(); }
demsey/openenigma2
recipes/mplayer/files/vo_omapfb.c
C
mit
17,496
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ export * from './public_api';
gkalpak/angular
packages/upgrade/static/testing/index.ts
TypeScript
mit
233
<?php /* * This file is part of the Sylius package. * * (c) Paweł Jędrzejewski * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Sylius\Bundle\ThemeBundle\Loader; use Sylius\Bundle\ThemeBundle\Model\ThemeInterface; /** * @author Kamil Kokot <[email protected]> */ final class CircularDependencyChecker implements CircularDependencyCheckerInterface { /** * {@inheritdoc} */ public function check(ThemeInterface $theme, array $previousThemes = []) { if (0 === count($theme->getParents())) { return; } $previousThemes = array_merge($previousThemes, [$theme]); foreach ($theme->getParents() as $parent) { if (in_array($parent, $previousThemes, true)) { throw new CircularDependencyFoundException(array_merge($previousThemes, [$parent])); } $this->check($parent, $previousThemes); } } }
psyray/Sylius
src/Sylius/Bundle/ThemeBundle/Loader/CircularDependencyChecker.php
PHP
mit
1,024
// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) // Copyright(c) 2015-17 Intel Corporation. /* * Cadence SoundWire Master module * Used by Master driver */ #include <linux/delay.h> #include <linux/device.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/mod_devicetable.h> #include <linux/soundwire/sdw_registers.h> #include <linux/soundwire/sdw.h> #include "bus.h" #include "cadence_master.h" #define CDNS_MCP_CONFIG 0x0 #define CDNS_MCP_CONFIG_MCMD_RETRY GENMASK(27, 24) #define CDNS_MCP_CONFIG_MPREQ_DELAY GENMASK(20, 16) #define CDNS_MCP_CONFIG_MMASTER BIT(7) #define CDNS_MCP_CONFIG_BUS_REL BIT(6) #define CDNS_MCP_CONFIG_SNIFFER BIT(5) #define CDNS_MCP_CONFIG_SSPMOD BIT(4) #define CDNS_MCP_CONFIG_CMD BIT(3) #define CDNS_MCP_CONFIG_OP GENMASK(2, 0) #define CDNS_MCP_CONFIG_OP_NORMAL 0 #define CDNS_MCP_CONTROL 0x4 #define CDNS_MCP_CONTROL_RST_DELAY GENMASK(10, 8) #define CDNS_MCP_CONTROL_CMD_RST BIT(7) #define CDNS_MCP_CONTROL_SOFT_RST BIT(6) #define CDNS_MCP_CONTROL_SW_RST BIT(5) #define CDNS_MCP_CONTROL_HW_RST BIT(4) #define CDNS_MCP_CONTROL_CLK_PAUSE BIT(3) #define CDNS_MCP_CONTROL_CLK_STOP_CLR BIT(2) #define CDNS_MCP_CONTROL_CMD_ACCEPT BIT(1) #define CDNS_MCP_CONTROL_BLOCK_WAKEUP BIT(0) #define CDNS_MCP_CMDCTRL 0x8 #define CDNS_MCP_SSPSTAT 0xC #define CDNS_MCP_FRAME_SHAPE 0x10 #define CDNS_MCP_FRAME_SHAPE_INIT 0x14 #define CDNS_MCP_CONFIG_UPDATE 0x18 #define CDNS_MCP_CONFIG_UPDATE_BIT BIT(0) #define CDNS_MCP_PHYCTRL 0x1C #define CDNS_MCP_SSP_CTRL0 0x20 #define CDNS_MCP_SSP_CTRL1 0x28 #define CDNS_MCP_CLK_CTRL0 0x30 #define CDNS_MCP_CLK_CTRL1 0x38 #define CDNS_MCP_STAT 0x40 #define CDNS_MCP_STAT_ACTIVE_BANK BIT(20) #define CDNS_MCP_STAT_CLK_STOP BIT(16) #define CDNS_MCP_INTSTAT 0x44 #define CDNS_MCP_INTMASK 0x48 #define CDNS_MCP_INT_IRQ BIT(31) #define CDNS_MCP_INT_WAKEUP BIT(16) #define CDNS_MCP_INT_SLAVE_RSVD BIT(15) #define CDNS_MCP_INT_SLAVE_ALERT BIT(14) #define CDNS_MCP_INT_SLAVE_ATTACH BIT(13) #define CDNS_MCP_INT_SLAVE_NATTACH BIT(12) #define CDNS_MCP_INT_SLAVE_MASK GENMASK(15, 12) #define CDNS_MCP_INT_DPINT BIT(11) #define CDNS_MCP_INT_CTRL_CLASH BIT(10) #define CDNS_MCP_INT_DATA_CLASH BIT(9) #define CDNS_MCP_INT_CMD_ERR BIT(7) #define CDNS_MCP_INT_RX_WL BIT(2) #define CDNS_MCP_INT_TXE BIT(1) #define CDNS_MCP_INTSET 0x4C #define CDNS_SDW_SLAVE_STAT 0x50 #define CDNS_MCP_SLAVE_STAT_MASK BIT(1, 0) #define CDNS_MCP_SLAVE_INTSTAT0 0x54 #define CDNS_MCP_SLAVE_INTSTAT1 0x58 #define CDNS_MCP_SLAVE_INTSTAT_NPRESENT BIT(0) #define CDNS_MCP_SLAVE_INTSTAT_ATTACHED BIT(1) #define CDNS_MCP_SLAVE_INTSTAT_ALERT BIT(2) #define CDNS_MCP_SLAVE_INTSTAT_RESERVED BIT(3) #define CDNS_MCP_SLAVE_STATUS_BITS GENMASK(3, 0) #define CDNS_MCP_SLAVE_STATUS_NUM 4 #define CDNS_MCP_SLAVE_INTMASK0 0x5C #define CDNS_MCP_SLAVE_INTMASK1 0x60 #define CDNS_MCP_SLAVE_INTMASK0_MASK GENMASK(30, 0) #define CDNS_MCP_SLAVE_INTMASK1_MASK GENMASK(16, 0) #define CDNS_MCP_PORT_INTSTAT 0x64 #define CDNS_MCP_PDI_STAT 0x6C #define CDNS_MCP_FIFOLEVEL 0x78 #define CDNS_MCP_FIFOSTAT 0x7C #define CDNS_MCP_RX_FIFO_AVAIL GENMASK(5, 0) #define CDNS_MCP_CMD_BASE 0x80 #define CDNS_MCP_RESP_BASE 0x80 #define CDNS_MCP_CMD_LEN 0x20 #define CDNS_MCP_CMD_WORD_LEN 0x4 #define CDNS_MCP_CMD_SSP_TAG BIT(31) #define CDNS_MCP_CMD_COMMAND GENMASK(30, 28) #define CDNS_MCP_CMD_DEV_ADDR GENMASK(27, 24) #define CDNS_MCP_CMD_REG_ADDR_H GENMASK(23, 16) #define CDNS_MCP_CMD_REG_ADDR_L GENMASK(15, 8) #define CDNS_MCP_CMD_REG_DATA GENMASK(7, 0) #define CDNS_MCP_CMD_READ 2 #define CDNS_MCP_CMD_WRITE 3 #define CDNS_MCP_RESP_RDATA GENMASK(15, 8) #define CDNS_MCP_RESP_ACK BIT(0) #define CDNS_MCP_RESP_NACK BIT(1) #define CDNS_DP_SIZE 128 #define CDNS_DPN_B0_CONFIG(n) (0x100 + CDNS_DP_SIZE * (n)) #define CDNS_DPN_B0_CH_EN(n) (0x104 + CDNS_DP_SIZE * (n)) #define CDNS_DPN_B0_SAMPLE_CTRL(n) (0x108 + CDNS_DP_SIZE * (n)) #define CDNS_DPN_B0_OFFSET_CTRL(n) (0x10C + CDNS_DP_SIZE * (n)) #define CDNS_DPN_B0_HCTRL(n) (0x110 + CDNS_DP_SIZE * (n)) #define CDNS_DPN_B0_ASYNC_CTRL(n) (0x114 + CDNS_DP_SIZE * (n)) #define CDNS_DPN_B1_CONFIG(n) (0x118 + CDNS_DP_SIZE * (n)) #define CDNS_DPN_B1_CH_EN(n) (0x11C + CDNS_DP_SIZE * (n)) #define CDNS_DPN_B1_SAMPLE_CTRL(n) (0x120 + CDNS_DP_SIZE * (n)) #define CDNS_DPN_B1_OFFSET_CTRL(n) (0x124 + CDNS_DP_SIZE * (n)) #define CDNS_DPN_B1_HCTRL(n) (0x128 + CDNS_DP_SIZE * (n)) #define CDNS_DPN_B1_ASYNC_CTRL(n) (0x12C + CDNS_DP_SIZE * (n)) #define CDNS_DPN_CONFIG_BPM BIT(18) #define CDNS_DPN_CONFIG_BGC GENMASK(17, 16) #define CDNS_DPN_CONFIG_WL GENMASK(12, 8) #define CDNS_DPN_CONFIG_PORT_DAT GENMASK(3, 2) #define CDNS_DPN_CONFIG_PORT_FLOW GENMASK(1, 0) #define CDNS_DPN_SAMPLE_CTRL_SI GENMASK(15, 0) #define CDNS_DPN_OFFSET_CTRL_1 GENMASK(7, 0) #define CDNS_DPN_OFFSET_CTRL_2 GENMASK(15, 8) #define CDNS_DPN_HCTRL_HSTOP GENMASK(3, 0) #define CDNS_DPN_HCTRL_HSTART GENMASK(7, 4) #define CDNS_DPN_HCTRL_LCTRL GENMASK(10, 8) #define CDNS_PORTCTRL 0x130 #define CDNS_PORTCTRL_DIRN BIT(7) #define CDNS_PORTCTRL_BANK_INVERT BIT(8) #define CDNS_PORT_OFFSET 0x80 #define CDNS_PDI_CONFIG(n) (0x1100 + (n) * 16) #define CDNS_PDI_CONFIG_SOFT_RESET BIT(24) #define CDNS_PDI_CONFIG_CHANNEL GENMASK(15, 8) #define CDNS_PDI_CONFIG_PORT GENMASK(4, 0) /* Driver defaults */ #define CDNS_DEFAULT_CLK_DIVIDER 0 #define CDNS_DEFAULT_FRAME_SHAPE 0x30 #define CDNS_DEFAULT_SSP_INTERVAL 0x18 #define CDNS_TX_TIMEOUT 2000 #define CDNS_PCM_PDI_OFFSET 0x2 #define CDNS_PDM_PDI_OFFSET 0x6 #define CDNS_SCP_RX_FIFOLEVEL 0x2 /* * register accessor helpers */ static inline u32 cdns_readl(struct sdw_cdns *cdns, int offset) { return readl(cdns->registers + offset); } static inline void cdns_writel(struct sdw_cdns *cdns, int offset, u32 value) { writel(value, cdns->registers + offset); } static inline void cdns_updatel(struct sdw_cdns *cdns, int offset, u32 mask, u32 val) { u32 tmp; tmp = cdns_readl(cdns, offset); tmp = (tmp & ~mask) | val; cdns_writel(cdns, offset, tmp); } static int cdns_clear_bit(struct sdw_cdns *cdns, int offset, u32 value) { int timeout = 10; u32 reg_read; writel(value, cdns->registers + offset); /* Wait for bit to be self cleared */ do { reg_read = readl(cdns->registers + offset); if ((reg_read & value) == 0) return 0; timeout--; udelay(50); } while (timeout != 0); return -EAGAIN; } /* * IO Calls */ static enum sdw_command_response cdns_fill_msg_resp( struct sdw_cdns *cdns, struct sdw_msg *msg, int count, int offset) { int nack = 0, no_ack = 0; int i; /* check message response */ for (i = 0; i < count; i++) { if (!(cdns->response_buf[i] & CDNS_MCP_RESP_ACK)) { no_ack = 1; dev_dbg(cdns->dev, "Msg Ack not received\n"); if (cdns->response_buf[i] & CDNS_MCP_RESP_NACK) { nack = 1; dev_err(cdns->dev, "Msg NACK received\n"); } } } if (nack) { dev_err(cdns->dev, "Msg NACKed for Slave %d\n", msg->dev_num); return SDW_CMD_FAIL; } else if (no_ack) { dev_dbg(cdns->dev, "Msg ignored for Slave %d\n", msg->dev_num); return SDW_CMD_IGNORED; } /* fill response */ for (i = 0; i < count; i++) msg->buf[i + offset] = cdns->response_buf[i] >> SDW_REG_SHIFT(CDNS_MCP_RESP_RDATA); return SDW_CMD_OK; } static enum sdw_command_response _cdns_xfer_msg(struct sdw_cdns *cdns, struct sdw_msg *msg, int cmd, int offset, int count, bool defer) { unsigned long time; u32 base, i, data; u16 addr; /* Program the watermark level for RX FIFO */ if (cdns->msg_count != count) { cdns_writel(cdns, CDNS_MCP_FIFOLEVEL, count); cdns->msg_count = count; } base = CDNS_MCP_CMD_BASE; addr = msg->addr; for (i = 0; i < count; i++) { data = msg->dev_num << SDW_REG_SHIFT(CDNS_MCP_CMD_DEV_ADDR); data |= cmd << SDW_REG_SHIFT(CDNS_MCP_CMD_COMMAND); data |= addr++ << SDW_REG_SHIFT(CDNS_MCP_CMD_REG_ADDR_L); if (msg->flags == SDW_MSG_FLAG_WRITE) data |= msg->buf[i + offset]; data |= msg->ssp_sync << SDW_REG_SHIFT(CDNS_MCP_CMD_SSP_TAG); cdns_writel(cdns, base, data); base += CDNS_MCP_CMD_WORD_LEN; } if (defer) return SDW_CMD_OK; /* wait for timeout or response */ time = wait_for_completion_timeout(&cdns->tx_complete, msecs_to_jiffies(CDNS_TX_TIMEOUT)); if (!time) { dev_err(cdns->dev, "IO transfer timed out\n"); msg->len = 0; return SDW_CMD_TIMEOUT; } return cdns_fill_msg_resp(cdns, msg, count, offset); } static enum sdw_command_response cdns_program_scp_addr( struct sdw_cdns *cdns, struct sdw_msg *msg) { int nack = 0, no_ack = 0; unsigned long time; u32 data[2], base; int i; /* Program the watermark level for RX FIFO */ if (cdns->msg_count != CDNS_SCP_RX_FIFOLEVEL) { cdns_writel(cdns, CDNS_MCP_FIFOLEVEL, CDNS_SCP_RX_FIFOLEVEL); cdns->msg_count = CDNS_SCP_RX_FIFOLEVEL; } data[0] = msg->dev_num << SDW_REG_SHIFT(CDNS_MCP_CMD_DEV_ADDR); data[0] |= 0x3 << SDW_REG_SHIFT(CDNS_MCP_CMD_COMMAND); data[1] = data[0]; data[0] |= SDW_SCP_ADDRPAGE1 << SDW_REG_SHIFT(CDNS_MCP_CMD_REG_ADDR_L); data[1] |= SDW_SCP_ADDRPAGE2 << SDW_REG_SHIFT(CDNS_MCP_CMD_REG_ADDR_L); data[0] |= msg->addr_page1; data[1] |= msg->addr_page2; base = CDNS_MCP_CMD_BASE; cdns_writel(cdns, base, data[0]); base += CDNS_MCP_CMD_WORD_LEN; cdns_writel(cdns, base, data[1]); time = wait_for_completion_timeout(&cdns->tx_complete, msecs_to_jiffies(CDNS_TX_TIMEOUT)); if (!time) { dev_err(cdns->dev, "SCP Msg trf timed out\n"); msg->len = 0; return SDW_CMD_TIMEOUT; } /* check response the writes */ for (i = 0; i < 2; i++) { if (!(cdns->response_buf[i] & CDNS_MCP_RESP_ACK)) { no_ack = 1; dev_err(cdns->dev, "Program SCP Ack not received"); if (cdns->response_buf[i] & CDNS_MCP_RESP_NACK) { nack = 1; dev_err(cdns->dev, "Program SCP NACK received"); } } } /* For NACK, NO ack, don't return err if we are in Broadcast mode */ if (nack) { dev_err(cdns->dev, "SCP_addrpage NACKed for Slave %d", msg->dev_num); return SDW_CMD_FAIL; } else if (no_ack) { dev_dbg(cdns->dev, "SCP_addrpage ignored for Slave %d", msg->dev_num); return SDW_CMD_IGNORED; } return SDW_CMD_OK; } static int cdns_prep_msg(struct sdw_cdns *cdns, struct sdw_msg *msg, int *cmd) { int ret; if (msg->page) { ret = cdns_program_scp_addr(cdns, msg); if (ret) { msg->len = 0; return ret; } } switch (msg->flags) { case SDW_MSG_FLAG_READ: *cmd = CDNS_MCP_CMD_READ; break; case SDW_MSG_FLAG_WRITE: *cmd = CDNS_MCP_CMD_WRITE; break; default: dev_err(cdns->dev, "Invalid msg cmd: %d\n", msg->flags); return -EINVAL; } return 0; } static enum sdw_command_response cdns_xfer_msg(struct sdw_bus *bus, struct sdw_msg *msg) { struct sdw_cdns *cdns = bus_to_cdns(bus); int cmd = 0, ret, i; ret = cdns_prep_msg(cdns, msg, &cmd); if (ret) return SDW_CMD_FAIL_OTHER; for (i = 0; i < msg->len / CDNS_MCP_CMD_LEN; i++) { ret = _cdns_xfer_msg(cdns, msg, cmd, i * CDNS_MCP_CMD_LEN, CDNS_MCP_CMD_LEN, false); if (ret < 0) goto exit; } if (!(msg->len % CDNS_MCP_CMD_LEN)) goto exit; ret = _cdns_xfer_msg(cdns, msg, cmd, i * CDNS_MCP_CMD_LEN, msg->len % CDNS_MCP_CMD_LEN, false); exit: return ret; } static enum sdw_command_response cdns_xfer_msg_defer(struct sdw_bus *bus, struct sdw_msg *msg, struct sdw_defer *defer) { struct sdw_cdns *cdns = bus_to_cdns(bus); int cmd = 0, ret; /* for defer only 1 message is supported */ if (msg->len > 1) return -ENOTSUPP; ret = cdns_prep_msg(cdns, msg, &cmd); if (ret) return SDW_CMD_FAIL_OTHER; cdns->defer = defer; cdns->defer->length = msg->len; return _cdns_xfer_msg(cdns, msg, cmd, 0, msg->len, true); } static enum sdw_command_response cdns_reset_page_addr(struct sdw_bus *bus, unsigned int dev_num) { struct sdw_cdns *cdns = bus_to_cdns(bus); struct sdw_msg msg; /* Create dummy message with valid device number */ memset(&msg, 0, sizeof(msg)); msg.dev_num = dev_num; return cdns_program_scp_addr(cdns, &msg); } /* * IRQ handling */ static void cdns_read_response(struct sdw_cdns *cdns) { u32 num_resp, cmd_base; int i; num_resp = cdns_readl(cdns, CDNS_MCP_FIFOSTAT); num_resp &= CDNS_MCP_RX_FIFO_AVAIL; cmd_base = CDNS_MCP_CMD_BASE; for (i = 0; i < num_resp; i++) { cdns->response_buf[i] = cdns_readl(cdns, cmd_base); cmd_base += CDNS_MCP_CMD_WORD_LEN; } } static int cdns_update_slave_status(struct sdw_cdns *cdns, u32 slave0, u32 slave1) { enum sdw_slave_status status[SDW_MAX_DEVICES + 1]; bool is_slave = false; u64 slave, mask; int i, set_status; /* combine the two status */ slave = ((u64)slave1 << 32) | slave0; memset(status, 0, sizeof(status)); for (i = 0; i <= SDW_MAX_DEVICES; i++) { mask = (slave >> (i * CDNS_MCP_SLAVE_STATUS_NUM)) & CDNS_MCP_SLAVE_STATUS_BITS; if (!mask) continue; is_slave = true; set_status = 0; if (mask & CDNS_MCP_SLAVE_INTSTAT_RESERVED) { status[i] = SDW_SLAVE_RESERVED; set_status++; } if (mask & CDNS_MCP_SLAVE_INTSTAT_ATTACHED) { status[i] = SDW_SLAVE_ATTACHED; set_status++; } if (mask & CDNS_MCP_SLAVE_INTSTAT_ALERT) { status[i] = SDW_SLAVE_ALERT; set_status++; } if (mask & CDNS_MCP_SLAVE_INTSTAT_NPRESENT) { status[i] = SDW_SLAVE_UNATTACHED; set_status++; } /* first check if Slave reported multiple status */ if (set_status > 1) { dev_warn(cdns->dev, "Slave reported multiple Status: %d\n", status[i]); /* * TODO: we need to reread the status here by * issuing a PING cmd */ } } if (is_slave) return sdw_handle_slave_status(&cdns->bus, status); return 0; } /** * sdw_cdns_irq() - Cadence interrupt handler * @irq: irq number * @dev_id: irq context */ irqreturn_t sdw_cdns_irq(int irq, void *dev_id) { struct sdw_cdns *cdns = dev_id; u32 int_status; int ret = IRQ_HANDLED; /* Check if the link is up */ if (!cdns->link_up) return IRQ_NONE; int_status = cdns_readl(cdns, CDNS_MCP_INTSTAT); if (!(int_status & CDNS_MCP_INT_IRQ)) return IRQ_NONE; if (int_status & CDNS_MCP_INT_RX_WL) { cdns_read_response(cdns); if (cdns->defer) { cdns_fill_msg_resp(cdns, cdns->defer->msg, cdns->defer->length, 0); complete(&cdns->defer->complete); cdns->defer = NULL; } else complete(&cdns->tx_complete); } if (int_status & CDNS_MCP_INT_CTRL_CLASH) { /* Slave is driving bit slot during control word */ dev_err_ratelimited(cdns->dev, "Bus clash for control word\n"); int_status |= CDNS_MCP_INT_CTRL_CLASH; } if (int_status & CDNS_MCP_INT_DATA_CLASH) { /* * Multiple slaves trying to drive bit slot, or issue with * ownership of data bits or Slave gone bonkers */ dev_err_ratelimited(cdns->dev, "Bus clash for data word\n"); int_status |= CDNS_MCP_INT_DATA_CLASH; } if (int_status & CDNS_MCP_INT_SLAVE_MASK) { /* Mask the Slave interrupt and wake thread */ cdns_updatel(cdns, CDNS_MCP_INTMASK, CDNS_MCP_INT_SLAVE_MASK, 0); int_status &= ~CDNS_MCP_INT_SLAVE_MASK; ret = IRQ_WAKE_THREAD; } cdns_writel(cdns, CDNS_MCP_INTSTAT, int_status); return ret; } EXPORT_SYMBOL(sdw_cdns_irq); /** * sdw_cdns_thread() - Cadence irq thread handler * @irq: irq number * @dev_id: irq context */ irqreturn_t sdw_cdns_thread(int irq, void *dev_id) { struct sdw_cdns *cdns = dev_id; u32 slave0, slave1; dev_dbg(cdns->dev, "Slave status change\n"); slave0 = cdns_readl(cdns, CDNS_MCP_SLAVE_INTSTAT0); slave1 = cdns_readl(cdns, CDNS_MCP_SLAVE_INTSTAT1); cdns_update_slave_status(cdns, slave0, slave1); cdns_writel(cdns, CDNS_MCP_SLAVE_INTSTAT0, slave0); cdns_writel(cdns, CDNS_MCP_SLAVE_INTSTAT1, slave1); /* clear and unmask Slave interrupt now */ cdns_writel(cdns, CDNS_MCP_INTSTAT, CDNS_MCP_INT_SLAVE_MASK); cdns_updatel(cdns, CDNS_MCP_INTMASK, CDNS_MCP_INT_SLAVE_MASK, CDNS_MCP_INT_SLAVE_MASK); return IRQ_HANDLED; } EXPORT_SYMBOL(sdw_cdns_thread); /* * init routines */ static int _cdns_enable_interrupt(struct sdw_cdns *cdns) { u32 mask; cdns_writel(cdns, CDNS_MCP_SLAVE_INTMASK0, CDNS_MCP_SLAVE_INTMASK0_MASK); cdns_writel(cdns, CDNS_MCP_SLAVE_INTMASK1, CDNS_MCP_SLAVE_INTMASK1_MASK); mask = CDNS_MCP_INT_SLAVE_RSVD | CDNS_MCP_INT_SLAVE_ALERT | CDNS_MCP_INT_SLAVE_ATTACH | CDNS_MCP_INT_SLAVE_NATTACH | CDNS_MCP_INT_CTRL_CLASH | CDNS_MCP_INT_DATA_CLASH | CDNS_MCP_INT_RX_WL | CDNS_MCP_INT_IRQ | CDNS_MCP_INT_DPINT; cdns_writel(cdns, CDNS_MCP_INTMASK, mask); return 0; } /** * sdw_cdns_enable_interrupt() - Enable SDW interrupts and update config * @cdns: Cadence instance */ int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns) { int ret; _cdns_enable_interrupt(cdns); ret = cdns_clear_bit(cdns, CDNS_MCP_CONFIG_UPDATE, CDNS_MCP_CONFIG_UPDATE_BIT); if (ret < 0) dev_err(cdns->dev, "Config update timedout"); return ret; } EXPORT_SYMBOL(sdw_cdns_enable_interrupt); /** * sdw_cdns_init() - Cadence initialization * @cdns: Cadence instance */ int sdw_cdns_init(struct sdw_cdns *cdns) { u32 val; int ret; /* Exit clock stop */ ret = cdns_clear_bit(cdns, CDNS_MCP_CONTROL, CDNS_MCP_CONTROL_CLK_STOP_CLR); if (ret < 0) { dev_err(cdns->dev, "Couldn't exit from clock stop\n"); return ret; } /* Set clock divider */ val = cdns_readl(cdns, CDNS_MCP_CLK_CTRL0); val |= CDNS_DEFAULT_CLK_DIVIDER; cdns_writel(cdns, CDNS_MCP_CLK_CTRL0, val); /* Set the default frame shape */ cdns_writel(cdns, CDNS_MCP_FRAME_SHAPE_INIT, CDNS_DEFAULT_FRAME_SHAPE); /* Set SSP interval to default value */ cdns_writel(cdns, CDNS_MCP_SSP_CTRL0, CDNS_DEFAULT_SSP_INTERVAL); cdns_writel(cdns, CDNS_MCP_SSP_CTRL1, CDNS_DEFAULT_SSP_INTERVAL); /* Set cmd accept mode */ cdns_updatel(cdns, CDNS_MCP_CONTROL, CDNS_MCP_CONTROL_CMD_ACCEPT, CDNS_MCP_CONTROL_CMD_ACCEPT); /* Configure mcp config */ val = cdns_readl(cdns, CDNS_MCP_CONFIG); /* Set Max cmd retry to 15 */ val |= CDNS_MCP_CONFIG_MCMD_RETRY; /* Set frame delay between PREQ and ping frame to 15 frames */ val |= 0xF << SDW_REG_SHIFT(CDNS_MCP_CONFIG_MPREQ_DELAY); /* Disable auto bus release */ val &= ~CDNS_MCP_CONFIG_BUS_REL; /* Disable sniffer mode */ val &= ~CDNS_MCP_CONFIG_SNIFFER; /* Set cmd mode for Tx and Rx cmds */ val &= ~CDNS_MCP_CONFIG_CMD; /* Set operation to normal */ val &= ~CDNS_MCP_CONFIG_OP; val |= CDNS_MCP_CONFIG_OP_NORMAL; cdns_writel(cdns, CDNS_MCP_CONFIG, val); return 0; } EXPORT_SYMBOL(sdw_cdns_init); struct sdw_master_ops sdw_cdns_master_ops = { .read_prop = sdw_master_read_prop, .xfer_msg = cdns_xfer_msg, .xfer_msg_defer = cdns_xfer_msg_defer, .reset_page_addr = cdns_reset_page_addr, }; EXPORT_SYMBOL(sdw_cdns_master_ops); /** * sdw_cdns_probe() - Cadence probe routine * @cdns: Cadence instance */ int sdw_cdns_probe(struct sdw_cdns *cdns) { init_completion(&cdns->tx_complete); return 0; } EXPORT_SYMBOL(sdw_cdns_probe); MODULE_LICENSE("Dual BSD/GPL"); MODULE_DESCRIPTION("Cadence Soundwire Library");
HarveyHunt/linux
drivers/soundwire/cadence_master.c
C
gpl-2.0
19,043
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ /* pwdbased.hpp defines PBKDF2 from PKCS #5 */ #ifndef TAO_CRYPT_PWDBASED_HPP #define TAO_CRYPT_PWDBASED_HPP #include <string.h> #include "misc.hpp" #include "block.hpp" #include "hmac.hpp" namespace TaoCrypt { // From PKCS #5, T must be type suitable for HMAC<T> template <class T> class PBKDF2_HMAC { public: word32 MaxDerivedKeyLength() const { return 0xFFFFFFFFU;} // avoid overflow word32 DeriveKey(byte* derived, word32 dLen, const byte* pwd, word32 pLen, const byte* salt, word32 sLen, word32 iterations) const; }; template <class T> word32 PBKDF2_HMAC<T>::DeriveKey(byte* derived, word32 dLen, const byte* pwd, word32 pLen, const byte* salt, word32 sLen, word32 iterations) const { if (dLen > MaxDerivedKeyLength()) return 0; if (iterations < 0) return 0; ByteBlock buffer(T::DIGEST_SIZE); HMAC<T> hmac; hmac.SetKey(pwd, pLen); word32 i = 1; while (dLen > 0) { hmac.Update(salt, sLen); word32 j; for (j = 0; j < 4; j++) { byte b = i >> ((3-j)*8); hmac.Update(&b, 1); } hmac.Final(buffer.get_buffer()); word32 segmentLen = min(dLen, buffer.size()); memcpy(derived, buffer.get_buffer(), segmentLen); for (j = 1; j < iterations; j++) { hmac.Update(buffer.get_buffer(), buffer.size()); hmac.Final(buffer.get_buffer()); xorbuf(derived, buffer.get_buffer(), segmentLen); } derived += segmentLen; dLen -= segmentLen; i++; } return iterations; } } // naemspace #endif // TAO_CRYPT_PWDBASED_HPP
pubsubsql/notification-services
mysql/mysql-5.6.17/extra/yassl/taocrypt/include/pwdbased.hpp
C++
gpl-3.0
2,378
/* Test the `vreinterprets32_u8' ARM Neon intrinsic. */ /* This file was autogenerated by neon-testgen. */ /* { dg-do assemble } */ /* { dg-require-effective-target arm_neon_ok } */ /* { dg-options "-save-temps -O0" } */ /* { dg-add-options arm_neon } */ #include "arm_neon.h" void test_vreinterprets32_u8 (void) { int32x2_t out_int32x2_t; uint8x8_t arg0_uint8x8_t; out_int32x2_t = vreinterpret_s32_u8 (arg0_uint8x8_t); }
selmentdev/selment-toolchain
source/gcc-latest/gcc/testsuite/gcc.target/arm/neon/vreinterprets32_u8.c
C
gpl-3.0
435
# sqlalchemy/exc.py # Copyright (C) 2005-2016 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """Exceptions used with SQLAlchemy. The base exception class is :exc:`.SQLAlchemyError`. Exceptions which are raised as a result of DBAPI exceptions are all subclasses of :exc:`.DBAPIError`. """ class SQLAlchemyError(Exception): """Generic error class.""" class ArgumentError(SQLAlchemyError): """Raised when an invalid or conflicting function argument is supplied. This error generally corresponds to construction time state errors. """ class NoSuchModuleError(ArgumentError): """Raised when a dynamically-loaded module (usually a database dialect) of a particular name cannot be located.""" class NoForeignKeysError(ArgumentError): """Raised when no foreign keys can be located between two selectables during a join.""" class AmbiguousForeignKeysError(ArgumentError): """Raised when more than one foreign key matching can be located between two selectables during a join.""" class CircularDependencyError(SQLAlchemyError): """Raised by topological sorts when a circular dependency is detected. There are two scenarios where this error occurs: * In a Session flush operation, if two objects are mutually dependent on each other, they can not be inserted or deleted via INSERT or DELETE statements alone; an UPDATE will be needed to post-associate or pre-deassociate one of the foreign key constrained values. The ``post_update`` flag described at :ref:`post_update` can resolve this cycle. * In a :attr:`.MetaData.sorted_tables` operation, two :class:`.ForeignKey` or :class:`.ForeignKeyConstraint` objects mutually refer to each other. Apply the ``use_alter=True`` flag to one or both, see :ref:`use_alter`. """ def __init__(self, message, cycles, edges, msg=None): if msg is None: message += " (%s)" % ", ".join(repr(s) for s in cycles) else: message = msg SQLAlchemyError.__init__(self, message) self.cycles = cycles self.edges = edges def __reduce__(self): return self.__class__, (None, self.cycles, self.edges, self.args[0]) class CompileError(SQLAlchemyError): """Raised when an error occurs during SQL compilation""" class UnsupportedCompilationError(CompileError): """Raised when an operation is not supported by the given compiler. .. versionadded:: 0.8.3 """ def __init__(self, compiler, element_type): super(UnsupportedCompilationError, self).__init__( "Compiler %r can't render element of type %s" % (compiler, element_type)) class IdentifierError(SQLAlchemyError): """Raised when a schema name is beyond the max character limit""" class DisconnectionError(SQLAlchemyError): """A disconnect is detected on a raw DB-API connection. This error is raised and consumed internally by a connection pool. It can be raised by the :meth:`.PoolEvents.checkout` event so that the host pool forces a retry; the exception will be caught three times in a row before the pool gives up and raises :class:`~sqlalchemy.exc.InvalidRequestError` regarding the connection attempt. """ class TimeoutError(SQLAlchemyError): """Raised when a connection pool times out on getting a connection.""" class InvalidRequestError(SQLAlchemyError): """SQLAlchemy was asked to do something it can't do. This error generally corresponds to runtime state errors. """ class NoInspectionAvailable(InvalidRequestError): """A subject passed to :func:`sqlalchemy.inspection.inspect` produced no context for inspection.""" class ResourceClosedError(InvalidRequestError): """An operation was requested from a connection, cursor, or other object that's in a closed state.""" class NoSuchColumnError(KeyError, InvalidRequestError): """A nonexistent column is requested from a ``RowProxy``.""" class NoReferenceError(InvalidRequestError): """Raised by ``ForeignKey`` to indicate a reference cannot be resolved.""" class NoReferencedTableError(NoReferenceError): """Raised by ``ForeignKey`` when the referred ``Table`` cannot be located. """ def __init__(self, message, tname): NoReferenceError.__init__(self, message) self.table_name = tname def __reduce__(self): return self.__class__, (self.args[0], self.table_name) class NoReferencedColumnError(NoReferenceError): """Raised by ``ForeignKey`` when the referred ``Column`` cannot be located. """ def __init__(self, message, tname, cname): NoReferenceError.__init__(self, message) self.table_name = tname self.column_name = cname def __reduce__(self): return self.__class__, (self.args[0], self.table_name, self.column_name) class NoSuchTableError(InvalidRequestError): """Table does not exist or is not visible to a connection.""" class UnboundExecutionError(InvalidRequestError): """SQL was attempted without a database connection to execute it on.""" class DontWrapMixin(object): """A mixin class which, when applied to a user-defined Exception class, will not be wrapped inside of :exc:`.StatementError` if the error is emitted within the process of executing a statement. E.g.:: from sqlalchemy.exc import DontWrapMixin class MyCustomException(Exception, DontWrapMixin): pass class MySpecialType(TypeDecorator): impl = String def process_bind_param(self, value, dialect): if value == 'invalid': raise MyCustomException("invalid!") """ # Moved to orm.exc; compatibility definition installed by orm import until 0.6 UnmappedColumnError = None class StatementError(SQLAlchemyError): """An error occurred during execution of a SQL statement. :class:`StatementError` wraps the exception raised during execution, and features :attr:`.statement` and :attr:`.params` attributes which supply context regarding the specifics of the statement which had an issue. The wrapped exception object is available in the :attr:`.orig` attribute. """ statement = None """The string SQL statement being invoked when this exception occurred.""" params = None """The parameter list being used when this exception occurred.""" orig = None """The DBAPI exception object.""" def __init__(self, message, statement, params, orig): SQLAlchemyError.__init__(self, message) self.statement = statement self.params = params self.orig = orig self.detail = [] def add_detail(self, msg): self.detail.append(msg) def __reduce__(self): return self.__class__, (self.args[0], self.statement, self.params, self.orig) def __str__(self): from sqlalchemy.sql import util details = [SQLAlchemyError.__str__(self)] if self.statement: details.append("[SQL: %r]" % self.statement) if self.params: params_repr = util._repr_params(self.params, 10) details.append("[parameters: %r]" % params_repr) return ' '.join([ "(%s)" % det for det in self.detail ] + details) def __unicode__(self): return self.__str__() class DBAPIError(StatementError): """Raised when the execution of a database operation fails. Wraps exceptions raised by the DB-API underlying the database operation. Driver-specific implementations of the standard DB-API exception types are wrapped by matching sub-types of SQLAlchemy's :class:`DBAPIError` when possible. DB-API's ``Error`` type maps to :class:`DBAPIError` in SQLAlchemy, otherwise the names are identical. Note that there is no guarantee that different DB-API implementations will raise the same exception type for any given error condition. :class:`DBAPIError` features :attr:`~.StatementError.statement` and :attr:`~.StatementError.params` attributes which supply context regarding the specifics of the statement which had an issue, for the typical case when the error was raised within the context of emitting a SQL statement. The wrapped exception object is available in the :attr:`~.StatementError.orig` attribute. Its type and properties are DB-API implementation specific. """ @classmethod def instance(cls, statement, params, orig, dbapi_base_err, connection_invalidated=False, dialect=None): # Don't ever wrap these, just return them directly as if # DBAPIError didn't exist. if (isinstance(orig, BaseException) and not isinstance(orig, Exception)) or \ isinstance(orig, DontWrapMixin): return orig if orig is not None: # not a DBAPI error, statement is present. # raise a StatementError if not isinstance(orig, dbapi_base_err) and statement: return StatementError( "(%s.%s) %s" % (orig.__class__.__module__, orig.__class__.__name__, orig), statement, params, orig ) glob = globals() for super_ in orig.__class__.__mro__: name = super_.__name__ if dialect: name = dialect.dbapi_exception_translation_map.get( name, name) if name in glob and issubclass(glob[name], DBAPIError): cls = glob[name] break return cls(statement, params, orig, connection_invalidated) def __reduce__(self): return self.__class__, (self.statement, self.params, self.orig, self.connection_invalidated) def __init__(self, statement, params, orig, connection_invalidated=False): try: text = str(orig) except Exception as e: text = 'Error in str() of DB-API-generated exception: ' + str(e) StatementError.__init__( self, '(%s.%s) %s' % ( orig.__class__.__module__, orig.__class__.__name__, text, ), statement, params, orig ) self.connection_invalidated = connection_invalidated class InterfaceError(DBAPIError): """Wraps a DB-API InterfaceError.""" class DatabaseError(DBAPIError): """Wraps a DB-API DatabaseError.""" class DataError(DatabaseError): """Wraps a DB-API DataError.""" class OperationalError(DatabaseError): """Wraps a DB-API OperationalError.""" class IntegrityError(DatabaseError): """Wraps a DB-API IntegrityError.""" class InternalError(DatabaseError): """Wraps a DB-API InternalError.""" class ProgrammingError(DatabaseError): """Wraps a DB-API ProgrammingError.""" class NotSupportedError(DatabaseError): """Wraps a DB-API NotSupportedError.""" # Warnings class SADeprecationWarning(DeprecationWarning): """Issued once per usage of a deprecated API.""" class SAPendingDeprecationWarning(PendingDeprecationWarning): """Issued once per usage of a deprecated API.""" class SAWarning(RuntimeWarning): """Issued at runtime."""
Microvellum/Fluid-Designer
win64-vc/2.78/python/lib/site-packages/sqlalchemy/exc.py
Python
gpl-3.0
11,706
// // DirectoryIterator_UNIX.h // // $Id: //poco/1.4/Foundation/include/Poco/DirectoryIterator_UNIX.h#1 $ // // Library: Foundation // Package: Filesystem // Module: DirectoryIterator // // Definition of the DirectoryIteratorImpl class for UNIX. // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. // // Permission is hereby granted, free of charge, to any person or organization // obtaining a copy of the software and accompanying documentation covered by // this license (the "Software") to use, reproduce, display, distribute, // execute, and transmit the Software, and to prepare derivative works of the // Software, and to permit third-parties to whom the Software is furnished to // do so, all subject to the following: // // The copyright notices in the Software and this entire statement, including // the above license grant, this restriction and the following disclaimer, // must be included in all copies of the Software, in whole or in part, and // all derivative works of the Software, unless such copies or derivative // works are solely in the form of machine-executable object code generated by // a source language processor. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // #ifndef Foundation_DirectoryIterator_UNIX_INCLUDED #define Foundation_DirectoryIterator_UNIX_INCLUDED #include "Poco/Foundation.h" #include <dirent.h> namespace Poco { class Foundation_API DirectoryIteratorImpl { public: DirectoryIteratorImpl(const std::string& path); ~DirectoryIteratorImpl(); void duplicate(); void release(); const std::string& get() const; const std::string& next(); private: DIR* _pDir; std::string _current; int _rc; }; // // inlines // const std::string& DirectoryIteratorImpl::get() const { return _current; } inline void DirectoryIteratorImpl::duplicate() { ++_rc; } inline void DirectoryIteratorImpl::release() { if (--_rc == 0) delete this; } } // namespace Poco #endif // Foundation_DirectoryIterator_UNIX_INCLUDED
lodle/SoapServer
third_party/poco-1.4.7p1/Foundation/include/Poco/DirectoryIterator_UNIX.h
C
lgpl-2.1
2,484
/* * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jetbrains.plugins.groovy.findUsages; import com.intellij.codeInsight.highlighting.ReadWriteAccessDetector; import com.intellij.psi.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression; import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression; import org.jetbrains.plugins.groovy.lang.psi.util.GroovyPropertyUtils; import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil; /** * @author Maxim.Medvedev */ public class GroovyReadWriteAccessDetector extends ReadWriteAccessDetector{ @Override public boolean isReadWriteAccessible(@NotNull PsiElement element) { return element instanceof GrVariable; } @Override public boolean isDeclarationWriteAccess(@NotNull PsiElement element) { if (element instanceof GrVariable && ((GrVariable)element).getInitializerGroovy() != null) { return true; } return false; } @NotNull @Override public Access getReferenceAccess(@NotNull PsiElement referencedElement, @NotNull PsiReference reference) { return getExpressionAccess(reference.getElement()); } @NotNull @Override public Access getExpressionAccess(@NotNull PsiElement expression) { if (expression instanceof GrExpression) { GrExpression expr = (GrExpression)expression; boolean readAccess = PsiUtil.isAccessedForReading(expr); boolean writeAccess = PsiUtil.isAccessedForWriting(expr); if (!writeAccess && expr instanceof GrReferenceExpression) { //when searching usages of fields, should show all found setters as a "only write usage" PsiElement actualReferee = ((GrReferenceExpression)expr).resolve(); if (actualReferee instanceof PsiMethod && GroovyPropertyUtils.isSimplePropertySetter((PsiMethod)actualReferee)) { writeAccess = true; readAccess = false; } } if (writeAccess && readAccess) return Access.ReadWrite; return writeAccess ? Access.Write : Access.Read; } else if (expression instanceof PsiExpression) { PsiExpression expr = (PsiExpression)expression; boolean readAccess = com.intellij.psi.util.PsiUtil.isAccessedForReading(expr); boolean writeAccess = com.intellij.psi.util.PsiUtil.isAccessedForWriting(expr); if (!writeAccess && expr instanceof PsiReferenceExpression) { //when searching usages of fields, should show all found setters as a "only write usage" PsiElement actualReferee = ((PsiReferenceExpression)expr).resolve(); if (actualReferee instanceof PsiMethod && GroovyPropertyUtils.isSimplePropertySetter((PsiMethod)actualReferee)) { writeAccess = true; readAccess = false; } } if (writeAccess && readAccess) return Access.ReadWrite; return writeAccess ? Access.Write : Access.Read; } else { return Access.Read; } } }
hurricup/intellij-community
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/findUsages/GroovyReadWriteAccessDetector.java
Java
apache-2.0
3,608
# Fact: git_exec_path # # Purpose: get git's exec path # # Resolution: # Uses git's --exec-path flag # # Caveats: # none # # Notes: # None Facter.add('git_exec_path') do case Facter.value(:osfamily) when 'windows' null_path = 'nul' else null_path = '/dev/null' end git_exec_path_cmd = "git --exec-path 2>#{null_path}" setcode do Facter::Util::Resolution.exec(git_exec_path_cmd) end end
alvariux/vagrant-lapp-puppet
puppet/modules/git/lib/facter/git_exec_path.rb
Ruby
apache-2.0
419
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.spark.resource import org.apache.spark.internal.config.{SPARK_DRIVER_PREFIX, SPARK_EXECUTOR_PREFIX, SPARK_TASK_PREFIX} import org.apache.spark.internal.config.Worker.SPARK_WORKER_PREFIX import org.apache.spark.resource.ResourceUtils.{FPGA, GPU} object TestResourceIDs { val DRIVER_GPU_ID = new ResourceID(SPARK_DRIVER_PREFIX, GPU) val EXECUTOR_GPU_ID = new ResourceID(SPARK_EXECUTOR_PREFIX, GPU) val TASK_GPU_ID = new ResourceID(SPARK_TASK_PREFIX, GPU) val WORKER_GPU_ID = new ResourceID(SPARK_WORKER_PREFIX, GPU) val DRIVER_FPGA_ID = new ResourceID(SPARK_DRIVER_PREFIX, FPGA) val EXECUTOR_FPGA_ID = new ResourceID(SPARK_EXECUTOR_PREFIX, FPGA) val TASK_FPGA_ID = new ResourceID(SPARK_TASK_PREFIX, FPGA) val WORKER_FPGA_ID = new ResourceID(SPARK_WORKER_PREFIX, FPGA) }
hvanhovell/spark
core/src/test/scala/org/apache/spark/resource/TestResourceIDs.scala
Scala
apache-2.0
1,609
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_NETWORK_MANAGER_H_ #define REMOTING_CLIENT_PLUGIN_PEPPER_NETWORK_MANAGER_H_ #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" #include "ppapi/cpp/instance_handle.h" #include "ppapi/cpp/network_monitor.h" #include "ppapi/utility/completion_callback_factory.h" #include "third_party/libjingle/source/talk/base/network.h" namespace pp { class NetworkList; } // namespace pp namespace remoting { // PepperNetworkManager uses the PPB_NetworkMonitor API to // implement the NetworkManager interface that libjingle uses to // monitor the host system's network interfaces. class PepperNetworkManager : public talk_base::NetworkManagerBase { public: PepperNetworkManager(const pp::InstanceHandle& instance); virtual ~PepperNetworkManager(); // NetworkManager interface. virtual void StartUpdating() OVERRIDE; virtual void StopUpdating() OVERRIDE; private: static void OnNetworkListCallbackHandler(void* user_data, PP_Resource list_resource); void OnNetworkList(int32_t result, const pp::NetworkList& list); void SendNetworksChangedSignal(); pp::NetworkMonitor monitor_; int start_count_; bool network_list_received_; pp::CompletionCallbackFactory<PepperNetworkManager> callback_factory_; base::WeakPtrFactory<PepperNetworkManager> weak_factory_; }; } // namespace remoting #endif // REMOTING_CLIENT_PLUGIN_PEPPER_NETWORK_MANAGER_H_
DirtyUnicorns/android_external_chromium-org
remoting/client/plugin/pepper_network_manager.h
C
bsd-3-clause
1,638
/** * The Form Field Component * * @module aui-form-field */ var CSS_FIELD = A.getClassName('form', 'field'), CSS_FIELD_CONTENT = A.getClassName('form', 'field', 'content'), CSS_FIELD_CONTENT_INNER = A.getClassName('form', 'field', 'content', 'inner'), CSS_FIELD_HELP = A.getClassName('form', 'field', 'help'), CSS_FIELD_NESTED = A.getClassName('form', 'field', 'nested'), CSS_FIELD_TITLE = A.getClassName('form', 'field', 'title'); /** * A base class for `A.FormField`. All form fields should extend from this. * * @class A.FormField * @extends A.Base * @param {Object} config Object literal specifying widget configuration * properties. * @constructor */ A.FormField = A.Base.create('form-field', A.Base, [], { TPL_FIELD: '<div class="' + CSS_FIELD + '">' + '<div class="' + CSS_FIELD_CONTENT + '"></div>' + '<div class="' + CSS_FIELD_NESTED + '"></div>' + '</div>', TPL_FIELD_CONTENT_MAIN: '<div class="form-group">' + '<label class="' + CSS_FIELD_TITLE + '"></label>' + '<div class="' + CSS_FIELD_HELP + '"></div>' + '<div class="' + CSS_FIELD_CONTENT_INNER + '">{innerContent}</div>' + '</div>', TPL_FIELD_CONTENT: '<div></div>', /** * Construction logic executed during the `A.FormField` * instantiation. Lifecycle. * * @method initializer * @protected */ initializer: function() { var content = this.get('content'); this.renderUI(); content.setData('field-instance', this); this._fieldEventHandles = [ this.after({ helpChange: this._afterHelpChange, nestedFieldsChange: this._afterNestedFieldsChange, titleChange: this._afterTitleChange }) ]; }, /** * Create the DOM structure for the `A.FormField`. Lifecycle. * * @method renderUI * @protected */ renderUI: function() { var content = this.get('content'); content.one('.' + CSS_FIELD_CONTENT).setHTML(A.Lang.sub(this.TPL_FIELD_CONTENT_MAIN, { innerContent: this.TPL_FIELD_CONTENT })); this._uiSetHelp(this.get('help')); this._uiSetNestedFields(this.get('nestedFields')); this._uiSetTitle(this.get('title')); }, /** * Destructor lifecycle implementation for the `A.FormField` class. * Lifecycle. * * @method destructor * @protected */ destructor: function() { this.get('content').remove(true); (new A.EventHandle(this._fieldEventHandles)).detach(); }, /** * Adds the given field to this field's nested list. * * @method addNestedField * @param {Number} index * @param {A.FormField} field */ addNestedField: function(index, field) { var nestedFields = this.get('nestedFields'); nestedFields.splice(index, 0, field); this.set('nestedFields', nestedFields); }, /** * Removes the given field from this field's nested list. * * @method removeNestedField * @param {A.FormField} field */ removeNestedField: function(field) { var index, nestedFields = this.get('nestedFields'); index = A.Array.indexOf(nestedFields, field); if (index !== -1) { nestedFields.splice(index, 1); } this.set('nestedFields', nestedFields); }, /** * Fired after the `help` attribute is set. * * @method _afterHelpChange * @protected */ _afterHelpChange: function() { this._uiSetHelp(this.get('help')); }, /** * Fired after the `nestedFields` attribute is set. * * @method _afterNestedFieldsChange * @protected */ _afterNestedFieldsChange: function() { this._uiSetNestedFields(this.get('nestedFields')); }, /** * Fired after the `title` attribute is set. * * @method _afterTitleChange * @protected */ _afterTitleChange: function() { this._uiSetTitle(this.get('title')); }, /** * Updates the ui according to the value of the `help` attribute. * * @method _uiSetHelp * @param {String} help * @protected */ _uiSetHelp: function(help) { var helpNode = this.get('content').one('.' + CSS_FIELD_HELP); helpNode.set('text', help); helpNode.toggleView(help !== ''); }, /** * Updates the UI according to the value of the `nestedFields` attribute. * * @method _uiSetNestedFields * @param {Array} nestedFields * @protected */ _uiSetNestedFields: function(nestedFields) { var nestedFieldsNode = this.get('content').one('.' + CSS_FIELD_NESTED); nestedFieldsNode.empty(); A.Array.each(nestedFields, function(nestedField) { nestedFieldsNode.append(nestedField.get('content')); }); }, /** * Updates the ui according to the value of the `title` attribute. * * @method _uiSetTitle * @param {String} title * @protected */ _uiSetTitle: function(title) { this.get('content').one('.' + CSS_FIELD_TITLE).set('text', title); }, /** * Validates the value being set to the `nestedFields` attribute. * * @method _validateNestedFields * @param {Array} val * @protected */ _validateNestedFields: function(val) { var i; if (!A.Lang.isArray(val)) { return false; } for (i = 0; i < val.length; i++) { if (!A.instanceOf(val[i], A.FormField)) { return false; } } return true; } }, { /** * Static property used to define the default attribute configuration * for the `A.FormField`. * * @property ATTRS * @type Object * @static */ ATTRS: { /** * Node containing the contents of this field. * * @attribute content * @type Node */ content: { validator: function(val) { return A.instanceOf(val, A.Node); }, valueFn: function() { return A.Node.create(this.TPL_FIELD); }, writeOnce: 'initOnly' }, /** * Help text. * * @attribute help * @default '' * @type {String} */ help: { setter: A.Lang.trim, validator: A.Lang.isString, value: '' }, /** * The fields that are nested inside this field. * * @attribute nestedFields * @default [] * @type Array */ nestedFields: { validator: '_validateNestedFields', value: [] }, /** * The title of this field. * * @attribute title * @default '' * @type {String} */ title: { validator: A.Lang.isString, value: '' } } });
zsagia/alloy-ui
src/aui-form-field/js/aui-form-field.js
JavaScript
bsd-3-clause
7,155
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>CSS Text Module Test: parsing text-indent with invalid values</title> <link rel="help" href="https://www.w3.org/TR/css-text-3/#propdef-text-indent"> <meta name="assert" content="text-indent supports only the grammar '[ <length-percentage> ] && hanging? && each-line?'."> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/css/support/parsing-testcommon.js"></script> </head> <body> <script> test_invalid_value("text-indent", "auto"); test_invalid_value("text-indent", "hanging"); test_invalid_value("text-indent", "each-line"); test_invalid_value("text-indent", "10"); test_invalid_value("text-indent", "10px hanging 20px"); test_invalid_value("text-indent", "hanging 20% hanging"); test_invalid_value("text-indent", "each-line each-line"); </script> </body> </html>
chromium/chromium
third_party/blink/web_tests/external/wpt/css/css-text/parsing/text-indent-invalid.html
HTML
bsd-3-clause
897
/* * linux/fs/hfs/sysdep.c * * Copyright (C) 1996 Paul H. Hargrove * (C) 2003 Ardis Technologies <[email protected]> * This file may be distributed under the terms of the GNU General Public License. * * This file contains the code to do various system dependent things. */ #include <linux/namei.h> #include "hfs_fs.h" /* dentry case-handling: just lowercase everything */ static int hfs_revalidate_dentry(struct dentry *dentry, unsigned int flags) { struct inode *inode; int diff; if (flags & LOOKUP_RCU) return -ECHILD; inode = dentry->d_inode; if(!inode) return 1; /* fix up inode on a timezone change */ diff = sys_tz.tz_minuteswest * 60 - HFS_I(inode)->tz_secondswest; if (diff) { inode->i_ctime.tv_sec += diff; inode->i_atime.tv_sec += diff; inode->i_mtime.tv_sec += diff; HFS_I(inode)->tz_secondswest += diff; } return 1; } const struct dentry_operations hfs_dentry_operations = { .d_revalidate = hfs_revalidate_dentry, .d_hash = hfs_hash_dentry, .d_compare = hfs_compare_dentry, };
mericon/Xp_Kernel_LGH850
virt/fs/hfs/sysdep.c
C
gpl-2.0
1,035
from datetime import datetime, timedelta import os import jwt import json import requests from functools import wraps from urlparse import parse_qs, parse_qsl from urllib import urlencode from flask import Flask, g, send_file, request, redirect, url_for, jsonify from flask.ext.sqlalchemy import SQLAlchemy from werkzeug.security import generate_password_hash, check_password_hash from requests_oauthlib import OAuth1 from jwt import DecodeError, ExpiredSignature # Configuration current_path = os.path.dirname(__file__) client_path = os.path.abspath(os.path.join(current_path, '..', '..', 'client')) app = Flask(__name__, static_url_path='', static_folder=client_path) app.config.from_object('config') db = SQLAlchemy(app) class User(db.Model): id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(120), unique=True) password = db.Column(db.String(120)) display_name = db.Column(db.String(120)) facebook = db.Column(db.String(120)) github = db.Column(db.String(120)) google = db.Column(db.String(120)) linkedin = db.Column(db.String(120)) twitter = db.Column(db.String(120)) def __init__(self, email=None, password=None, display_name=None, facebook=None, github=None, google=None, linkedin=None, twitter=None): if email: self.email = email.lower() if password: self.set_password(password) if display_name: self.display_name = display_name if facebook: self.facebook = facebook if google: self.google = google if linkedin: self.linkedin = linkedin if twitter: self.twitter = twitter def set_password(self, password): self.password = generate_password_hash(password) def check_password(self, password): return check_password_hash(self.password, password) def to_json(self): return dict(id=self.id, email=self.email, displayName=self.display_name, facebook=self.facebook, google=self.google, linkedin=self.linkedin, twitter=self.twitter) db.create_all() def create_token(user): payload = { 'sub': user.id, 'iat': datetime.utcnow(), 'exp': datetime.utcnow() + timedelta(days=14) } token = jwt.encode(payload, app.config['TOKEN_SECRET']) return token.decode('unicode_escape') def parse_token(req): token = req.headers.get('Authorization').split()[1] return jwt.decode(token, app.config['TOKEN_SECRET']) def login_required(f): @wraps(f) def decorated_function(*args, **kwargs): if not request.headers.get('Authorization'): response = jsonify(message='Missing authorization header') response.status_code = 401 return response try: payload = parse_token(request) except DecodeError: response = jsonify(message='Token is invalid') response.status_code = 401 return response except ExpiredSignature: response = jsonify(message='Token has expired') response.status_code = 401 return response g.user_id = payload['sub'] return f(*args, **kwargs) return decorated_function # Routes @app.route('/') def index(): return send_file('../../client/index.html') @app.route('/api/me') @login_required def me(): user = User.query.filter_by(id=g.user_id).first() return jsonify(user.to_json()) @app.route('/auth/login', methods=['POST']) def login(): user = User.query.filter_by(email=request.json['email']).first() if not user or not user.check_password(request.json['password']): response = jsonify(message='Wrong Email or Password') response.status_code = 401 return response token = create_token(user) return jsonify(token=token) @app.route('/auth/signup', methods=['POST']) def signup(): user = User(email=request.json['email'], password=request.json['password']) db.session.add(user) db.session.commit() token = create_token(user) return jsonify(token=token) @app.route('/auth/facebook', methods=['POST']) def facebook(): access_token_url = 'https://graph.facebook.com/v2.3/oauth/access_token' graph_api_url = 'https://graph.facebook.com/v2.3/me' params = { 'client_id': request.json['clientId'], 'redirect_uri': request.json['redirectUri'], 'client_secret': app.config['FACEBOOK_SECRET'], 'code': request.json['code'] } # Step 1. Exchange authorization code for access token. r = requests.get(access_token_url, params=params) access_token = dict(parse_qsl(r.text)) # Step 2. Retrieve information about the current user. r = requests.get(graph_api_url, params=access_token) profile = json.loads(r.text) # Step 3. (optional) Link accounts. if request.headers.get('Authorization'): user = User.query.filter_by(facebook=profile['id']).first() if user: response = jsonify(message='There is already a Facebook account that belongs to you') response.status_code = 409 return response payload = parse_token(request) user = User.query.filter_by(id=payload['sub']).first() if not user: response = jsonify(message='User not found') response.status_code = 400 return response u = User(facebook=profile['id'], display_name=profile['name']) db.session.add(u) db.session.commit() token = create_token(u) return jsonify(token=token) # Step 4. Create a new account or return an existing one. user = User.query.filter_by(facebook=profile['id']).first() if user: token = create_token(user) return jsonify(token=token) u = User(facebook=profile['id'], display_name=profile['name']) db.session.add(u) db.session.commit() token = create_token(u) return jsonify(token=token) @app.route('/auth/github', methods=['POST']) def github(): access_token_url = 'https://github.com/login/oauth/access_token' users_api_url = 'https://api.github.com/user' params = { 'client_id': request.json['clientId'], 'redirect_uri': request.json['redirectUri'], 'client_secret': app.config['GITHUB_SECRET'], 'code': request.json['code'] } # Step 1. Exchange authorization code for access token. r = requests.get(access_token_url, params=params) access_token = dict(parse_qsl(r.text)) headers = {'User-Agent': 'Satellizer'} # Step 2. Retrieve information about the current user. r = requests.get(users_api_url, params=access_token, headers=headers) profile = json.loads(r.text) # Step 3. (optional) Link accounts. if request.headers.get('Authorization'): user = User.query.filter_by(github=profile['id']).first() if user: response = jsonify(message='There is already a GitHub account that belongs to you') response.status_code = 409 return response payload = parse_token(request) user = User.query.filter_by(id=payload['sub']).first() if not user: response = jsonify(message='User not found') response.status_code = 400 return response u = User(github=profile['id'], display_name=profile['name']) db.session.add(u) db.session.commit() token = create_token(u) return jsonify(token=token) # Step 4. Create a new account or return an existing one. user = User.query.filter_by(github=profile['id']).first() if user: token = create_token(user) return jsonify(token=token) u = User(github=profile['id'], display_name=profile['name']) db.session.add(u) db.session.commit() token = create_token(u) return jsonify(token=token) @app.route('/auth/google', methods=['POST']) def google(): access_token_url = 'https://accounts.google.com/o/oauth2/token' people_api_url = 'https://www.googleapis.com/plus/v1/people/me/openIdConnect' payload = dict(client_id=request.json['clientId'], redirect_uri=request.json['redirectUri'], client_secret=app.config['GOOGLE_SECRET'], code=request.json['code'], grant_type='authorization_code') # Step 1. Exchange authorization code for access token. r = requests.post(access_token_url, data=payload) token = json.loads(r.text) headers = {'Authorization': 'Bearer {0}'.format(token['access_token'])} # Step 2. Retrieve information about the current user. r = requests.get(people_api_url, headers=headers) profile = json.loads(r.text) user = User.query.filter_by(google=profile['sub']).first() if user: token = create_token(user) return jsonify(token=token) u = User(google=profile['sub'], display_name=profile['name']) db.session.add(u) db.session.commit() token = create_token(u) return jsonify(token=token) @app.route('/auth/linkedin', methods=['POST']) def linkedin(): access_token_url = 'https://www.linkedin.com/uas/oauth2/accessToken' people_api_url = 'https://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address)' payload = dict(client_id=request.json['clientId'], redirect_uri=request.json['redirectUri'], client_secret=app.config['LINKEDIN_SECRET'], code=request.json['code'], grant_type='authorization_code') # Step 1. Exchange authorization code for access token. r = requests.post(access_token_url, data=payload) access_token = json.loads(r.text) params = dict(oauth2_access_token=access_token['access_token'], format='json') # Step 2. Retrieve information about the current user. r = requests.get(people_api_url, params=params) profile = json.loads(r.text) user = User.query.filter_by(linkedin=profile['id']).first() if user: token = create_token(user) return jsonify(token=token) u = User(linkedin=profile['id'], display_name=profile['firstName'] + ' ' + profile['lastName']) db.session.add(u) db.session.commit() token = create_token(u) return jsonify(token=token) @app.route('/auth/twitter') def twitter(): request_token_url = 'https://api.twitter.com/oauth/request_token' access_token_url = 'https://api.twitter.com/oauth/access_token' authenticate_url = 'https://api.twitter.com/oauth/authenticate' if request.args.get('oauth_token') and request.args.get('oauth_verifier'): auth = OAuth1(app.config['TWITTER_CONSUMER_KEY'], client_secret=app.config['TWITTER_CONSUMER_SECRET'], resource_owner_key=request.args.get('oauth_token'), verifier=request.args.get('oauth_verifier')) r = requests.post(access_token_url, auth=auth) profile = dict(parse_qsl(r.text)) user = User.query.filter_by(twitter=profile['user_id']).first() if user: token = create_token(user) return jsonify(token=token) u = User(twitter=profile['user_id'], display_name=profile['screen_name']) db.session.add(u) db.session.commit() token = create_token(u) return jsonify(token=token) else: oauth = OAuth1(app.config['TWITTER_CONSUMER_KEY'], client_secret=app.config['TWITTER_CONSUMER_SECRET'], callback_uri=app.config['TWITTER_CALLBACK_URL']) r = requests.post(request_token_url, auth=oauth) oauth_token = dict(parse_qsl(r.text)) qs = urlencode(dict(oauth_token=oauth_token['oauth_token'])) return redirect(authenticate_url + '?' + qs) if __name__ == '__main__': app.run(port=3000)
andyskw/satellizer
examples/server/python/app.py
Python
mit
12,044
/*! angularjs-slider - v5.7.0 - (c) Rafal Zajac <[email protected]>, Valentin Hervieu <[email protected]>, Jussi Saarivirta <[email protected]>, Angelin Sirbu <[email protected]> - https://github.com/angular-slider/angularjs-slider - 2016-10-16 */ .rzslider { position: relative; display: inline-block; width: 100%; height: 4px; margin: 35px 0 15px 0; vertical-align: middle; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .rzslider.with-legend { margin-bottom: 40px; } .rzslider[disabled] { cursor: not-allowed; } .rzslider[disabled] .rz-pointer { cursor: not-allowed; background-color: #d8e0f3; } .rzslider span { position: absolute; display: inline-block; white-space: nowrap; } .rzslider .rz-base { width: 100%; height: 100%; padding: 0; } .rzslider .rz-bar-wrapper { left: 0; z-index: 1; width: 100%; height: 32px; padding-top: 16px; margin-top: -16px; box-sizing: border-box; } .rzslider .rz-bar-wrapper.rz-draggable { cursor: move; } .rzslider .rz-bar { left: 0; z-index: 1; width: 100%; height: 4px; background: #d8e0f3; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px; } .rzslider .rz-bar.rz-selection { z-index: 2; background: #0db9f0; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px; } .rzslider .rz-pointer { top: -14px; z-index: 3; width: 32px; height: 32px; cursor: pointer; background-color: #0db9f0; -webkit-border-radius: 16px; -moz-border-radius: 16px; border-radius: 16px; } .rzslider .rz-pointer:after { position: absolute; top: 12px; left: 12px; width: 8px; height: 8px; background: #ffffff; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; content: ''; } .rzslider .rz-pointer:hover:after { background-color: #ffffff; } .rzslider .rz-pointer.rz-active { z-index: 4; } .rzslider .rz-pointer.rz-active:after { background-color: #451aff; } .rzslider .rz-bubble { bottom: 16px; padding: 1px 3px; color: #55637d; cursor: default; } .rzslider .rz-bubble.rz-selection { top: 16px; } .rzslider .rz-bubble.rz-limit { color: #55637d; } .rzslider .rz-ticks { position: absolute; top: -3px; left: 0; z-index: 1; width: 100%; height: 0; margin: 0; list-style: none; box-sizing: border-box; } .rzslider .rz-ticks .rz-tick { position: absolute; top: 0; left: 0; width: 10px; height: 10px; margin-left: 11px; text-align: center; cursor: pointer; background: #d8e0f3; border-radius: 50%; } .rzslider .rz-ticks .rz-tick.rz-selected { background: #0db9f0; } .rzslider .rz-ticks .rz-tick .rz-tick-value { position: absolute; top: -30px; transform: translate(-50%, 0); } .rzslider .rz-ticks .rz-tick .rz-tick-legend { position: absolute; top: 24px; max-width: 50px; white-space: normal; transform: translate(-50%, 0); } .rzslider .rz-ticks.rz-ticks-values-under .rz-tick-value { top: initial; bottom: -32px; } .rzslider.rz-vertical { position: relative; width: 4px; height: 100%; padding: 0; margin: 0 20px; vertical-align: baseline; } .rzslider.rz-vertical .rz-base { width: 100%; height: 100%; padding: 0; } .rzslider.rz-vertical .rz-bar-wrapper { top: auto; left: 0; width: 32px; height: 100%; padding: 0 0 0 16px; margin: 0 0 0 -16px; } .rzslider.rz-vertical .rz-bar { bottom: 0; left: auto; width: 4px; height: 100%; } .rzslider.rz-vertical .rz-pointer { top: auto; bottom: 0; left: -14px !important; } .rzslider.rz-vertical .rz-bubble { bottom: 0; left: 16px !important; margin-left: 3px; } .rzslider.rz-vertical .rz-bubble.rz-selection { top: auto; left: 16px !important; } .rzslider.rz-vertical .rz-ticks { top: 0; left: -3px; z-index: 1; width: 0; height: 100%; } .rzslider.rz-vertical .rz-ticks .rz-tick { margin-top: 11px; margin-left: auto; vertical-align: middle; } .rzslider.rz-vertical .rz-ticks .rz-tick .rz-tick-value { top: initial; left: 24px; transform: translate(0, -28%); } .rzslider.rz-vertical .rz-ticks .rz-tick .rz-tick-legend { top: initial; right: 24px; max-width: none; white-space: nowrap; transform: translate(0, -28%); } .rzslider.rz-vertical .rz-ticks.rz-ticks-values-under .rz-tick-value { right: 24px; bottom: initial; left: initial; }
Piicksarn/cdnjs
ajax/libs/angularjs-slider/5.7.0/rzslider.css
CSS
mit
4,487
// Type definitions for Vex v2.3.2 // Project: https://github.com/HubSpot/vex // Definitions by: Greg Cohan <https://github.com/gdcohan> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped ///<reference types="jquery" /> export = vex; export as namespace vex; declare namespace vex { interface ICSSAttributes { [property: string]: string | number; } interface IVexOptions { afterClose?: (() => void); afterOpen?: ((vexContent: JQuery) => void); content?: string; showCloseButton?: boolean; escapeButtonCloses?: boolean; overlayClosesOnClick?: boolean; appendLocation?: HTMLElement | JQuery | string; className?: string; css?: ICSSAttributes; overlayClassName?: string; overlayCSS?: ICSSAttributes; contentClassName?: string; contentCSS?: ICSSAttributes; closeClassName?: string; closeCSS?: ICSSAttributes; } interface Vex { open(options: IVexOptions): JQuery; close(id?: number): boolean; closeAll(): boolean; closeByID(id: number): boolean; } } declare var vex: vex.Vex;
schmuli/DefinitelyTyped
vex-js/index.d.ts
TypeScript
mit
1,087
<?php /* * This file is part of Psy Shell. * * (c) 2012-2015 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Psy\CodeCleaner; use PhpParser\Node; use PhpParser\Node\Expr; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\PropertyFetch; use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Expr\Variable; use Psy\Exception\FatalErrorException; /** * Validate that only variables (and variable-like things) are passed by reference. */ class PassableByReferencePass extends CodeCleanerPass { const EXCEPTION_MESSAGE = 'Only variables can be passed by reference'; /** * @throws FatalErrorException if non-variables are passed by reference * * @param Node $node */ public function enterNode(Node $node) { // TODO: support MethodCall and StaticCall as well. if ($node instanceof FuncCall) { $name = $node->name; // if function name is an expression or a variable, give it a pass for now. if ($name instanceof Expr || $name instanceof Variable) { return; } try { $refl = new \ReflectionFunction(implode('\\', $name->parts)); } catch (\ReflectionException $e) { // Well, we gave it a shot! return; } foreach ($refl->getParameters() as $key => $param) { if (array_key_exists($key, $node->args)) { $arg = $node->args[$key]; if ($param->isPassedByReference() && !$this->isPassableByReference($arg)) { throw new FatalErrorException(self::EXCEPTION_MESSAGE); } } } } } private function isPassableByReference(Node $arg) { // FuncCall, MethodCall and StaticCall are all PHP _warnings_ not fatal errors, so we'll let // PHP handle those ones :) return $arg->value instanceof ClassConstFetch || $arg->value instanceof PropertyFetch || $arg->value instanceof Variable || $arg->value instanceof FuncCall || $arg->value instanceof MethodCall || $arg->value instanceof StaticCall; } }
batmorell/downloadsCenter
vendor/psy/psysh/src/Psy/CodeCleaner/PassableByReferencePass.php
PHP
mit
2,424
/*! * OOjs UI v0.15.1 * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2016 OOjs UI Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * * Date: 2016-01-26T21:14:25Z */ @-webkit-keyframes oo-ui-progressBarWidget-slide { from { margin-left: -40%; } to { margin-left: 100%; } } @-moz-keyframes oo-ui-progressBarWidget-slide { from { margin-left: -40%; } to { margin-left: 100%; } } @keyframes oo-ui-progressBarWidget-slide { from { margin-left: -40%; } to { margin-left: 100%; } } /* @noflip */ .oo-ui-rtl { direction: rtl; } /* @noflip */ .oo-ui-ltr { direction: ltr; } .oo-ui-element-hidden { display: none !important; } .oo-ui-buttonElement > .oo-ui-buttonElement-button { cursor: pointer; display: inline-block; vertical-align: middle; font: inherit; white-space: nowrap; -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .oo-ui-buttonElement > .oo-ui-buttonElement-button > .oo-ui-iconElement-icon, .oo-ui-buttonElement > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator { display: none; } .oo-ui-buttonElement.oo-ui-widget-disabled > .oo-ui-buttonElement-button { cursor: default; } .oo-ui-buttonElement.oo-ui-indicatorElement > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator, .oo-ui-buttonElement.oo-ui-iconElement > .oo-ui-buttonElement-button > .oo-ui-iconElement-icon { display: inline-block; vertical-align: middle; } .oo-ui-buttonElement-frameless { display: inline-block; position: relative; } .oo-ui-buttonElement-frameless.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { display: inline-block; vertical-align: middle; } .oo-ui-buttonElement-framed > .oo-ui-buttonElement-button { display: inline-block; vertical-align: top; text-align: center; } .oo-ui-buttonElement-framed.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { display: inline-block; vertical-align: middle; } .oo-ui-buttonElement-framed.oo-ui-widget-disabled > .oo-ui-buttonElement-button, .oo-ui-buttonElement-framed.oo-ui-widget-disabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button, .oo-ui-buttonElement-framed.oo-ui-widget-disabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button { cursor: default; } .oo-ui-buttonElement > .oo-ui-buttonElement-button { font-weight: bold; text-decoration: none; } .oo-ui-buttonElement.oo-ui-iconElement > .oo-ui-buttonElement-button > .oo-ui-iconElement-icon { margin-left: 0; } .oo-ui-buttonElement.oo-ui-indicatorElement > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator { width: 0.9375em; height: 0.9375em; } .oo-ui-buttonElement.oo-ui-iconElement > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator { margin-left: 0.46875em; } .oo-ui-buttonElement.oo-ui-iconElement > .oo-ui-buttonElement-button > .oo-ui-iconElement-icon { width: 1.875em; height: 1.875em; } .oo-ui-buttonElement-frameless > .oo-ui-buttonElement-button:focus { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.2); outline: none; } .oo-ui-buttonElement-frameless > .oo-ui-buttonElement-button .oo-ui-indicatorElement-indicator { margin-right: 0; } .oo-ui-buttonElement-frameless.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { margin-left: 0.25em; margin-right: 0.25em; } .oo-ui-buttonElement-frameless > input.oo-ui-buttonElement-button { padding-left: 0.25em; padding-right: 0.25em; color: #333333; } .oo-ui-buttonElement-frameless.oo-ui-widget-enabled > input.oo-ui-buttonElement-button, .oo-ui-buttonElement-frameless.oo-ui-widget-enabled > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { color: #555555; } .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > input.oo-ui-buttonElement-button, .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { color: #444444; } .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:hover > .oo-ui-labelElement-label, .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:focus > .oo-ui-labelElement-label { color: #2962cc; } .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { color: #347bff; } .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active > .oo-ui-labelElement-label, .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { color: #1f4999; box-shadow: none; } .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:hover > .oo-ui-labelElement-label, .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:focus > .oo-ui-labelElement-label { color: #008064; } .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { color: #00af89; } .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active > .oo-ui-labelElement-label, .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { color: #005946; box-shadow: none; } .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:hover > .oo-ui-labelElement-label, .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:focus > .oo-ui-labelElement-label { color: #8c130d; } .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { color: #d11d13; } .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active > .oo-ui-labelElement-label, .oo-ui-buttonElement-frameless.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { color: #73100a; box-shadow: none; } .oo-ui-buttonElement-frameless.oo-ui-widget-disabled > .oo-ui-buttonElement-button { color: #cccccc; } .oo-ui-buttonElement-frameless.oo-ui-widget-disabled > .oo-ui-buttonElement-button:focus { box-shadow: none; } .oo-ui-buttonElement-frameless.oo-ui-widget-disabled > .oo-ui-buttonElement-button > .oo-ui-iconElement-icon, .oo-ui-buttonElement-frameless.oo-ui-widget-disabled > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator { opacity: 0.2; } .oo-ui-buttonElement-framed.oo-ui-iconElement.oo-ui-labelElement > .oo-ui-buttonElement-button, .oo-ui-buttonElement-framed.oo-ui-iconElement.oo-ui-indicatorElement > .oo-ui-buttonElement-button { padding-left: 2.4em; } .oo-ui-buttonElement-framed > .oo-ui-buttonElement-button { padding: 0.5em 1em; min-height: 1.2em; min-width: 1em; border-radius: 2px; position: relative; -webkit-transition: background 100ms ease, color 100ms ease, border-color 100ms ease, box-shadow 100ms ease; -moz-transition: background 100ms ease, color 100ms ease, border-color 100ms ease, box-shadow 100ms ease; transition: background 100ms ease, color 100ms ease, border-color 100ms ease, box-shadow 100ms ease; } .oo-ui-buttonElement-framed > .oo-ui-buttonElement-button:hover, .oo-ui-buttonElement-framed > .oo-ui-buttonElement-button:focus { outline: none; } .oo-ui-buttonElement-framed > input.oo-ui-buttonElement-button, .oo-ui-buttonElement-framed.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { line-height: 1.2em; display: inline-block; } .oo-ui-buttonElement-framed.oo-ui-iconElement > .oo-ui-buttonElement-button > .oo-ui-iconElement-icon { position: absolute; top: 0.2em; left: 0.5625em; } .oo-ui-buttonElement-framed.oo-ui-iconElement.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { margin-left: 0.3em; } .oo-ui-buttonElement-framed.oo-ui-indicatorElement > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator { display: inline-block; } .oo-ui-buttonElement-framed.oo-ui-indicatorElement.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator, .oo-ui-buttonElement-framed.oo-ui-indicatorElement.oo-ui-iconElement:not( .oo-ui-labelElement ) > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator { margin-left: 0.46875em; margin-right: -0.275em; } .oo-ui-buttonElement-framed.oo-ui-indicatorElement.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-indicatorElement-indicator { position: relative; left: 0.2em; } .oo-ui-buttonElement-framed.oo-ui-widget-disabled > .oo-ui-buttonElement-button { background: #dddddd; color: #ffffff; border: 1px solid #dddddd; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled > .oo-ui-buttonElement-button { color: #555555; background-color: #ffffff; border: 1px solid #cccccc; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled > .oo-ui-buttonElement-button:hover { background-color: #ebebeb; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled > .oo-ui-buttonElement-button:focus { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); } .oo-ui-buttonElement-framed.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active, .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button { background-color: #d9d9d9; border-color: #d9d9d9; box-shadow: none; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button { background-color: #999999; color: #ffffff; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button { color: #347bff; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:hover { background-color: rgba(52, 123, 255, 0.1); border-color: rgba(31, 73, 153, 0.5); } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:focus { box-shadow: inset 0 0 0 1px #1f4999; border-color: #1f4999; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active, .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button { color: #1f4999; border-color: #1f4999; box-shadow: none; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button { background-color: #999999; color: #ffffff; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button { color: #00af89; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:hover { background-color: rgba(0, 171, 137, 0.1); border-color: rgba(0, 89, 70, 0.5); } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:focus { box-shadow: inset 0 0 0 1px #005946; border-color: #005946; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active, .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button { color: #005946; border-color: #005946; box-shadow: none; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button { background-color: #999999; color: #ffffff; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button { color: #d11d13; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:hover { background-color: rgba(209, 29, 19, 0.1); border-color: rgba(115, 16, 10, 0.5); } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:focus { box-shadow: inset 0 0 0 1px #73100a; border-color: #73100a; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active, .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button { color: #73100a; border-color: #73100a; box-shadow: none; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button { background-color: #999999; color: #ffffff; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button { color: #ffffff; background-color: #347bff; border-color: #347bff; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:hover { background: #2962cc; border-color: #2962cc; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive > .oo-ui-buttonElement-button:focus { box-shadow: inset 0 0 0 1px #ffffff; border-color: #347bff; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active, .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button { color: #ffffff; background-color: #1f4999; border-color: #1f4999; box-shadow: none; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button { background-color: #999999; color: #ffffff; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button { color: #ffffff; background-color: #00af89; border-color: #00af89; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:hover { background: #008064; border-color: #008064; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive > .oo-ui-buttonElement-button:focus { box-shadow: inset 0 0 0 1px #ffffff; border-color: #00af89; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active, .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button { color: #ffffff; background-color: #005946; border-color: #005946; box-shadow: none; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button { background-color: #999999; color: #ffffff; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button { color: #ffffff; background-color: #d11d13; border-color: #d11d13; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:hover { background: #8c130d; border-color: #8c130d; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive > .oo-ui-buttonElement-button:focus { box-shadow: inset 0 0 0 1px #ffffff; border-color: #d11d13; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled > .oo-ui-buttonElement-button:active, .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-pressed > .oo-ui-buttonElement-button { color: #ffffff; background-color: #73100a; border-color: #73100a; box-shadow: none; } .oo-ui-buttonElement-framed.oo-ui-widget-enabled.oo-ui-flaggedElement-primary.oo-ui-flaggedElement-destructive.oo-ui-widget-enabled.oo-ui-buttonElement-active > .oo-ui-buttonElement-button { background-color: #999999; color: #ffffff; } .oo-ui-clippableElement-clippable { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .oo-ui-draggableElement { cursor: -webkit-grab -moz-grab, url(images/grab.cur), move; } .oo-ui-draggableElement-dragging { cursor: -webkit-grabbing -moz-grabbing, url(images/grabbing.cur), move; background: rgba(0, 0, 0, 0.2); opacity: 0.4; } .oo-ui-draggableGroupElement-horizontal .oo-ui-draggableElement.oo-ui-optionWidget { display: inline-block; } .oo-ui-draggableGroupElement-placeholder { position: absolute; display: block; background: rgba(0, 0, 0, 0.4); } .oo-ui-iconElement .oo-ui-iconElement-icon, .oo-ui-iconElement.oo-ui-iconElement-icon { background-size: contain; background-position: center center; background-repeat: no-repeat; } .oo-ui-indicatorElement .oo-ui-indicatorElement-indicator, .oo-ui-indicatorElement.oo-ui-indicatorElement-indicator { background-size: contain; background-position: center center; background-repeat: no-repeat; } .oo-ui-lookupElement > .oo-ui-menuSelectWidget { z-index: 1; width: 100%; } .oo-ui-pendingElement-pending { background-image: /* @embed */ url(themes/mediawiki/images/textures/pending.gif); } .oo-ui-bookletLayout-stackLayout.oo-ui-stackLayout-continuous > .oo-ui-panelLayout-scrollable { overflow-y: hidden; } .oo-ui-bookletLayout-stackLayout > .oo-ui-panelLayout { width: 100%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .oo-ui-bookletLayout-stackLayout > .oo-ui-panelLayout-scrollable { overflow-y: auto; } .oo-ui-bookletLayout-stackLayout > .oo-ui-panelLayout-padded { padding: 2em; } .oo-ui-bookletLayout-outlinePanel-editable > .oo-ui-outlineSelectWidget { position: absolute; top: 0; left: 0; right: 0; bottom: 3em; overflow-y: auto; } .oo-ui-bookletLayout-outlinePanel > .oo-ui-outlineControlsWidget { position: absolute; bottom: 0; left: 0; right: 0; } .oo-ui-bookletLayout-stackLayout > .oo-ui-panelLayout { padding: 1.5em; } .oo-ui-bookletLayout-outlinePanel { border-right: 1px solid #dddddd; } .oo-ui-bookletLayout-outlinePanel > .oo-ui-outlineControlsWidget { box-shadow: 0 0.15em 0 0 rgba(0, 0, 0, 0.15); } .oo-ui-indexLayout > .oo-ui-menuLayout-menu { height: 3em; } .oo-ui-indexLayout > .oo-ui-menuLayout-content { top: 3em; } .oo-ui-indexLayout-stackLayout > .oo-ui-panelLayout { padding: 1.5em; } .oo-ui-indexLayout > .oo-ui-menuLayout-menu { height: 2.75em; } .oo-ui-indexLayout > .oo-ui-menuLayout-content { top: 2.75em; } .oo-ui-fieldLayout { display: block; margin-bottom: 1em; } .oo-ui-fieldLayout:before, .oo-ui-fieldLayout:after { content: " "; display: table; } .oo-ui-fieldLayout:after { clear: both; } .oo-ui-fieldLayout.oo-ui-fieldLayout-align-left > .oo-ui-fieldLayout-body > .oo-ui-labelElement-label, .oo-ui-fieldLayout.oo-ui-fieldLayout-align-right > .oo-ui-fieldLayout-body > .oo-ui-labelElement-label, .oo-ui-fieldLayout.oo-ui-fieldLayout-align-left > .oo-ui-fieldLayout-body > .oo-ui-fieldLayout-field, .oo-ui-fieldLayout.oo-ui-fieldLayout-align-right > .oo-ui-fieldLayout-body > .oo-ui-fieldLayout-field { display: block; float: left; } .oo-ui-fieldLayout.oo-ui-fieldLayout-align-right > .oo-ui-fieldLayout-body > .oo-ui-labelElement-label { text-align: right; } .oo-ui-fieldLayout.oo-ui-fieldLayout-align-inline > .oo-ui-fieldLayout-body { display: table; } .oo-ui-fieldLayout.oo-ui-fieldLayout-align-inline > .oo-ui-fieldLayout-body > .oo-ui-labelElement-label, .oo-ui-fieldLayout.oo-ui-fieldLayout-align-inline > .oo-ui-fieldLayout-body > .oo-ui-fieldLayout-field { display: table-cell; vertical-align: middle; } .oo-ui-fieldLayout.oo-ui-labelElement.oo-ui-fieldLayout-align-top > .oo-ui-fieldLayout-body > .oo-ui-labelElement-label { display: inline-block; } .oo-ui-fieldLayout > .oo-ui-fieldLayout-help { float: right; } .oo-ui-fieldLayout > .oo-ui-fieldLayout-help > .oo-ui-popupWidget > .oo-ui-popupWidget-popup { z-index: 1; } .oo-ui-fieldLayout > .oo-ui-fieldLayout-help .oo-ui-fieldLayout-help-content { padding: 0.5em 0.75em; line-height: 1.5em; } .oo-ui-fieldLayout:last-child { margin-bottom: 0; } .oo-ui-fieldLayout.oo-ui-fieldLayout-align-left.oo-ui-labelElement > .oo-ui-fieldLayout-body > .oo-ui-labelElement-label, .oo-ui-fieldLayout.oo-ui-fieldLayout-align-right.oo-ui-labelElement > .oo-ui-fieldLayout-body > .oo-ui-labelElement-label { padding-top: 0.5em; margin-right: 5%; width: 35%; } .oo-ui-fieldLayout.oo-ui-fieldLayout-align-left > .oo-ui-fieldLayout-body > .oo-ui-fieldLayout-field, .oo-ui-fieldLayout.oo-ui-fieldLayout-align-right > .oo-ui-fieldLayout-body > .oo-ui-fieldLayout-field { width: 60%; } .oo-ui-fieldLayout.oo-ui-fieldLayout-align-inline { margin-bottom: 1.25em; } .oo-ui-fieldLayout.oo-ui-fieldLayout-align-inline.oo-ui-labelElement > .oo-ui-fieldLayout-body > .oo-ui-labelElement-label { padding: 0.25em 0.25em 0.25em 1em; } .oo-ui-fieldLayout.oo-ui-fieldLayout-align-top.oo-ui-labelElement > .oo-ui-fieldLayout-body > .oo-ui-labelElement-label { padding-top: 0.25em; padding-bottom: 0.5em; } .oo-ui-fieldLayout > .oo-ui-popupButtonWidget { margin-right: 0; } .oo-ui-fieldLayout > .oo-ui-popupButtonWidget:last-child { margin-right: 0; } .oo-ui-fieldLayout-disabled > .oo-ui-fieldLayout-body > .oo-ui-labelElement-label { color: #cccccc; } .oo-ui-fieldLayout-messages { list-style: none none; margin: 0.25em 0 0 0.25em; padding: 0; } .oo-ui-fieldLayout-messages > li { margin: 0; padding: 0; display: table; } .oo-ui-fieldLayout-messages .oo-ui-iconWidget { display: table-cell; border-right: 0.5em solid transparent; } .oo-ui-fieldLayout-messages .oo-ui-labelWidget { display: table-cell; padding: 0; line-height: 1.875em; vertical-align: middle; } .oo-ui-actionFieldLayout-input, .oo-ui-actionFieldLayout-button { display: table-cell; vertical-align: middle; } .oo-ui-actionFieldLayout-input { padding-right: 1em; } .oo-ui-actionFieldLayout-button { width: 1%; white-space: nowrap; } .oo-ui-fieldsetLayout { position: relative; margin: 0; padding: 0; border: 0; } .oo-ui-fieldsetLayout.oo-ui-iconElement > .oo-ui-iconElement-icon { display: block; position: absolute; } .oo-ui-fieldsetLayout.oo-ui-labelElement > .oo-ui-labelElement-label { display: inline-block; } .oo-ui-fieldsetLayout > .oo-ui-fieldsetLayout-help { float: right; } .oo-ui-fieldsetLayout > .oo-ui-fieldsetLayout-help > .oo-ui-popupWidget > .oo-ui-popupWidget-popup { z-index: 1; } .oo-ui-fieldsetLayout > .oo-ui-fieldsetLayout-help .oo-ui-fieldsetLayout-help-content { padding: 0.5em 0.75em; line-height: 1.5em; } .oo-ui-fieldsetLayout + .oo-ui-fieldsetLayout, .oo-ui-fieldsetLayout + .oo-ui-formLayout { margin-top: 2em; } .oo-ui-fieldsetLayout > .oo-ui-labelElement-label { font-size: 1.1em; margin-bottom: 0.5em; padding: 0.25em 0; font-weight: bold; } .oo-ui-fieldsetLayout.oo-ui-iconElement > .oo-ui-labelElement-label { padding-left: 2em; line-height: 1.8em; } .oo-ui-fieldsetLayout.oo-ui-iconElement > .oo-ui-iconElement-icon { left: 0; top: 0.25em; width: 1.875em; height: 1.875em; } .oo-ui-fieldsetLayout > .oo-ui-popupButtonWidget { margin-right: 0; } .oo-ui-fieldsetLayout > .oo-ui-popupButtonWidget:last-child { margin-right: 0; } .oo-ui-formLayout + .oo-ui-fieldsetLayout, .oo-ui-formLayout + .oo-ui-formLayout { margin-top: 2em; } .oo-ui-menuLayout { position: absolute; top: 0; left: 0; right: 0; bottom: 0; } .oo-ui-menuLayout-menu, .oo-ui-menuLayout-content { position: absolute; -webkit-transition: all 200ms ease; -moz-transition: all 200ms ease; transition: all 200ms ease; } .oo-ui-menuLayout-menu { height: 18em; width: 18em; } .oo-ui-menuLayout-content { top: 18em; left: 18em; right: 18em; bottom: 18em; } .oo-ui-menuLayout.oo-ui-menuLayout-hideMenu > .oo-ui-menuLayout-menu { width: 0 !important; height: 0 !important; overflow: hidden; } .oo-ui-menuLayout.oo-ui-menuLayout-hideMenu > .oo-ui-menuLayout-content { top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important; } .oo-ui-menuLayout.oo-ui-menuLayout-showMenu.oo-ui-menuLayout-top > .oo-ui-menuLayout-menu { width: auto !important; left: 0; top: 0; right: 0; } .oo-ui-menuLayout.oo-ui-menuLayout-showMenu.oo-ui-menuLayout-top > .oo-ui-menuLayout-content { right: 0 !important; bottom: 0 !important; left: 0 !important; } .oo-ui-menuLayout.oo-ui-menuLayout-showMenu.oo-ui-menuLayout-after > .oo-ui-menuLayout-menu { height: auto !important; top: 0; right: 0; bottom: 0; } .oo-ui-menuLayout.oo-ui-menuLayout-showMenu.oo-ui-menuLayout-after > .oo-ui-menuLayout-content { bottom: 0 !important; left: 0 !important; top: 0 !important; } .oo-ui-menuLayout.oo-ui-menuLayout-showMenu.oo-ui-menuLayout-bottom > .oo-ui-menuLayout-menu { width: auto !important; right: 0; bottom: 0; left: 0; } .oo-ui-menuLayout.oo-ui-menuLayout-showMenu.oo-ui-menuLayout-bottom > .oo-ui-menuLayout-content { left: 0 !important; top: 0 !important; right: 0 !important; } .oo-ui-menuLayout.oo-ui-menuLayout-showMenu.oo-ui-menuLayout-before > .oo-ui-menuLayout-menu { height: auto !important; bottom: 0; left: 0; top: 0; } .oo-ui-menuLayout.oo-ui-menuLayout-showMenu.oo-ui-menuLayout-before > .oo-ui-menuLayout-content { top: 0 !important; right: 0 !important; bottom: 0 !important; } .oo-ui-panelLayout { position: relative; } .oo-ui-panelLayout-scrollable { overflow-y: auto; } .oo-ui-panelLayout-expanded { position: absolute; top: 0; left: 0; right: 0; bottom: 0; } .oo-ui-panelLayout-padded { padding: 1.25em; } .oo-ui-panelLayout-framed { border: 1px solid #aaaaaa; border-radius: 2px; box-shadow: 0 0.15em 0 0 rgba(0, 0, 0, 0.15); } .oo-ui-panelLayout-padded.oo-ui-panelLayout-framed { margin: 1em 0; } .oo-ui-stackLayout-continuous > .oo-ui-panelLayout { display: block; position: relative; } .oo-ui-horizontalLayout > .oo-ui-widget { display: inline-block; vertical-align: middle; } .oo-ui-horizontalLayout > .oo-ui-layout { display: inline-block; } .oo-ui-horizontalLayout > .oo-ui-layout, .oo-ui-horizontalLayout > .oo-ui-widget { margin-right: 0.5em; } .oo-ui-horizontalLayout > .oo-ui-layout:last-child, .oo-ui-horizontalLayout > .oo-ui-widget:last-child { margin-right: 0; } .oo-ui-horizontalLayout > .oo-ui-layout { margin-bottom: 0; } .oo-ui-popupTool .oo-ui-popupWidget-popup, .oo-ui-popupTool .oo-ui-popupWidget-anchor { z-index: 4; } .oo-ui-popupTool .oo-ui-popupWidget { /* @noflip */ margin-left: 1.25em; } .oo-ui-toolGroupTool > .oo-ui-popupToolGroup { border: 0; border-radius: 0; margin: 0; } .oo-ui-toolGroupTool > .oo-ui-toolGroup { border-right: none; } .oo-ui-toolGroupTool > .oo-ui-popupToolGroup > .oo-ui-popupToolGroup-handle { height: 2.5em; padding: 0.3125em; } .oo-ui-toolGroupTool > .oo-ui-popupToolGroup > .oo-ui-popupToolGroup-handle .oo-ui-iconElement-icon { height: 2.5em; width: 1.875em; } .oo-ui-toolGroupTool > .oo-ui-popupToolGroup.oo-ui-labelElement > .oo-ui-popupToolGroup-handle .oo-ui-labelElement-label { line-height: 2.1em; } .oo-ui-toolGroup { display: inline-block; vertical-align: middle; border-radius: 0; border-right: 1px solid #dddddd; } .oo-ui-toolGroup-empty { display: none; } .oo-ui-toolGroup .oo-ui-tool-link { text-decoration: none; } .oo-ui-toolbar-narrow .oo-ui-toolGroup + .oo-ui-toolGroup { margin-left: 0; } .oo-ui-toolGroup .oo-ui-toolGroup .oo-ui-widget-enabled { border-right: none !important; } .oo-ui-barToolGroup > .oo-ui-iconElement-icon, .oo-ui-barToolGroup > .oo-ui-labelElement-label { display: none; } .oo-ui-barToolGroup.oo-ui-widget-enabled > .oo-ui-toolGroup-tools > .oo-ui-tool > .oo-ui-tool-link { cursor: pointer; } .oo-ui-barToolGroup > .oo-ui-toolGroup-tools > .oo-ui-tool { display: inline-block; position: relative; vertical-align: top; } .oo-ui-barToolGroup > .oo-ui-toolGroup-tools > .oo-ui-tool > .oo-ui-tool-link { display: block; } .oo-ui-barToolGroup > .oo-ui-toolGroup-tools > .oo-ui-tool > .oo-ui-tool-link .oo-ui-tool-accel { display: none; } .oo-ui-barToolGroup > .oo-ui-toolGroup-tools > .oo-ui-tool.oo-ui-iconElement > .oo-ui-tool-link .oo-ui-iconElement-icon { display: inline-block; vertical-align: top; } .oo-ui-barToolGroup > .oo-ui-toolGroup-tools > .oo-ui-tool.oo-ui-iconElement > .oo-ui-tool-link .oo-ui-tool-title { display: none; } .oo-ui-barToolGroup > .oo-ui-toolGroup-tools > .oo-ui-tool.oo-ui-iconElement.oo-ui-tool-with-label > .oo-ui-tool-link .oo-ui-tool-title { display: inline; } .oo-ui-barToolGroup > .oo-ui-toolGroup-tools > .oo-ui-tool.oo-ui-widget-disabled > .oo-ui-tool-link { outline: 0; cursor: default; } .oo-ui-barToolGroup > .oo-ui-toolGroup-tools > .oo-ui-tool > .oo-ui-tool-link { height: 1.875em; padding: 0.625em; } .oo-ui-barToolGroup > .oo-ui-toolGroup-tools > .oo-ui-tool > .oo-ui-tool-link .oo-ui-iconElement-icon { height: 1.875em; width: 1.875em; } .oo-ui-barToolGroup > .oo-ui-toolGroup-tools > .oo-ui-tool > .oo-ui-tool-link .oo-ui-tool-title { line-height: 2.1em; padding: 0 0.4em; } .oo-ui-barToolGroup.oo-ui-widget-enabled > .oo-ui-toolGroup-tools > .oo-ui-tool.oo-ui-widget-enabled:hover { border-color: rgba(0, 0, 0, 0.2); background-color: #eeeeee; } .oo-ui-barToolGroup.oo-ui-widget-enabled > .oo-ui-toolGroup-tools > .oo-ui-tool > a.oo-ui-tool-link .oo-ui-tool-title { color: #555555; } .oo-ui-barToolGroup.oo-ui-widget-enabled > .oo-ui-toolGroup-tools > .oo-ui-tool.oo-ui-tool-active.oo-ui-widget-enabled { border-color: rgba(0, 0, 0, 0.2); box-shadow: inset 0 0.07em 0.07em 0 rgba(0, 0, 0, 0.07); background-color: #e5e5e5; } .oo-ui-barToolGroup.oo-ui-widget-enabled > .oo-ui-toolGroup-tools > .oo-ui-tool.oo-ui-tool-active.oo-ui-widget-enabled:hover { background-color: #eeeeee; } .oo-ui-barToolGroup.oo-ui-widget-enabled > .oo-ui-toolGroup-tools > .oo-ui-tool.oo-ui-tool-active.oo-ui-widget-enabled + .oo-ui-tool-active.oo-ui-widget-enabled { border-left-color: rgba(0, 0, 0, 0.1); } .oo-ui-barToolGroup.oo-ui-widget-enabled > .oo-ui-toolGroup-tools > .oo-ui-tool.oo-ui-widget-disabled > .oo-ui-tool-link .oo-ui-tool-title { color: #cccccc; } .oo-ui-barToolGroup.oo-ui-widget-enabled > .oo-ui-toolGroup-tools > .oo-ui-tool.oo-ui-widget-disabled > .oo-ui-tool-link .oo-ui-iconElement-icon { opacity: 0.2; } .oo-ui-barToolGroup.oo-ui-widget-enabled > .oo-ui-toolGroup-tools > .oo-ui-tool.oo-ui-widget-enabled > .oo-ui-tool-link .oo-ui-iconElement-icon { opacity: 0.7; } .oo-ui-barToolGroup.oo-ui-widget-enabled > .oo-ui-toolGroup-tools > .oo-ui-tool.oo-ui-widget-enabled:hover > .oo-ui-tool-link .oo-ui-iconElement-icon { opacity: 0.9; } .oo-ui-barToolGroup.oo-ui-widget-enabled > .oo-ui-toolGroup-tools > .oo-ui-tool.oo-ui-widget-enabled:active { background-color: #e7e7e7; } .oo-ui-barToolGroup.oo-ui-widget-disabled > .oo-ui-toolGroup-tools > .oo-ui-tool > a.oo-ui-tool-link .oo-ui-tool-title { color: #cccccc; } .oo-ui-barToolGroup.oo-ui-widget-disabled > .oo-ui-toolGroup-tools > .oo-ui-tool > a.oo-ui-tool-link .oo-ui-iconElement-icon { opacity: 0.2; } .oo-ui-popupToolGroup { position: relative; height: 3.125em; min-width: 2em; } .oo-ui-popupToolGroup-handle { display: block; cursor: pointer; } .oo-ui-popupToolGroup-handle .oo-ui-indicatorElement-indicator, .oo-ui-popupToolGroup-handle .oo-ui-iconElement-icon { position: absolute; } .oo-ui-popupToolGroup.oo-ui-widget-disabled .oo-ui-popupToolGroup-handle { outline: 0; cursor: default; } .oo-ui-popupToolGroup .oo-ui-toolGroup-tools { display: none; position: absolute; z-index: 4; } .oo-ui-popupToolGroup-active.oo-ui-widget-enabled > .oo-ui-toolGroup-tools { display: block; } .oo-ui-popupToolGroup-left > .oo-ui-toolGroup-tools { left: 0; } .oo-ui-popupToolGroup-right > .oo-ui-toolGroup-tools { right: 0; } .oo-ui-popupToolGroup .oo-ui-tool-link { display: table; width: 100%; vertical-align: middle; white-space: nowrap; } .oo-ui-popupToolGroup .oo-ui-tool-link .oo-ui-iconElement-icon, .oo-ui-popupToolGroup .oo-ui-tool-link .oo-ui-tool-accel, .oo-ui-popupToolGroup .oo-ui-tool-link .oo-ui-tool-title { display: table-cell; vertical-align: middle; } .oo-ui-popupToolGroup .oo-ui-tool-link .oo-ui-tool-accel { text-align: right; } .oo-ui-popupToolGroup .oo-ui-tool-link .oo-ui-tool-accel:not(:empty) { padding-left: 3em; } .oo-ui-toolbar-narrow .oo-ui-popupToolGroup { min-width: 1.875em; } .oo-ui-popupToolGroup.oo-ui-iconElement { min-width: 3.125em; } .oo-ui-toolbar-narrow .oo-ui-popupToolGroup.oo-ui-iconElement { min-width: 2.5em; } .oo-ui-popupToolGroup.oo-ui-indicatorElement.oo-ui-iconElement { min-width: 4.375em; } .oo-ui-toolbar-narrow .oo-ui-popupToolGroup.oo-ui-indicatorElement.oo-ui-iconElement { min-width: 3.75em; } .oo-ui-popupToolGroup.oo-ui-labelElement .oo-ui-popupToolGroup-handle .oo-ui-labelElement-label { line-height: 2.6em; margin: 0 1em; } .oo-ui-toolbar-narrow .oo-ui-popupToolGroup.oo-ui-labelElement .oo-ui-popupToolGroup-handle .oo-ui-labelElement-label { margin: 0 0.5em; } .oo-ui-popupToolGroup.oo-ui-labelElement.oo-ui-iconElement .oo-ui-popupToolGroup-handle .oo-ui-labelElement-label { margin-left: 3em; } .oo-ui-toolbar-narrow .oo-ui-popupToolGroup.oo-ui-labelElement.oo-ui-iconElement .oo-ui-popupToolGroup-handle .oo-ui-labelElement-label { margin-left: 2.5em; } .oo-ui-popupToolGroup.oo-ui-labelElement.oo-ui-indicatorElement .oo-ui-popupToolGroup-handle .oo-ui-labelElement-label { margin-right: 2em; } .oo-ui-toolbar-narrow .oo-ui-popupToolGroup.oo-ui-labelElement.oo-ui-indicatorElement .oo-ui-popupToolGroup-handle .oo-ui-labelElement-label { margin-right: 1.75em; } .oo-ui-popupToolGroup.oo-ui-widget-enabled .oo-ui-popupToolGroup-handle:hover { background-color: #eeeeee; } .oo-ui-popupToolGroup.oo-ui-widget-enabled .oo-ui-popupToolGroup-handle:active { background-color: #e5e5e5; } .oo-ui-popupToolGroup-handle { padding: 0.3125em; height: 2.5em; } .oo-ui-popupToolGroup-handle .oo-ui-indicatorElement-indicator { width: 0.9375em; height: 1.625em; margin: 0.78125em 0.5em; top: 0; right: 0; opacity: 0.3; } .oo-ui-toolbar-narrow .oo-ui-popupToolGroup-handle .oo-ui-indicatorElement-indicator { right: -0.3125em; } .oo-ui-popupToolGroup-handle .oo-ui-iconElement-icon { width: 1.875em; height: 2.6em; margin: 0.25em; top: 0; left: 0.3125em; opacity: 0.7; } .oo-ui-toolbar-narrow .oo-ui-popupToolGroup-handle .oo-ui-iconElement-icon { left: 0; } .oo-ui-popupToolGroup-header { line-height: 2.6em; margin: 0 0.6em; font-weight: bold; } .oo-ui-popupToolGroup-active.oo-ui-widget-enabled { border-bottom-left-radius: 0; border-bottom-right-radius: 0; box-shadow: inset 0 0.07em 0.07em 0 rgba(0, 0, 0, 0.07); background-color: #eeeeee; } .oo-ui-popupToolGroup .oo-ui-toolGroup-tools { top: 3.125em; margin: 0 -1px; border: 1px solid #cccccc; background-color: #ffffff; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2); min-width: 16em; } .oo-ui-popupToolGroup .oo-ui-tool-link { padding: 0.4em 0.625em; box-sizing: border-box; } .oo-ui-popupToolGroup .oo-ui-tool-link .oo-ui-iconElement-icon { height: 2.5em; width: 1.875em; min-width: 1.875em; } .oo-ui-popupToolGroup .oo-ui-tool-link .oo-ui-tool-title { padding-left: 0.5em; color: #555555; } .oo-ui-popupToolGroup .oo-ui-tool-link .oo-ui-tool-accel, .oo-ui-popupToolGroup .oo-ui-tool-link .oo-ui-tool-title { line-height: 2em; } .oo-ui-popupToolGroup .oo-ui-tool-link .oo-ui-tool-accel { color: #888888; } .oo-ui-listToolGroup .oo-ui-tool { display: block; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .oo-ui-listToolGroup .oo-ui-tool-link { cursor: pointer; } .oo-ui-listToolGroup .oo-ui-tool.oo-ui-widget-disabled .oo-ui-tool-link { cursor: default; } .oo-ui-listToolGroup.oo-ui-popupToolGroup-active { border-color: rgba(0, 0, 0, 0.2); } .oo-ui-listToolGroup .oo-ui-tool.oo-ui-widget-enabled:hover { border-color: rgba(0, 0, 0, 0.2); background-color: #eeeeee; } .oo-ui-listToolGroup .oo-ui-tool.oo-ui-widget-enabled:active { background-color: #e7e7e7; } .oo-ui-listToolGroup .oo-ui-tool.oo-ui-widget-enabled:hover .oo-ui-tool-link .oo-ui-iconElement-icon { opacity: 0.9; } .oo-ui-listToolGroup .oo-ui-tool-active.oo-ui-widget-enabled { border-color: rgba(0, 0, 0, 0.1); box-shadow: inset 0 0.07em 0.07em 0 rgba(0, 0, 0, 0.07); background-color: #e5e5e5; } .oo-ui-listToolGroup .oo-ui-tool-active.oo-ui-widget-enabled + .oo-ui-tool-active.oo-ui-widget-enabled { border-top-color: rgba(0, 0, 0, 0.1); } .oo-ui-listToolGroup .oo-ui-tool-active.oo-ui-widget-enabled:hover { border-color: rgba(0, 0, 0, 0.2); background-color: #eeeeee; } .oo-ui-listToolGroup .oo-ui-tool.oo-ui-widget-disabled .oo-ui-tool-link .oo-ui-tool-title { color: #cccccc; } .oo-ui-listToolGroup .oo-ui-tool.oo-ui-widget-disabled .oo-ui-tool-link .oo-ui-tool-accel { color: #dddddd; } .oo-ui-listToolGroup .oo-ui-tool.oo-ui-widget-disabled .oo-ui-tool-link .oo-ui-iconElement-icon { opacity: 0.2; } .oo-ui-listToolGroup.oo-ui-widget-disabled { color: #cccccc; } .oo-ui-listToolGroup.oo-ui-widget-disabled .oo-ui-indicatorElement-indicator, .oo-ui-listToolGroup.oo-ui-widget-disabled .oo-ui-iconElement-icon { opacity: 0.2; } .oo-ui-menuToolGroup .oo-ui-tool { display: block; } .oo-ui-menuToolGroup .oo-ui-tool-link { cursor: pointer; } .oo-ui-menuToolGroup .oo-ui-tool.oo-ui-widget-disabled .oo-ui-tool-link { cursor: default; } .oo-ui-menuToolGroup .oo-ui-popupToolGroup-handle { min-width: 10em; } .oo-ui-toolbar-narrow .oo-ui-menuToolGroup .oo-ui-popupToolGroup-handle { min-width: 8.125em; } .oo-ui-menuToolGroup .oo-ui-tool-link .oo-ui-iconElement-icon { background-image: none; } .oo-ui-menuToolGroup .oo-ui-tool-active .oo-ui-tool-link .oo-ui-iconElement-icon { background-image: url("themes/mediawiki/images/icons/check.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/check.png"); background-size: contain; background-position: center center; background-repeat: no-repeat; } .oo-ui-menuToolGroup .oo-ui-tool.oo-ui-widget-enabled:hover { background-color: #eeeeee; } .oo-ui-menuToolGroup .oo-ui-tool.oo-ui-widget-disabled .oo-ui-tool-link .oo-ui-tool-title { color: #cccccc; } .oo-ui-menuToolGroup .oo-ui-tool.oo-ui-widget-disabled .oo-ui-tool-link .oo-ui-iconElement-icon { opacity: 0.2; } .oo-ui-menuToolGroup.oo-ui-widget-disabled { color: #cccccc; } .oo-ui-menuToolGroup.oo-ui-widget-disabled .oo-ui-indicatorElement-indicator, .oo-ui-menuToolGroup.oo-ui-widget-disabled .oo-ui-iconElement-icon { opacity: 0.2; } .oo-ui-toolbar { clear: both; } .oo-ui-toolbar-bar { line-height: 1em; position: relative; } .oo-ui-toolbar-actions { float: right; } .oo-ui-toolbar-actions .oo-ui-toolbar { display: inline-block; } .oo-ui-toolbar-tools { display: inline; white-space: nowrap; } .oo-ui-toolbar-narrow .oo-ui-toolbar-tools { white-space: normal; } .oo-ui-toolbar-tools .oo-ui-tool { white-space: normal; } .oo-ui-toolbar-tools, .oo-ui-toolbar-actions, .oo-ui-toolbar-shadow { -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .oo-ui-toolbar-actions .oo-ui-popupWidget { -webkit-touch-callout: default; -webkit-user-select: all; -moz-user-select: all; -ms-user-select: all; user-select: all; } .oo-ui-toolbar-shadow { background-position: left top; background-repeat: repeat-x; position: absolute; width: 100%; pointer-events: none; } .oo-ui-toolbar-bar { border-bottom: 1px solid #cccccc; background-color: #ffffff; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); font-weight: 500; color: #555555; } .oo-ui-toolbar-bar .oo-ui-toolbar-bar { border: 0; background: none; box-shadow: none; } .oo-ui-toolbar-actions > .oo-ui-buttonElement.oo-ui-labelElement { margin: 0; } .oo-ui-toolbar-actions > .oo-ui-buttonElement.oo-ui-labelElement > .oo-ui-buttonElement-button { border: 0; border-radius: 0; margin: 0; padding: 0 0.3125em; } .oo-ui-toolbar-actions > .oo-ui-buttonElement.oo-ui-labelElement > .oo-ui-buttonElement-button > .oo-ui-labelElement-label { margin: 0 1em; line-height: 3.125em; } .oo-ui-optionWidget { position: relative; display: block; padding: 0.25em 0.5em; border: 0; } .oo-ui-optionWidget.oo-ui-widget-enabled { cursor: pointer; } .oo-ui-optionWidget.oo-ui-labelElement .oo-ui-labelElement-label { display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .oo-ui-optionWidget-highlighted { background-color: #eeeeee; } .oo-ui-optionWidget .oo-ui-labelElement-label { line-height: 1.5em; } .oo-ui-selectWidget-depressed .oo-ui-optionWidget-selected, .oo-ui-selectWidget-pressed .oo-ui-optionWidget-pressed, .oo-ui-selectWidget-pressed .oo-ui-optionWidget-pressed.oo-ui-optionWidget-highlighted, .oo-ui-selectWidget-pressed .oo-ui-optionWidget-pressed.oo-ui-optionWidget-highlighted.oo-ui-optionWidget-selected { background-color: #d0d0d0; } .oo-ui-optionWidget.oo-ui-widget-disabled { color: #cccccc; } .oo-ui-decoratedOptionWidget { padding: 0.5em 2em 0.5em 3em; } .oo-ui-decoratedOptionWidget .oo-ui-iconElement-icon, .oo-ui-decoratedOptionWidget .oo-ui-indicatorElement-indicator { position: absolute; } .oo-ui-decoratedOptionWidget.oo-ui-iconElement .oo-ui-iconElement-icon, .oo-ui-decoratedOptionWidget.oo-ui-indicatorElement .oo-ui-indicatorElement-indicator { top: 0; height: 100%; } .oo-ui-decoratedOptionWidget.oo-ui-iconElement .oo-ui-iconElement-icon { width: 1.875em; left: 0.5em; } .oo-ui-decoratedOptionWidget.oo-ui-indicatorElement .oo-ui-indicatorElement-indicator { width: 0.9375em; right: 0.5em; } .oo-ui-decoratedOptionWidget.oo-ui-widget-disabled .oo-ui-iconElement-icon, .oo-ui-decoratedOptionWidget.oo-ui-widget-disabled .oo-ui-indicatorElement-indicator { opacity: 0.2; } .oo-ui-buttonSelectWidget { display: inline-block; white-space: nowrap; border-radius: 2px; margin-right: 0.5em; } .oo-ui-buttonSelectWidget:last-child { margin-right: 0; } .oo-ui-buttonSelectWidget .oo-ui-buttonOptionWidget .oo-ui-buttonElement-button { border-radius: 0; margin-left: -1px; } .oo-ui-buttonSelectWidget .oo-ui-buttonOptionWidget:first-child .oo-ui-buttonElement-button { border-bottom-left-radius: 2px; border-top-left-radius: 2px; margin-left: 0; } .oo-ui-buttonSelectWidget .oo-ui-buttonOptionWidget:last-child .oo-ui-buttonElement-button { border-bottom-right-radius: 2px; border-top-right-radius: 2px; } .oo-ui-buttonOptionWidget { display: inline-block; padding: 0; background-color: transparent; } .oo-ui-buttonOptionWidget .oo-ui-buttonElement-button { position: relative; } .oo-ui-buttonOptionWidget.oo-ui-iconElement .oo-ui-iconElement-icon, .oo-ui-buttonOptionWidget.oo-ui-indicatorElement .oo-ui-indicatorElement-indicator { position: static; display: inline-block; vertical-align: middle; } .oo-ui-buttonOptionWidget.oo-ui-iconElement .oo-ui-iconElement-icon { margin-top: 0; } .oo-ui-buttonOptionWidget.oo-ui-optionWidget-selected, .oo-ui-buttonOptionWidget.oo-ui-optionWidget-pressed, .oo-ui-buttonOptionWidget.oo-ui-optionWidget-highlighted { background-color: transparent; } .oo-ui-buttonOptionWidget.oo-ui-widget-disabled .oo-ui-iconElement-icon, .oo-ui-buttonOptionWidget.oo-ui-widget-disabled .oo-ui-indicatorElement-indicator { opacity: 1; } .oo-ui-radioOptionWidget { cursor: default; padding: 0.25em 0; background-color: transparent; } .oo-ui-radioOptionWidget .oo-ui-radioInputWidget, .oo-ui-radioOptionWidget.oo-ui-labelElement .oo-ui-labelElement-label { display: inline-block; vertical-align: middle; } .oo-ui-radioOptionWidget.oo-ui-optionWidget-selected, .oo-ui-radioOptionWidget.oo-ui-optionWidget-pressed, .oo-ui-radioOptionWidget.oo-ui-optionWidget-highlighted { background-color: transparent; } .oo-ui-radioOptionWidget.oo-ui-labelElement .oo-ui-labelElement-label { padding: 0.25em 0.25em 0.25em 1em; } .oo-ui-radioOptionWidget .oo-ui-radioInputWidget { margin-right: 0; } .oo-ui-labelWidget { display: inline-block; } .oo-ui-iconWidget { display: inline-block; vertical-align: middle; line-height: 2.5em; width: 1.875em; height: 1.875em; } .oo-ui-iconWidget.oo-ui-widget-disabled { opacity: 0.2; } .oo-ui-indicatorWidget { display: inline-block; vertical-align: middle; line-height: 2.5em; width: 0.9375em; height: 0.9375em; margin: 0.46875em; } .oo-ui-indicatorWidget.oo-ui-widget-disabled { opacity: 0.2; } .oo-ui-buttonWidget { display: inline-block; vertical-align: middle; margin-right: 0.5em; } .oo-ui-buttonWidget:last-child { margin-right: 0; } .oo-ui-buttonGroupWidget { display: inline-block; white-space: nowrap; border-radius: 2px; margin-right: 0.5em; } .oo-ui-buttonGroupWidget:last-child { margin-right: 0; } .oo-ui-buttonGroupWidget .oo-ui-buttonElement { margin-right: 0; } .oo-ui-buttonGroupWidget .oo-ui-buttonElement:last-child { margin-right: 0; } .oo-ui-buttonGroupWidget .oo-ui-buttonElement-framed .oo-ui-buttonElement-button { border-radius: 0; margin-left: -1px; } .oo-ui-buttonGroupWidget .oo-ui-buttonElement-framed:first-child .oo-ui-buttonElement-button { border-bottom-left-radius: 2px; border-top-left-radius: 2px; margin-left: 0; } .oo-ui-buttonGroupWidget .oo-ui-buttonElement-framed:last-child .oo-ui-buttonElement-button { border-bottom-right-radius: 2px; border-top-right-radius: 2px; } .oo-ui-toggleButtonWidget { display: inline-block; vertical-align: middle; margin-right: 0.5em; } .oo-ui-toggleButtonWidget:last-child { margin-right: 0; } .oo-ui-toggleSwitchWidget { position: relative; display: inline-block; vertical-align: middle; overflow: hidden; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; -webkit-transform: translateZ(0); -moz-transform: translateZ(0); -ms-transform: translateZ(0); transform: translateZ(0); height: 2em; width: 3.5em; border: 1px solid #777777; border-radius: 1em; background-color: #ffffff; margin-right: 0.5em; -webkit-transition: background-color 100ms ease, border-color 100ms ease; -moz-transition: background-color 100ms ease, border-color 100ms ease; transition: background-color 100ms ease, border-color 100ms ease; } .oo-ui-toggleSwitchWidget.oo-ui-widget-enabled { cursor: pointer; } .oo-ui-toggleSwitchWidget-grip { position: absolute; display: block; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .oo-ui-toggleSwitchWidget .oo-ui-toggleSwitchWidget-glow { position: absolute; top: 0; bottom: 0; right: 0; left: 0; -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .oo-ui-toggleWidget-off .oo-ui-toggleSwitchWidget-glow { display: none; } .oo-ui-toggleSwitchWidget:last-child { margin-right: 0; } .oo-ui-toggleSwitchWidget:before { content: ""; display: block; position: absolute; top: 0; left: 0; bottom: 0; right: 0; border: 1px solid transparent; border-radius: 1em; z-index: 1; } .oo-ui-toggleSwitchWidget-grip { top: 0.35em; width: 1.2em; height: 1.2em; border-radius: 1.2em; background-color: #555555; -webkit-transition: left 100ms ease, margin-left 100ms ease; -moz-transition: left 100ms ease, margin-left 100ms ease; transition: left 100ms ease, margin-left 100ms ease; } .oo-ui-toggleSwitchWidget-glow { display: none; } .oo-ui-toggleSwitchWidget.oo-ui-toggleWidget-on .oo-ui-toggleSwitchWidget-grip { left: 1.9em; margin-left: -2px; } .oo-ui-toggleSwitchWidget.oo-ui-toggleWidget-off .oo-ui-toggleSwitchWidget-grip { left: 0.4em; margin-left: 0; } .oo-ui-toggleSwitchWidget.oo-ui-widget-enabled.oo-ui-toggleWidget-on { background-color: #347bff; border-color: #347bff; } .oo-ui-toggleSwitchWidget.oo-ui-widget-enabled.oo-ui-toggleWidget-on .oo-ui-toggleSwitchWidget-grip { background-color: #ffffff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1); } .oo-ui-toggleSwitchWidget.oo-ui-widget-enabled:hover { border-color: #2962cc; } .oo-ui-toggleSwitchWidget.oo-ui-widget-enabled:hover.oo-ui-toggleWidget-on { background-color: #2962cc; border-color: #2962cc; } .oo-ui-toggleSwitchWidget.oo-ui-widget-enabled:focus { border-color: #347bff; outline: none; } .oo-ui-toggleSwitchWidget.oo-ui-widget-enabled:focus.oo-ui-toggleWidget-on { border-color: #347bff; } .oo-ui-toggleSwitchWidget.oo-ui-widget-enabled:focus.oo-ui-toggleWidget-on:before { border-color: #ffffff; } .oo-ui-toggleSwitchWidget.oo-ui-widget-enabled:active, .oo-ui-toggleSwitchWidget.oo-ui-widget-enabled:active:hover { background-color: #347bff; border-color: #347bff; } .oo-ui-toggleSwitchWidget.oo-ui-widget-enabled:active .oo-ui-toggleSwitchWidget-grip, .oo-ui-toggleSwitchWidget.oo-ui-widget-enabled:active:hover .oo-ui-toggleSwitchWidget-grip { background-color: #ffffff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1); } .oo-ui-toggleSwitchWidget.oo-ui-widget-disabled { background: #dddddd; border-color: #dddddd; outline: 0; } .oo-ui-toggleSwitchWidget.oo-ui-widget-disabled .oo-ui-toggleSwitchWidget-grip { background: #ffffff; } .oo-ui-progressBarWidget { max-width: 50em; background-color: #ffffff; border: 1px solid #cccccc; border-radius: 2px; overflow: hidden; } .oo-ui-progressBarWidget-bar { height: 1em; background: #dddddd; -webkit-transition: width 200ms, margin-left 200ms; -moz-transition: width 200ms, margin-left 200ms; transition: width 200ms, margin-left 200ms; } .oo-ui-progressBarWidget-indeterminate .oo-ui-progressBarWidget-bar { -webkit-animation: oo-ui-progressBarWidget-slide 2s infinite linear; -moz-animation: oo-ui-progressBarWidget-slide 2s infinite linear; animation: oo-ui-progressBarWidget-slide 2s infinite linear; width: 40%; margin-left: -10%; border-left-width: 1px; } .oo-ui-progressBarWidget.oo-ui-widget-disabled { opacity: 0.6; } .oo-ui-popupWidget { position: absolute; /* @noflip */ left: 0; } .oo-ui-popupWidget-popup { position: relative; overflow: hidden; z-index: 1; } .oo-ui-popupWidget-anchor { display: none; z-index: 1; } .oo-ui-popupWidget-anchored .oo-ui-popupWidget-anchor { display: block; position: absolute; top: 0; /* @noflip */ left: 0; background-repeat: no-repeat; } .oo-ui-popupWidget-head { -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .oo-ui-popupWidget-head > .oo-ui-buttonWidget { float: right; } .oo-ui-popupWidget-head > .oo-ui-labelElement-label { float: left; cursor: default; } .oo-ui-popupWidget-body { clear: both; overflow: hidden; } .oo-ui-popupWidget-popup { background-color: #ffffff; border: 1px solid #aaaaaa; border-radius: 2px; box-shadow: 0 0.15em 0 0 rgba(0, 0, 0, 0.15); } .oo-ui-popupWidget-anchored .oo-ui-popupWidget-popup { margin-top: 9px; } .oo-ui-popupWidget-anchored .oo-ui-popupWidget-anchor:before, .oo-ui-popupWidget-anchored .oo-ui-popupWidget-anchor:after { content: ""; position: absolute; width: 0; height: 0; border-style: solid; border-color: transparent; border-top: 0; } .oo-ui-popupWidget-anchored .oo-ui-popupWidget-anchor:before { bottom: -10px; left: -9px; border-bottom-color: #888888; border-width: 10px; } .oo-ui-popupWidget-anchored .oo-ui-popupWidget-anchor:after { bottom: -10px; left: -8px; border-bottom-color: #ffffff; border-width: 9px; } .oo-ui-popupWidget-transitioning .oo-ui-popupWidget-popup { -webkit-transition: width 100ms ease, height 100ms ease, left 100ms ease; -moz-transition: width 100ms ease, height 100ms ease, left 100ms ease; transition: width 100ms ease, height 100ms ease, left 100ms ease; } .oo-ui-popupWidget-head { height: 2.5em; } .oo-ui-popupWidget-head > .oo-ui-buttonWidget { margin: 0.25em; } .oo-ui-popupWidget-head > .oo-ui-labelElement-label { margin: 0.75em 1em; } .oo-ui-popupWidget-body-padded { padding: 0 1em; } .oo-ui-popupButtonWidget { position: relative; } .oo-ui-popupButtonWidget .oo-ui-popupWidget { position: absolute; cursor: auto; } .oo-ui-popupButtonWidget.oo-ui-buttonElement-frameless > .oo-ui-popupWidget { /* @noflip */ left: 1em; } .oo-ui-popupButtonWidget.oo-ui-buttonElement-framed > .oo-ui-popupWidget { /* @noflip */ left: 1.75em; } .oo-ui-inputWidget { margin-right: 0.5em; } .oo-ui-inputWidget:last-child { margin-right: 0; } .oo-ui-buttonInputWidget { display: inline-block; vertical-align: middle; } .oo-ui-buttonInputWidget > button, .oo-ui-buttonInputWidget > input { border: 0; padding: 0; background-color: transparent; } .oo-ui-checkboxInputWidget { position: relative; line-height: 1.6em; white-space: nowrap; } .oo-ui-checkboxInputWidget * { font: inherit; vertical-align: middle; } .oo-ui-checkboxInputWidget input[type="checkbox"] { opacity: 0; z-index: 1; position: relative; cursor: pointer; margin: 0; width: 1.6em; height: 1.6em; max-width: none; } .oo-ui-checkboxInputWidget input[type="checkbox"] + span { -webkit-transition: background-size 200ms cubic-bezier(0.175, 0.885, 0.32, 1.275); -moz-transition: background-size 200ms cubic-bezier(0.175, 0.885, 0.32, 1.275); transition: background-size 200ms cubic-bezier(0.175, 0.885, 0.32, 1.275); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; position: absolute; left: 0; border-radius: 2px; width: 1.6em; height: 1.6em; background-color: white; border: 1px solid #777777; background-image: url("themes/mediawiki/images/icons/check-constructive.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check-constructive.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check-constructive.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/check-constructive.png"); background-repeat: no-repeat; background-position: center center; background-origin: border-box; background-size: 0 0; } .oo-ui-checkboxInputWidget input[type="checkbox"]:checked + span { background-size: 100% 100%; } .oo-ui-checkboxInputWidget input[type="checkbox"]:active + span { background-color: #cccccc; border-color: #cccccc; } .oo-ui-checkboxInputWidget input[type="checkbox"]:focus + span { border-width: 2px; } .oo-ui-checkboxInputWidget input[type="checkbox"]:focus:hover + span, .oo-ui-checkboxInputWidget input[type="checkbox"]:hover + span { border-bottom-width: 3px; } .oo-ui-checkboxInputWidget input[type="checkbox"]:disabled { cursor: default; } .oo-ui-checkboxInputWidget input[type="checkbox"]:disabled + span { background-color: #dddddd; border-color: #dddddd; } .oo-ui-checkboxInputWidget input[type="checkbox"]:disabled:checked + span { background-image: url("themes/mediawiki/images/icons/check-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/check-invert.png"); } .oo-ui-dropdownInputWidget { position: relative; vertical-align: middle; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; width: 100%; max-width: 50em; } .oo-ui-dropdownInputWidget select { display: inline-block; width: 100%; resize: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .oo-ui-dropdownInputWidget select { background-color: #ffffff; height: 2.275em; font-size: inherit; font-family: inherit; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; border: 1px solid #cccccc; border-radius: 2px; padding-left: 1em; vertical-align: middle; } .oo-ui-dropdownInputWidget.oo-ui-widget-enabled select:hover, .oo-ui-dropdownInputWidget.oo-ui-widget-enabled select:focus { border-color: #aaaaaa; outline: none; } .oo-ui-dropdownInputWidget.oo-ui-widget-disabled select { color: #cccccc; border-color: #dddddd; background-color: #f3f3f3; } .oo-ui-radioInputWidget { position: relative; line-height: 1.6em; white-space: nowrap; } .oo-ui-radioInputWidget * { font: inherit; vertical-align: middle; } .oo-ui-radioInputWidget input[type="radio"] { opacity: 0; z-index: 1; position: relative; cursor: pointer; margin: 0; width: 1.6em; height: 1.6em; max-width: none; } .oo-ui-radioInputWidget input[type="radio"] + span { -webkit-transition: background-size 200ms cubic-bezier(0.175, 0.885, 0.32, 1.275); -moz-transition: background-size 200ms cubic-bezier(0.175, 0.885, 0.32, 1.275); transition: background-size 200ms cubic-bezier(0.175, 0.885, 0.32, 1.275); -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; position: absolute; left: 0; border-radius: 100%; width: 1.6em; height: 1.6em; background: white; border: 1px solid #777777; background-image: url("themes/mediawiki/images/icons/circle-constructive.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/circle-constructive.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/circle-constructive.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/circle-constructive.png"); background-repeat: no-repeat; background-position: center center; background-origin: border-box; background-size: 0 0; } .oo-ui-radioInputWidget input[type="radio"]:checked + span { background-size: 100% 100%; } .oo-ui-radioInputWidget input[type="radio"]:active + span { background-color: #cccccc; border-color: #cccccc; } .oo-ui-radioInputWidget input[type="radio"]:focus + span { border-width: 2px; } .oo-ui-radioInputWidget input[type="radio"]:focus:hover + span, .oo-ui-radioInputWidget input[type="radio"]:hover + span { border-bottom-width: 3px; } .oo-ui-radioInputWidget input[type="radio"]:disabled { cursor: default; } .oo-ui-radioInputWidget input[type="radio"]:disabled + span { background-color: #dddddd; border-color: #dddddd; } .oo-ui-radioInputWidget input[type="radio"]:disabled:checked + span { background-image: url("themes/mediawiki/images/icons/circle-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/circle-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/circle-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/circle-invert.png"); } .oo-ui-radioSelectInputWidget .oo-ui-fieldLayout { margin-bottom: 0; } .oo-ui-textInputWidget { position: relative; vertical-align: middle; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; width: 100%; max-width: 50em; } .oo-ui-textInputWidget input, .oo-ui-textInputWidget textarea { display: inline-block; width: 100%; resize: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .oo-ui-textInputWidget textarea { overflow: auto; } .oo-ui-textInputWidget input[type="search"] { -webkit-appearance: none; } .oo-ui-textInputWidget input[type="search"]::-ms-clear { display: none; } .oo-ui-textInputWidget input[type="search"]::-ms-reveal { display: none; } .oo-ui-textInputWidget input[type="search"]::-webkit-search-decoration, .oo-ui-textInputWidget input[type="search"]::-webkit-search-cancel-button, .oo-ui-textInputWidget input[type="search"]::-webkit-search-results-button, .oo-ui-textInputWidget input[type="search"]::-webkit-search-results-decoration { display: none; } .oo-ui-textInputWidget > .oo-ui-iconElement-icon, .oo-ui-textInputWidget > .oo-ui-indicatorElement-indicator, .oo-ui-textInputWidget > .oo-ui-labelElement-label { display: none; } .oo-ui-textInputWidget.oo-ui-iconElement > .oo-ui-iconElement-icon, .oo-ui-textInputWidget.oo-ui-indicatorElement > .oo-ui-indicatorElement-indicator { display: block; position: absolute; top: 0; height: 100%; -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .oo-ui-textInputWidget.oo-ui-widget-enabled > .oo-ui-iconElement-icon, .oo-ui-textInputWidget.oo-ui-widget-enabled > .oo-ui-indicatorElement-indicator { cursor: text; } .oo-ui-textInputWidget.oo-ui-widget-enabled.oo-ui-textInputWidget-type-search > .oo-ui-indicatorElement-indicator { cursor: pointer; } .oo-ui-textInputWidget.oo-ui-labelElement > .oo-ui-labelElement-label { display: block; } .oo-ui-textInputWidget > .oo-ui-iconElement-icon { left: 0; } .oo-ui-textInputWidget > .oo-ui-indicatorElement-indicator { right: 0; } .oo-ui-textInputWidget > .oo-ui-labelElement-label { position: absolute; top: 0; } .oo-ui-textInputWidget-labelPosition-after > .oo-ui-labelElement-label { right: 0; } .oo-ui-textInputWidget-labelPosition-before > .oo-ui-labelElement-label { left: 0; } .oo-ui-textInputWidget input, .oo-ui-textInputWidget textarea { padding: 0.5em; line-height: 1.275em; margin: 0; font-size: inherit; font-family: inherit; background-color: #ffffff; color: #000000; border: 1px solid #cccccc; border-radius: 2px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .oo-ui-textInputWidget input.oo-ui-pendingElement-pending, .oo-ui-textInputWidget textarea.oo-ui-pendingElement-pending { background-color: transparent; } .oo-ui-textInputWidget.oo-ui-widget-enabled input, .oo-ui-textInputWidget.oo-ui-widget-enabled textarea { box-shadow: inset 0 0 0 0.1em #ffffff; -webkit-transition: border 200ms cubic-bezier(0.39, 0.575, 0.565, 1), box-shadow 200ms cubic-bezier(0.39, 0.575, 0.565, 1); -moz-transition: border 200ms cubic-bezier(0.39, 0.575, 0.565, 1), box-shadow 200ms cubic-bezier(0.39, 0.575, 0.565, 1); transition: border 200ms cubic-bezier(0.39, 0.575, 0.565, 1), box-shadow 200ms cubic-bezier(0.39, 0.575, 0.565, 1); } .oo-ui-textInputWidget.oo-ui-widget-enabled input:focus, .oo-ui-textInputWidget.oo-ui-widget-enabled textarea:focus { outline: none; border-color: #347bff; box-shadow: inset 0 0 0 0.1em #347bff; } .oo-ui-textInputWidget.oo-ui-widget-enabled input[readonly], .oo-ui-textInputWidget.oo-ui-widget-enabled textarea[readonly] { color: #777777; text-shadow: 0 1px 1px #ffffff; } .oo-ui-textInputWidget.oo-ui-widget-enabled input[readonly]:focus, .oo-ui-textInputWidget.oo-ui-widget-enabled textarea[readonly]:focus { border-color: #cccccc; box-shadow: inset 0 0 0 0.1em #cccccc; } .oo-ui-textInputWidget.oo-ui-widget-enabled.oo-ui-flaggedElement-invalid input, .oo-ui-textInputWidget.oo-ui-widget-enabled.oo-ui-flaggedElement-invalid textarea { border-color: #ff0000; } .oo-ui-textInputWidget.oo-ui-widget-enabled.oo-ui-flaggedElement-invalid input:focus, .oo-ui-textInputWidget.oo-ui-widget-enabled.oo-ui-flaggedElement-invalid textarea:focus { border-color: #ff0000; box-shadow: inset 0 0 0 0.1em #ff0000; } .oo-ui-textInputWidget.oo-ui-widget-disabled input, .oo-ui-textInputWidget.oo-ui-widget-disabled textarea { color: #cccccc; text-shadow: 0 1px 1px #ffffff; border-color: #dddddd; background-color: #f3f3f3; } .oo-ui-textInputWidget.oo-ui-widget-disabled .oo-ui-iconElement-icon, .oo-ui-textInputWidget.oo-ui-widget-disabled .oo-ui-indicatorElement-indicator { opacity: 0.2; } .oo-ui-textInputWidget.oo-ui-widget-disabled .oo-ui-labelElement-label { color: #dddddd; text-shadow: 0 1px 1px #ffffff; } .oo-ui-textInputWidget.oo-ui-iconElement input, .oo-ui-textInputWidget.oo-ui-iconElement textarea { padding-left: 2.875em; } .oo-ui-textInputWidget.oo-ui-iconElement .oo-ui-iconElement-icon { left: 0; width: 1.875em; max-height: 2.375em; margin-left: 0.5em; height: 100%; background-position: right center; } .oo-ui-textInputWidget.oo-ui-indicatorElement input, .oo-ui-textInputWidget.oo-ui-indicatorElement textarea { padding-right: 2.4875em; } .oo-ui-textInputWidget.oo-ui-indicatorElement .oo-ui-indicatorElement-indicator { width: 0.9375em; max-height: 2.375em; margin: 0 0.775em; height: 100%; } .oo-ui-textInputWidget > .oo-ui-labelElement-label { padding: 0.4em; line-height: 1.5em; color: #888888; } .oo-ui-textInputWidget-labelPosition-after.oo-ui-indicatorElement > .oo-ui-labelElement-label { margin-right: 2.0875em; } .oo-ui-textInputWidget-labelPosition-before.oo-ui-iconElement > .oo-ui-labelElement-label { margin-left: 2.475em; } .oo-ui-menuSelectWidget { position: absolute; background-color: #ffffff; margin-top: -1px; border: 1px solid #aaaaaa; border-radius: 0 0 2px 2px; box-shadow: 0 0.15em 0 0 rgba(0, 0, 0, 0.15); } .oo-ui-menuSelectWidget input { position: absolute; width: 0; height: 0; overflow: hidden; opacity: 0; } .oo-ui-menuOptionWidget { position: relative; padding: 0.5em 1em; } .oo-ui-menuOptionWidget .oo-ui-iconElement-icon { display: none; } .oo-ui-menuOptionWidget.oo-ui-optionWidget-selected { background-color: transparent; } .oo-ui-menuOptionWidget.oo-ui-optionWidget-selected .oo-ui-iconElement-icon { display: block; } .oo-ui-menuOptionWidget.oo-ui-optionWidget-selected { background-color: #d8e6fe; color: rgba(0, 0, 0, 0.8); } .oo-ui-menuOptionWidget.oo-ui-optionWidget-selected .oo-ui-iconElement-icon { display: none; } .oo-ui-menuOptionWidget.oo-ui-optionWidget-highlighted { background-color: #eeeeee; color: #000000; } .oo-ui-menuOptionWidget.oo-ui-optionWidget-selected.oo-ui-menuOptionWidget.oo-ui-optionWidget-highlighted { background-color: #d8e6fe; } .oo-ui-menuSectionOptionWidget { cursor: default; padding: 0.33em 0.75em; color: #888888; } .oo-ui-dropdownWidget { display: inline-block; position: relative; width: 100%; max-width: 50em; background-color: #ffffff; margin-right: 0.5em; } .oo-ui-dropdownWidget-handle { width: 100%; display: inline-block; -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .oo-ui-dropdownWidget-handle .oo-ui-indicatorElement-indicator, .oo-ui-dropdownWidget-handle .oo-ui-iconElement-icon { position: absolute; } .oo-ui-dropdownWidget > .oo-ui-menuSelectWidget { z-index: 1; width: 100%; } .oo-ui-dropdownWidget.oo-ui-widget-enabled .oo-ui-dropdownWidget-handle { cursor: pointer; } .oo-ui-dropdownWidget:last-child { margin-right: 0; } .oo-ui-dropdownWidget-handle { padding: 0.5em 0; height: 2.275em; line-height: 1.275; border: 1px solid #cccccc; border-radius: 2px; } .oo-ui-dropdownWidget-handle .oo-ui-indicatorElement-indicator { right: 0; } .oo-ui-dropdownWidget-handle .oo-ui-iconElement-icon { left: 0.25em; } .oo-ui-dropdownWidget-handle .oo-ui-labelElement-label { line-height: 1.275em; margin: 0 1em; } .oo-ui-dropdownWidget-handle .oo-ui-indicatorElement-indicator { top: 0; width: 0.9375em; height: 0.9375em; margin: 0.775em; } .oo-ui-dropdownWidget-handle .oo-ui-iconElement-icon { top: 0; width: 1.875em; height: 1.875em; margin: 0.3em; } .oo-ui-dropdownWidget:hover .oo-ui-dropdownWidget-handle { border-color: #aaaaaa; } .oo-ui-dropdownWidget.oo-ui-widget-disabled .oo-ui-dropdownWidget-handle { color: #cccccc; text-shadow: 0 1px 1px #ffffff; border-color: #dddddd; background-color: #f3f3f3; } .oo-ui-dropdownWidget.oo-ui-widget-disabled .oo-ui-dropdownWidget-handle:focus { outline: 0; } .oo-ui-dropdownWidget.oo-ui-widget-disabled .oo-ui-indicatorElement-indicator { opacity: 0.2; } .oo-ui-dropdownWidget.oo-ui-iconElement .oo-ui-dropdownWidget-handle .oo-ui-labelElement-label { margin-left: 3em; } .oo-ui-dropdownWidget.oo-ui-indicatorElement .oo-ui-dropdownWidget-handle .oo-ui-labelElement-label { margin-right: 2em; } .oo-ui-dropdownWidget .oo-ui-selectWidget { border-top-color: #ffffff; } .oo-ui-selectFileWidget { display: inline-block; vertical-align: middle; width: 100%; max-width: 50em; margin-right: 0.5em; } .oo-ui-selectFileWidget-selectButton { display: table-cell; vertical-align: middle; } .oo-ui-selectFileWidget-selectButton > .oo-ui-buttonElement-button { position: relative; overflow: hidden; } .oo-ui-selectFileWidget-selectButton > .oo-ui-buttonElement-button > input[type="file"] { position: absolute; margin: 0; top: 0; bottom: 0; left: 0; right: 0; width: 100%; height: 100%; opacity: 0; z-index: 1; cursor: pointer; padding-top: 100px; } .oo-ui-selectFileWidget-selectButton.oo-ui-widget-disabled > .oo-ui-buttonElement-button > input[type="file"] { display: none; } .oo-ui-selectFileWidget-info { width: 100%; display: table-cell; vertical-align: middle; position: relative; overflow: hidden; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .oo-ui-selectFileWidget-info > .oo-ui-selectFileWidget-label { position: absolute; top: 0; bottom: 0; left: 0; right: 0; text-overflow: ellipsis; } .oo-ui-selectFileWidget-info > .oo-ui-selectFileWidget-label > .oo-ui-selectFileWidget-fileName { float: left; } .oo-ui-selectFileWidget-info > .oo-ui-selectFileWidget-label > .oo-ui-selectFileWidget-fileType { float: right; } .oo-ui-selectFileWidget-info > .oo-ui-indicatorElement-indicator, .oo-ui-selectFileWidget-info > .oo-ui-iconElement-icon, .oo-ui-selectFileWidget-info > .oo-ui-selectFileWidget-clearButton { position: absolute; } .oo-ui-selectFileWidget-info > .oo-ui-selectFileWidget-clearButton { z-index: 2; } .oo-ui-selectFileWidget-dropTarget { cursor: default; } .oo-ui-selectFileWidget-supported.oo-ui-widget-enabled .oo-ui-selectFileWidget-dropTarget { cursor: pointer; } .oo-ui-selectFileWidget-empty .oo-ui-selectFileWidget-clearButton, .oo-ui-selectFileWidget-notsupported .oo-ui-selectFileWidget-clearButton { display: none; } .oo-ui-selectFileWidget:last-child { margin-right: 0; } .oo-ui-selectFileWidget-selectButton > .oo-ui-buttonElement-button { margin-left: 0.5em; } .oo-ui-selectFileWidget-info { height: 2.4em; background-color: #ffffff; border: 1px solid #cccccc; border-radius: 2px; } .oo-ui-selectFileWidget-info > .oo-ui-indicatorElement-indicator { right: 0; } .oo-ui-selectFileWidget-info > .oo-ui-iconElement-icon { left: 0; } .oo-ui-selectFileWidget-info > .oo-ui-selectFileWidget-label { line-height: 2.3em; margin: 0; overflow: hidden; white-space: nowrap; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; text-overflow: ellipsis; left: 0.5em; right: 0.5em; } .oo-ui-selectFileWidget-info > .oo-ui-selectFileWidget-label > .oo-ui-selectFileWidget-fileType { color: #888888; } .oo-ui-selectFileWidget-info > .oo-ui-selectFileWidget-clearButton { top: 0; width: 1.875em; margin-right: 0; } .oo-ui-selectFileWidget-info > .oo-ui-selectFileWidget-clearButton .oo-ui-buttonElement-button > .oo-ui-iconElement-icon { height: 2.3em; } .oo-ui-selectFileWidget-info > .oo-ui-indicatorElement-indicator { top: 0; width: 0.9375em; height: 2.3em; margin-right: 0.775em; } .oo-ui-selectFileWidget-info > .oo-ui-iconElement-icon { top: 0; width: 1.875em; height: 2.3em; margin-left: 0.5em; } .oo-ui-selectFileWidget.oo-ui-widget-disabled .oo-ui-selectFileWidget-info { color: #cccccc; text-shadow: 0 1px 1px #ffffff; border-color: #dddddd; background-color: #f3f3f3; } .oo-ui-selectFileWidget.oo-ui-widget-disabled .oo-ui-selectFileWidget-info > .oo-ui-iconElement-icon, .oo-ui-selectFileWidget.oo-ui-widget-disabled .oo-ui-selectFileWidget-info > .oo-ui-indicatorElement-indicator { opacity: 0.2; } .oo-ui-selectFileWidget-empty .oo-ui-selectFileWidget-label { color: #cccccc; } .oo-ui-selectFileWidget.oo-ui-iconElement .oo-ui-selectFileWidget-info .oo-ui-selectFileWidget-label { left: 2.875em; } .oo-ui-selectFileWidget .oo-ui-selectFileWidget-info .oo-ui-selectFileWidget-label { right: 2.375em; } .oo-ui-selectFileWidget .oo-ui-selectFileWidget-info .oo-ui-selectFileWidget-clearButton { right: 0; } .oo-ui-selectFileWidget.oo-ui-indicatorElement .oo-ui-selectFileWidget-info .oo-ui-selectFileWidget-label { right: 4.4625em; } .oo-ui-selectFileWidget.oo-ui-indicatorElement .oo-ui-selectFileWidget-info .oo-ui-selectFileWidget-clearButton { right: 2.0875em; } .oo-ui-selectFileWidget-empty .oo-ui-selectFileWidget-info .oo-ui-selectFileWidget-label, .oo-ui-selectFileWidget-notsupported .oo-ui-selectFileWidget-info .oo-ui-selectFileWidget-label { right: 0.5em; } .oo-ui-selectFileWidget-empty.oo-ui-indicatorElement .oo-ui-selectFileWidget-info .oo-ui-selectFileWidget-label, .oo-ui-selectFileWidget-notsupported.oo-ui-indicatorElement .oo-ui-selectFileWidget-info .oo-ui-selectFileWidget-label { right: 2em; } .oo-ui-selectFileWidget-dropTarget { line-height: 3.5em; background-color: #ffffff; border: 1px dashed #cccccc; padding: 0.5em 1em; margin-bottom: 0.5em; text-align: center; vertical-align: middle; } .oo-ui-selectFileWidget-supported.oo-ui-widget-enabled .oo-ui-selectFileWidget-dropTarget:hover { background-color: #eeeeee; } .oo-ui-selectFileWidget-supported.oo-ui-widget-enabled.oo-ui-selectFileWidget-canDrop .oo-ui-selectFileWidget-dropTarget { background: rgba(52, 123, 255, 0.1); } .oo-ui-selectFileWidget.oo-ui-widget-disabled .oo-ui-selectFileWidget-dropTarget, .oo-ui-selectFileWidget-notsupported .oo-ui-selectFileWidget-dropTarget { color: #cccccc; text-shadow: 0 1px 1px #ffffff; border-color: #dddddd; background-color: #f3f3f3; } .oo-ui-outlineOptionWidget { position: relative; cursor: pointer; -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; font-size: 1.1em; padding: 0.75em; } .oo-ui-outlineOptionWidget.oo-ui-indicatorElement .oo-ui-labelElement-label { padding-right: 1.5em; } .oo-ui-outlineOptionWidget.oo-ui-indicatorElement .oo-ui-indicatorElement-indicator { opacity: 0.5; } .oo-ui-outlineOptionWidget-level-0 { padding-left: 3.5em; } .oo-ui-outlineOptionWidget-level-0 .oo-ui-iconElement-icon { left: 1em; } .oo-ui-outlineOptionWidget-level-1 { padding-left: 5em; } .oo-ui-outlineOptionWidget-level-1 .oo-ui-iconElement-icon { left: 2.5em; } .oo-ui-outlineOptionWidget-level-2 { padding-left: 6.5em; } .oo-ui-outlineOptionWidget-level-2 .oo-ui-iconElement-icon { left: 4em; } .oo-ui-selectWidget-depressed .oo-ui-outlineOptionWidget.oo-ui-optionWidget-selected { background-color: #d0d0d0; text-shadow: 0 1px 1px #ffffff; } .oo-ui-outlineOptionWidget.oo-ui-flaggedElement-important { font-weight: bold; } .oo-ui-outlineOptionWidget.oo-ui-flaggedElement-placeholder { font-style: italic; } .oo-ui-outlineOptionWidget.oo-ui-flaggedElement-empty .oo-ui-iconElement-icon { opacity: 0.5; } .oo-ui-outlineOptionWidget.oo-ui-flaggedElement-empty .oo-ui-labelElement-label { color: #777777; } .oo-ui-outlineControlsWidget { height: 3em; background-color: #ffffff; } .oo-ui-outlineControlsWidget-items, .oo-ui-outlineControlsWidget-movers { float: left; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .oo-ui-outlineControlsWidget > .oo-ui-iconElement-icon { float: left; background-position: right center; } .oo-ui-outlineControlsWidget-items { float: left; } .oo-ui-outlineControlsWidget-items .oo-ui-buttonWidget { float: left; } .oo-ui-outlineControlsWidget-movers { float: right; } .oo-ui-outlineControlsWidget-movers .oo-ui-buttonWidget { float: right; } .oo-ui-outlineControlsWidget-items, .oo-ui-outlineControlsWidget-movers { height: 2em; margin: 0.5em 0.5em 0.5em 0; padding: 0; } .oo-ui-outlineControlsWidget > .oo-ui-iconElement-icon { width: 1.5em; height: 2em; margin: 0.5em 0 0.5em 0.5em; opacity: 0.2; } .oo-ui-tabSelectWidget { text-align: left; white-space: nowrap; overflow: hidden; background-color: #dddddd; } .oo-ui-tabOptionWidget { display: inline-block; vertical-align: bottom; padding: 0.35em 1em; margin: 0.5em 0 0 0.75em; border: 1px solid transparent; border-bottom: none; border-top-left-radius: 2px; border-top-right-radius: 2px; color: #555555; font-weight: bold; } .oo-ui-tabOptionWidget.oo-ui-widget-enabled:hover { background-color: rgba(255, 255, 255, 0.3); } .oo-ui-tabOptionWidget.oo-ui-widget-enabled:active { background-color: rgba(255, 255, 255, 0.8); } .oo-ui-tabOptionWidget.oo-ui-indicatorElement .oo-ui-labelElement-label { padding-right: 1.5em; } .oo-ui-tabOptionWidget.oo-ui-indicatorElement .oo-ui-indicatorElement-indicator { opacity: 0.5; } .oo-ui-selectWidget-pressed .oo-ui-tabOptionWidget.oo-ui-optionWidget-selected, .oo-ui-selectWidget-depressed .oo-ui-tabOptionWidget.oo-ui-optionWidget-selected, .oo-ui-tabOptionWidget.oo-ui-optionWidget-selected:hover { background-color: #ffffff; color: #333333; } .oo-ui-capsuleMultiSelectWidget { display: inline-block; position: relative; width: 100%; max-width: 50em; } .oo-ui-capsuleMultiSelectWidget-handle { width: 100%; display: inline-block; position: relative; } .oo-ui-capsuleMultiSelectWidget-content { position: relative; } .oo-ui-capsuleMultiSelectWidget.oo-ui-widget-disabled .oo-ui-capsuleMultiSelectWidget-content > input { display: none; } .oo-ui-capsuleMultiSelectWidget-group { display: inline; } .oo-ui-capsuleMultiSelectWidget > .oo-ui-menuSelectWidget { z-index: 1; width: 100%; } .oo-ui-capsuleMultiSelectWidget-handle { background-color: #ffffff; cursor: text; min-height: 2.4em; margin-right: 0.5em; padding: 0.15em 0.25em; border: 1px solid #cccccc; border-radius: 2px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .oo-ui-capsuleMultiSelectWidget-handle:last-child { margin-right: 0; } .oo-ui-capsuleMultiSelectWidget-handle > .oo-ui-indicatorElement-indicator, .oo-ui-capsuleMultiSelectWidget-handle > .oo-ui-iconElement-icon { position: absolute; background-position: center center; background-repeat: no-repeat; } .oo-ui-capsuleMultiSelectWidget-handle > .oo-ui-capsuleMultiSelectWidget-content > input { border: 0; line-height: 1.675em; margin: 0 0 0 0.2em; padding: 0; font-size: inherit; font-family: inherit; background-color: transparent; color: #000000; vertical-align: middle; } .oo-ui-capsuleMultiSelectWidget-handle > .oo-ui-capsuleMultiSelectWidget-content > input:focus { outline: none; } .oo-ui-capsuleMultiSelectWidget.oo-ui-indicatorElement .oo-ui-capsuleMultiSelectWidget-handle { padding-right: 2.4875em; } .oo-ui-capsuleMultiSelectWidget.oo-ui-indicatorElement .oo-ui-capsuleMultiSelectWidget-handle > .oo-ui-indicatorElement-indicator { right: 0; top: 0; width: 0.9375em; height: 0.9375em; margin: 0.775em; } .oo-ui-capsuleMultiSelectWidget.oo-ui-iconElement .oo-ui-capsuleMultiSelectWidget-handle { padding-left: 2.475em; } .oo-ui-capsuleMultiSelectWidget.oo-ui-iconElement .oo-ui-capsuleMultiSelectWidget-handle > .oo-ui-iconElement-icon { left: 0; top: 0; width: 1.875em; height: 1.875em; margin: 0.3em; } .oo-ui-capsuleMultiSelectWidget:hover .oo-ui-capsuleMultiSelectWidget-handle { border-color: #aaaaaa; } .oo-ui-capsuleMultiSelectWidget.oo-ui-widget-disabled .oo-ui-capsuleMultiSelectWidget-handle { color: #cccccc; text-shadow: 0 1px 1px #ffffff; border-color: #dddddd; background-color: #f3f3f3; cursor: default; } .oo-ui-capsuleMultiSelectWidget.oo-ui-widget-disabled .oo-ui-capsuleMultiSelectWidget-handle > .oo-ui-iconElement-icon, .oo-ui-capsuleMultiSelectWidget.oo-ui-widget-disabled .oo-ui-capsuleMultiSelectWidget-handle > .oo-ui-indicatorElement-indicator { opacity: 0.2; } .oo-ui-capsuleMultiSelectWidget .oo-ui-selectWidget { border-top-color: #ffffff; } .oo-ui-capsuleItemWidget { position: relative; display: inline-block; cursor: default; white-space: nowrap; width: auto; max-width: 100%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; vertical-align: middle; padding: 0 0.4em; margin: 0.1em; height: 1.7em; line-height: 1.7em; background-color: #eeeeee; border: 1px solid #cccccc; color: #555555; border-radius: 2px; } .oo-ui-capsuleItemWidget > .oo-ui-iconElement-icon { cursor: pointer; } .oo-ui-capsuleItemWidget.oo-ui-widget-disabled > .oo-ui-iconElement-icon { cursor: default; } .oo-ui-capsuleItemWidget.oo-ui-labelElement .oo-ui-labelElement-label { display: block; text-overflow: ellipsis; overflow: hidden; } .oo-ui-capsuleItemWidget.oo-ui-indicatorElement > .oo-ui-labelElement-label { padding-right: 1.3375em; } .oo-ui-capsuleItemWidget.oo-ui-indicatorElement > .oo-ui-indicatorElement-indicator { position: absolute; right: 0.4em; top: 0; width: 0.9375em; height: 100%; background-repeat: no-repeat; } .oo-ui-capsuleItemWidget.oo-ui-indicatorElement > .oo-ui-indicator-clear { cursor: pointer; } .oo-ui-capsuleItemWidget.oo-ui-widget-disabled { color: #cccccc; text-shadow: 0 1px 1px #ffffff; border-color: #dddddd; background-color: #f3f3f3; } .oo-ui-capsuleItemWidget.oo-ui-widget-disabled > .oo-ui-indicatorElement-indicator { opacity: 0.2; } .oo-ui-comboBoxInputWidget { display: inline-block; position: relative; width: 100%; max-width: 50em; margin-right: 0.5em; } .oo-ui-comboBoxInputWidget > .oo-ui-menuSelectWidget { z-index: 1; width: 100%; } .oo-ui-comboBoxInputWidget.oo-ui-widget-enabled > .oo-ui-indicatorElement-indicator { cursor: pointer; } .oo-ui-comboBoxInputWidget-php input::-webkit-calendar-picker-indicator { opacity: 0 !important; position: absolute; right: 0; top: 0; height: 2.5em; width: 2.5em; padding: 0; } .oo-ui-comboBoxInputWidget-php > .oo-ui-indicatorElement-indicator { pointer-events: none; } .oo-ui-comboBoxInputWidget:last-child { margin-right: 0; } .oo-ui-comboBoxInputWidget input, .oo-ui-comboBoxInputWidget textarea { height: 2.35em; } .oo-ui-searchWidget-query { position: absolute; top: 0; left: 0; right: 0; } .oo-ui-searchWidget-query .oo-ui-textInputWidget { width: 100%; } .oo-ui-searchWidget-results { position: absolute; bottom: 0; left: 0; right: 0; overflow-x: hidden; overflow-y: auto; } .oo-ui-searchWidget-query { height: 4em; padding: 0 1em; border-bottom: 1px solid #cccccc; } .oo-ui-searchWidget-query .oo-ui-textInputWidget { margin: 0.75em 0; } .oo-ui-searchWidget-results { top: 4em; padding: 1em; line-height: 0; } .oo-ui-numberInputWidget { display: inline-block; position: relative; max-width: 50em; } .oo-ui-numberInputWidget-field { display: table; table-layout: fixed; width: 100%; } .oo-ui-numberInputWidget-field > .oo-ui-buttonWidget, .oo-ui-numberInputWidget-field > .oo-ui-textInputWidget { display: table-cell; vertical-align: middle; } .oo-ui-numberInputWidget-field > .oo-ui-textInputWidget { width: 100%; } .oo-ui-numberInputWidget-field > .oo-ui-buttonWidget { white-space: nowrap; } .oo-ui-numberInputWidget-field > .oo-ui-buttonWidget > .oo-ui-buttonElement-button { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .oo-ui-numberInputWidget-field > .oo-ui-buttonWidget { width: 2.5em; } .oo-ui-numberInputWidget-minusButton.oo-ui-buttonElement-framed.oo-ui-widget-enabled > .oo-ui-buttonElement-button { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right-width: 0; } .oo-ui-numberInputWidget-plusButton.oo-ui-buttonElement-framed.oo-ui-widget-enabled > .oo-ui-buttonElement-button { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left-width: 0; } .oo-ui-numberInputWidget .oo-ui-textInputWidget input { border-radius: 0; } .oo-ui-window { background: transparent; } .oo-ui-window-frame { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .oo-ui-window-content:focus { outline: none; } .oo-ui-window-head, .oo-ui-window-foot { -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .oo-ui-window-body { margin: 0; padding: 0; background: none; } .oo-ui-window-overlay { position: absolute; top: 0; /* @noflip */ left: 0; } .oo-ui-dialog-content > .oo-ui-window-head, .oo-ui-dialog-content > .oo-ui-window-body, .oo-ui-dialog-content > .oo-ui-window-foot { position: absolute; left: 0; right: 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .oo-ui-dialog-content > .oo-ui-window-head { overflow: hidden; z-index: 1; top: 0; } .oo-ui-dialog-content > .oo-ui-window-body { overflow: auto; z-index: 2; top: 0; bottom: 0; } .oo-ui-dialog-content > .oo-ui-window-foot { overflow: hidden; z-index: 1; bottom: 0; } .oo-ui-dialog-content > .oo-ui-window-body { outline: 1px solid #aaaaaa; } .oo-ui-messageDialog-actions-horizontal { display: table; table-layout: fixed; width: 100%; } .oo-ui-messageDialog-actions-horizontal .oo-ui-actionWidget { display: table-cell; width: 1%; } .oo-ui-messageDialog-actions-vertical { display: block; } .oo-ui-messageDialog-actions-vertical .oo-ui-actionWidget { display: block; overflow: hidden; text-overflow: ellipsis; } .oo-ui-messageDialog-actions .oo-ui-actionWidget { position: relative; text-align: center; } .oo-ui-messageDialog-actions .oo-ui-actionWidget .oo-ui-buttonElement-button { display: block; } .oo-ui-messageDialog-actions .oo-ui-actionWidget .oo-ui-labelElement-label { position: relative; top: auto; bottom: auto; display: inline; white-space: nowrap; } .oo-ui-messageDialog-title, .oo-ui-messageDialog-message { display: block; text-align: center; } .oo-ui-messageDialog-title.oo-ui-labelElement, .oo-ui-messageDialog-message.oo-ui-labelElement { padding-top: 0.5em; } .oo-ui-messageDialog-title { font-size: 1.5em; line-height: 1em; color: #000000; } .oo-ui-messageDialog-message { font-size: 0.9em; line-height: 1.25em; color: #555555; } .oo-ui-messageDialog-message-verbose { font-size: 1.1em; line-height: 1.5em; text-align: left; } .oo-ui-messageDialog-actions-horizontal .oo-ui-actionWidget { border-right: 1px solid #e5e5e5; margin: 0; } .oo-ui-messageDialog-actions-horizontal .oo-ui-actionWidget:last-child { border-right-width: 0; } .oo-ui-messageDialog-actions-vertical .oo-ui-actionWidget { border-bottom: 1px solid #e5e5e5; margin: 0; } .oo-ui-messageDialog-actions-vertical .oo-ui-actionWidget:last-child { border-bottom-width: 0; } .oo-ui-messageDialog-actions .oo-ui-actionWidget { height: 3.4em; margin-right: 0; } .oo-ui-messageDialog-actions .oo-ui-actionWidget:last-child { margin-right: 0; } .oo-ui-messageDialog-actions .oo-ui-actionWidget.oo-ui-labelElement .oo-ui-labelElement-label { text-align: center; line-height: 3.4em; padding: 0 2em; } .oo-ui-messageDialog-actions .oo-ui-actionWidget:hover { background-color: rgba(0, 0, 0, 0.05); } .oo-ui-messageDialog-actions .oo-ui-actionWidget:active { background-color: rgba(0, 0, 0, 0.1); } .oo-ui-messageDialog-actions .oo-ui-actionWidget.oo-ui-flaggedElement-progressive:hover { background-color: rgba(8, 126, 204, 0.05); } .oo-ui-messageDialog-actions .oo-ui-actionWidget.oo-ui-flaggedElement-progressive:active { background-color: rgba(8, 126, 204, 0.1); } .oo-ui-messageDialog-actions .oo-ui-actionWidget.oo-ui-flaggedElement-progressive .oo-ui-labelElement-label { font-weight: bold; } .oo-ui-messageDialog-actions .oo-ui-actionWidget.oo-ui-flaggedElement-constructive:hover { background-color: rgba(118, 171, 54, 0.05); } .oo-ui-messageDialog-actions .oo-ui-actionWidget.oo-ui-flaggedElement-constructive:active { background-color: rgba(118, 171, 54, 0.1); } .oo-ui-messageDialog-actions .oo-ui-actionWidget.oo-ui-flaggedElement-destructive:hover { background-color: rgba(212, 83, 83, 0.05); } .oo-ui-messageDialog-actions .oo-ui-actionWidget.oo-ui-flaggedElement-destructive:active { background-color: rgba(212, 83, 83, 0.1); } .oo-ui-processDialog-location { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .oo-ui-processDialog-title { display: inline; padding: 0; } .oo-ui-processDialog-actions-safe .oo-ui-actionWidget, .oo-ui-processDialog-actions-primary .oo-ui-actionWidget, .oo-ui-processDialog-actions-other .oo-ui-actionWidget { white-space: nowrap; } .oo-ui-processDialog-actions-safe, .oo-ui-processDialog-actions-primary { position: absolute; top: 0; bottom: 0; } .oo-ui-processDialog-actions-safe { left: 0; } .oo-ui-processDialog-actions-primary { right: 0; } .oo-ui-processDialog-errors { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 2; overflow-x: hidden; overflow-y: auto; } .oo-ui-processDialog-content .oo-ui-window-head { height: 3.4em; } .oo-ui-processDialog-content .oo-ui-window-body { top: 3.4em; outline: 1px solid rgba(0, 0, 0, 0.2); } .oo-ui-processDialog-navigation { position: relative; height: 3.4em; padding: 0 1em; } .oo-ui-processDialog-location { padding: 0.75em 0; height: 1.875em; cursor: default; text-align: center; } .oo-ui-processDialog-title { font-weight: bold; line-height: 1.875em; } .oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-buttonElement-framed, .oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-buttonElement-framed, .oo-ui-processDialog-actions-other .oo-ui-actionWidget.oo-ui-buttonElement-framed { margin: 0.5em; } .oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-buttonElement-frameless, .oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-buttonElement-frameless, .oo-ui-processDialog-actions-other .oo-ui-actionWidget.oo-ui-buttonElement-frameless { margin: 0; } .oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-buttonElement-frameless .oo-ui-buttonElement-button, .oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-buttonElement-frameless .oo-ui-buttonElement-button, .oo-ui-processDialog-actions-other .oo-ui-actionWidget.oo-ui-buttonElement-frameless .oo-ui-buttonElement-button { padding: 0.75em 1em; vertical-align: middle; } .oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-buttonElement-frameless .oo-ui-labelElement-label, .oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-buttonElement-frameless .oo-ui-labelElement-label, .oo-ui-processDialog-actions-other .oo-ui-actionWidget.oo-ui-buttonElement-frameless .oo-ui-labelElement-label { line-height: 1.875em; } .oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-buttonElement-frameless:hover, .oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-buttonElement-frameless:hover { background-color: rgba(0, 0, 0, 0.05); } .oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-buttonElement-frameless:active, .oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-buttonElement-frameless:active { background-color: rgba(0, 0, 0, 0.1); } .oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-progressive:hover, .oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-progressive:hover { background-color: rgba(8, 126, 204, 0.05); } .oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-progressive:active, .oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-progressive:active { background-color: rgba(8, 126, 204, 0.1); } .oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-progressive .oo-ui-labelElement-label, .oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-progressive .oo-ui-labelElement-label { font-weight: bold; } .oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-constructive:hover, .oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-constructive:hover { background-color: rgba(118, 171, 54, 0.05); } .oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-constructive:active, .oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-constructive:active { background-color: rgba(118, 171, 54, 0.1); } .oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-destructive:hover, .oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-destructive:hover { background-color: rgba(212, 83, 83, 0.05); } .oo-ui-processDialog-actions-safe .oo-ui-actionWidget.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-destructive:active, .oo-ui-processDialog-actions-primary .oo-ui-actionWidget.oo-ui-buttonElement-frameless.oo-ui-flaggedElement-destructive:active { background-color: rgba(212, 83, 83, 0.1); } .oo-ui-processDialog-actions-other .oo-ui-actionWidget.oo-ui-buttonElement { margin-right: 0; } .oo-ui-processDialog > .oo-ui-window-frame { min-height: 5em; } .oo-ui-processDialog-errors { background-color: rgba(255, 255, 255, 0.9); padding: 3em 3em 1.5em 3em; text-align: center; } .oo-ui-processDialog-errors .oo-ui-buttonWidget { margin: 2em 1em 2em 1em; } .oo-ui-processDialog-errors-title { font-size: 1.5em; color: #000000; margin-bottom: 2em; } .oo-ui-processDialog-error { text-align: left; margin: 1em; padding: 1em; border: 1px solid #ff9e9e; background-color: #fff7f7; border-radius: 2px; } .oo-ui-windowManager-modal > .oo-ui-dialog { position: fixed; width: 0; height: 0; overflow: hidden; } .oo-ui-windowManager-modal > .oo-ui-dialog.oo-ui-window-active { width: auto; height: auto; top: 0; right: 0; bottom: 0; left: 0; padding: 1em; } .oo-ui-windowManager-modal > .oo-ui-dialog.oo-ui-window-setup > .oo-ui-window-frame { position: absolute; right: 0; left: 0; margin: auto; overflow: hidden; max-width: 100%; max-height: 100%; } .oo-ui-windowManager-fullscreen > .oo-ui-dialog > .oo-ui-window-frame { width: 100%; height: 100%; top: 0; bottom: 0; } .oo-ui-windowManager-modal > .oo-ui-dialog { background-color: rgba(255, 255, 255, 0.5); opacity: 0; -webkit-transition: opacity 250ms ease; -moz-transition: opacity 250ms ease; transition: opacity 250ms ease; } .oo-ui-windowManager-modal > .oo-ui-dialog > .oo-ui-window-frame { background-color: #ffffff; opacity: 0; -webkit-transform: scale(0.5); -moz-transform: scale(0.5); -ms-transform: scale(0.5); transform: scale(0.5); -webkit-transition: all 250ms ease; -moz-transition: all 250ms ease; transition: all 250ms ease; } .oo-ui-windowManager-modal > .oo-ui-dialog.oo-ui-window-setup { opacity: 1; } .oo-ui-windowManager-modal > .oo-ui-dialog.oo-ui-window-ready > .oo-ui-window-frame { opacity: 1; -webkit-transform: scale(1); -moz-transform: scale(1); -ms-transform: scale(1); transform: scale(1); } .oo-ui-windowManager-modal.oo-ui-windowManager-floating > .oo-ui-dialog > .oo-ui-window-frame { top: 1em; bottom: 1em; border: 1px solid #aaaaaa; border-radius: 2px; box-shadow: 0 0.15em 0 0 rgba(0, 0, 0, 0.15); } .oo-ui-icon-add { background-image: url("themes/mediawiki/images/icons/add.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/add.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/add.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/add.png"); } .oo-ui-image-constructive.oo-ui-icon-add { background-image: url("themes/mediawiki/images/icons/add-constructive.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/add-constructive.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/add-constructive.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/add-constructive.png"); } .oo-ui-image-invert.oo-ui-icon-add { background-image: url("themes/mediawiki/images/icons/add-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/add-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/add-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/add-invert.png"); } .oo-ui-icon-advanced { background-image: url("themes/mediawiki/images/icons/advanced.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/advanced.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/advanced.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/advanced.png"); } .oo-ui-image-invert.oo-ui-icon-advanced { background-image: url("themes/mediawiki/images/icons/advanced-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/advanced-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/advanced-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/advanced-invert.png"); } .oo-ui-icon-alert { background-image: url("themes/mediawiki/images/icons/alert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/alert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/alert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/alert.png"); } .oo-ui-image-warning.oo-ui-icon-alert { background-image: url("themes/mediawiki/images/icons/alert-warning.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/alert-warning.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/alert-warning.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/alert-warning.png"); } .oo-ui-image-invert.oo-ui-icon-alert { background-image: url("themes/mediawiki/images/icons/alert-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/alert-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/alert-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/alert-invert.png"); } .oo-ui-icon-cancel { background-image: url("themes/mediawiki/images/icons/cancel.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/cancel.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/cancel.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/cancel.png"); } .oo-ui-image-destructive.oo-ui-icon-cancel { background-image: url("themes/mediawiki/images/icons/cancel-destructive.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/cancel-destructive.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/cancel-destructive.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/cancel-destructive.png"); } .oo-ui-image-invert.oo-ui-icon-cancel { background-image: url("themes/mediawiki/images/icons/cancel-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/cancel-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/cancel-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/cancel-invert.png"); } .oo-ui-icon-check { background-image: url("themes/mediawiki/images/icons/check.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/check.png"); } .oo-ui-image-constructive.oo-ui-icon-check { background-image: url("themes/mediawiki/images/icons/check-constructive.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check-constructive.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check-constructive.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/check-constructive.png"); } .oo-ui-image-progressive.oo-ui-icon-check { background-image: url("themes/mediawiki/images/icons/check-progressive.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check-progressive.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check-progressive.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/check-progressive.png"); } .oo-ui-image-destructive.oo-ui-icon-check { background-image: url("themes/mediawiki/images/icons/check-destructive.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check-destructive.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check-destructive.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/check-destructive.png"); } .oo-ui-image-invert.oo-ui-icon-check { background-image: url("themes/mediawiki/images/icons/check-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/check-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/check-invert.png"); } .oo-ui-icon-circle { background-image: url("themes/mediawiki/images/icons/circle.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/circle.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/circle.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/circle.png"); } .oo-ui-image-constructive.oo-ui-icon-circle { background-image: url("themes/mediawiki/images/icons/circle-constructive.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/circle-constructive.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/circle-constructive.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/circle-constructive.png"); } .oo-ui-image-invert.oo-ui-icon-circle { background-image: url("themes/mediawiki/images/icons/circle-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/circle-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/circle-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/circle-invert.png"); } .oo-ui-icon-close { background-image: url("themes/mediawiki/images/icons/close-ltr.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/close-ltr.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/close-ltr.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/close-ltr.png"); } .oo-ui-image-invert.oo-ui-icon-close { background-image: url("themes/mediawiki/images/icons/close-ltr-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/close-ltr-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/close-ltr-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/close-ltr-invert.png"); } .oo-ui-icon-code { background-image: url("themes/mediawiki/images/icons/code.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/code.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/code.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/code.png"); } .oo-ui-image-invert.oo-ui-icon-code { background-image: url("themes/mediawiki/images/icons/code-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/code-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/code-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/code-invert.png"); } .oo-ui-icon-collapse { background-image: url("themes/mediawiki/images/icons/collapse.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/collapse.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/collapse.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/collapse.png"); } .oo-ui-image-invert.oo-ui-icon-collapse { background-image: url("themes/mediawiki/images/icons/collapse-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/collapse-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/collapse-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/collapse-invert.png"); } .oo-ui-icon-comment { background-image: url("themes/mediawiki/images/icons/comment.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/comment.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/comment.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/comment.png"); } .oo-ui-image-invert.oo-ui-icon-comment { background-image: url("themes/mediawiki/images/icons/comment-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/comment-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/comment-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/comment-invert.png"); } .oo-ui-icon-ellipsis { background-image: url("themes/mediawiki/images/icons/ellipsis.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/ellipsis.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/ellipsis.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/ellipsis.png"); } .oo-ui-image-invert.oo-ui-icon-ellipsis { background-image: url("themes/mediawiki/images/icons/ellipsis-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/ellipsis-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/ellipsis-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/ellipsis-invert.png"); } .oo-ui-icon-expand { background-image: url("themes/mediawiki/images/icons/expand.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/expand.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/expand.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/expand.png"); } .oo-ui-image-invert.oo-ui-icon-expand { background-image: url("themes/mediawiki/images/icons/expand-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/expand-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/expand-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/expand-invert.png"); } .oo-ui-icon-help { background-image: url("themes/mediawiki/images/icons/help-ltr.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/help-ltr.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/help-ltr.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/help-ltr.png"); } /* @noflip */ .oo-ui-icon-help:lang(he) { background-image: url("themes/mediawiki/images/icons/help-ltr.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/help-ltr.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/help-ltr.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/help-ltr.png"); } /* @noflip */ .oo-ui-icon-help:lang(yi) { background-image: url("themes/mediawiki/images/icons/help-ltr.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/help-ltr.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/help-ltr.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/help-ltr.png"); } .oo-ui-image-invert.oo-ui-icon-help { background-image: url("themes/mediawiki/images/icons/help-ltr-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/help-ltr-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/help-ltr-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/help-ltr-invert.png"); } /* @noflip */ .oo-ui-image-invert.oo-ui-icon-help:lang(he) { background-image: url("themes/mediawiki/images/icons/help-ltr-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/help-ltr-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/help-ltr-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/help-ltr-invert.png"); } /* @noflip */ .oo-ui-image-invert.oo-ui-icon-help:lang(yi) { background-image: url("themes/mediawiki/images/icons/help-ltr-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/help-ltr-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/help-ltr-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/help-ltr-invert.png"); } .oo-ui-icon-history { background-image: url("themes/mediawiki/images/icons/history.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/history.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/history.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/history.png"); } .oo-ui-image-invert.oo-ui-icon-history { background-image: url("themes/mediawiki/images/icons/history-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/history-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/history-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/history-invert.png"); } .oo-ui-icon-info { background-image: url("themes/mediawiki/images/icons/info.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/info.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/info.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/info.png"); } .oo-ui-image-invert.oo-ui-icon-info { background-image: url("themes/mediawiki/images/icons/info-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/info-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/info-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/info-invert.png"); } .oo-ui-icon-menu { background-image: url("themes/mediawiki/images/icons/menu.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/menu.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/menu.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/menu.png"); } .oo-ui-image-invert.oo-ui-icon-menu { background-image: url("themes/mediawiki/images/icons/menu-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/menu-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/menu-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/menu-invert.png"); } .oo-ui-icon-next { background-image: url("themes/mediawiki/images/icons/move-ltr.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/move-ltr.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/move-ltr.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/move-ltr.png"); } .oo-ui-image-invert.oo-ui-icon-next { background-image: url("themes/mediawiki/images/icons/move-ltr-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/move-ltr-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/move-ltr-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/move-ltr-invert.png"); } .oo-ui-icon-notice { background-image: url("themes/mediawiki/images/icons/notice.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/notice.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/notice.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/notice.png"); } .oo-ui-image-invert.oo-ui-icon-notice { background-image: url("themes/mediawiki/images/icons/notice-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/notice-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/notice-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/notice-invert.png"); } .oo-ui-icon-previous { background-image: url("themes/mediawiki/images/icons/move-rtl.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/move-rtl.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/move-rtl.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/move-rtl.png"); } .oo-ui-image-invert.oo-ui-icon-previous { background-image: url("themes/mediawiki/images/icons/move-rtl-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/move-rtl-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/move-rtl-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/move-rtl-invert.png"); } .oo-ui-icon-redo { background-image: url("themes/mediawiki/images/icons/arched-arrow-ltr.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/arched-arrow-ltr.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/arched-arrow-ltr.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/arched-arrow-ltr.png"); } .oo-ui-image-invert.oo-ui-icon-redo { background-image: url("themes/mediawiki/images/icons/arched-arrow-ltr-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/arched-arrow-ltr-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/arched-arrow-ltr-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/arched-arrow-ltr-invert.png"); } .oo-ui-icon-remove { background-image: url("themes/mediawiki/images/icons/trash.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/trash.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/trash.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/trash.png"); } .oo-ui-image-destructive.oo-ui-icon-remove { background-image: url("themes/mediawiki/images/icons/trash-destructive.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/trash-destructive.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/trash-destructive.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/trash-destructive.png"); } .oo-ui-image-invert.oo-ui-icon-remove { background-image: url("themes/mediawiki/images/icons/trash-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/trash-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/trash-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/trash-invert.png"); } .oo-ui-icon-search { background-image: url("themes/mediawiki/images/icons/search-ltr.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/search-ltr.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/search-ltr.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/search-ltr.png"); } .oo-ui-image-invert.oo-ui-icon-search { background-image: url("themes/mediawiki/images/icons/search-ltr-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/search-ltr-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/search-ltr-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/search-ltr-invert.png"); } .oo-ui-icon-settings { background-image: url("themes/mediawiki/images/icons/settings.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/settings.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/settings.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/settings.png"); } .oo-ui-image-invert.oo-ui-icon-settings { background-image: url("themes/mediawiki/images/icons/settings-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/settings-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/settings-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/settings-invert.png"); } .oo-ui-icon-tag { background-image: url("themes/mediawiki/images/icons/tag.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/tag.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/tag.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/tag.png"); } .oo-ui-image-destructive.oo-ui-icon-tag { background-image: url("themes/mediawiki/images/icons/tag-destructive.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/tag-destructive.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/tag-destructive.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/tag-destructive.png"); } .oo-ui-image-warning.oo-ui-icon-tag { background-image: url("themes/mediawiki/images/icons/tag-warning.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/tag-warning.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/tag-warning.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/tag-warning.png"); } .oo-ui-image-constructive.oo-ui-icon-tag { background-image: url("themes/mediawiki/images/icons/tag-constructive.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/tag-constructive.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/tag-constructive.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/tag-constructive.png"); } .oo-ui-image-progressive.oo-ui-icon-tag { background-image: url("themes/mediawiki/images/icons/tag-progressive.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/tag-progressive.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/tag-progressive.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/tag-progressive.png"); } .oo-ui-image-invert.oo-ui-icon-tag { background-image: url("themes/mediawiki/images/icons/tag-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/tag-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/tag-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/tag-invert.png"); } .oo-ui-icon-undo { background-image: url("themes/mediawiki/images/icons/arched-arrow-rtl.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/arched-arrow-rtl.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/arched-arrow-rtl.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/arched-arrow-rtl.png"); } .oo-ui-image-invert.oo-ui-icon-undo { background-image: url("themes/mediawiki/images/icons/arched-arrow-rtl-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/arched-arrow-rtl-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/arched-arrow-rtl-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/arched-arrow-rtl-invert.png"); } .oo-ui-icon-window { background-image: url("themes/mediawiki/images/icons/window.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/window.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/window.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/window.png"); } .oo-ui-image-invert.oo-ui-icon-window { background-image: url("themes/mediawiki/images/icons/window-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/window-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/icons/window-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/icons/window-invert.png"); } .oo-ui-indicator-alert { background-image: url("themes/mediawiki/images/indicators/alert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/alert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/alert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/alert.png"); } .oo-ui-image-invert.oo-ui-indicator-alert { background-image: url("themes/mediawiki/images/indicators/alert-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/alert-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/alert-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/alert-invert.png"); } .oo-ui-indicator-clear { background-image: url("themes/mediawiki/images/indicators/clear.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/clear.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/clear.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/clear.png"); } .oo-ui-image-invert.oo-ui-indicator-clear { background-image: url("themes/mediawiki/images/indicators/clear-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/clear-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/clear-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/clear-invert.png"); } .oo-ui-indicator-up { background-image: url("themes/mediawiki/images/indicators/arrow-up.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-up.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-up.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/arrow-up.png"); } .oo-ui-image-invert.oo-ui-indicator-up { background-image: url("themes/mediawiki/images/indicators/arrow-up-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-up-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-up-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/arrow-up-invert.png"); } .oo-ui-indicator-down { background-image: url("themes/mediawiki/images/indicators/arrow-down.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-down.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-down.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/arrow-down.png"); } .oo-ui-image-invert.oo-ui-indicator-down { background-image: url("themes/mediawiki/images/indicators/arrow-down-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-down-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-down-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/arrow-down-invert.png"); } .oo-ui-indicator-next { background-image: url("themes/mediawiki/images/indicators/arrow-ltr.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-ltr.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-ltr.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/arrow-ltr.png"); } .oo-ui-image-invert.oo-ui-indicator-next { background-image: url("themes/mediawiki/images/indicators/arrow-ltr-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-ltr-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-ltr-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/arrow-ltr-invert.png"); } .oo-ui-indicator-previous { background-image: url("themes/mediawiki/images/indicators/arrow-rtl.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-rtl.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-rtl.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/arrow-rtl.png"); } .oo-ui-image-invert.oo-ui-indicator-previous { background-image: url("themes/mediawiki/images/indicators/arrow-rtl-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-rtl-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/arrow-rtl-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/arrow-rtl-invert.png"); } .oo-ui-indicator-required { background-image: url("themes/mediawiki/images/indicators/required.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/required.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/required.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/required.png"); } .oo-ui-image-invert.oo-ui-indicator-required { background-image: url("themes/mediawiki/images/indicators/required-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/required-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/required-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/required-invert.png"); } .oo-ui-indicator-search { background-image: url("themes/mediawiki/images/indicators/search-ltr.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/search-ltr.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/search-ltr.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/search-ltr.png"); } .oo-ui-image-invert.oo-ui-indicator-search { background-image: url("themes/mediawiki/images/indicators/search-ltr-invert.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/search-ltr-invert.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/indicators/search-ltr-invert.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/indicators/search-ltr-invert.png"); } .oo-ui-texture-pending { background-image: url("themes/mediawiki/images/textures/pending.gif"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/textures/pending.gif"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/textures/pending.gif"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/textures/pending.gif"); } .oo-ui-texture-transparency { background-image: url("themes/mediawiki/images/textures/transparency.png"); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/textures/transparency.svg"); background-image: linear-gradient(transparent, transparent), /* @embed */ url("themes/mediawiki/images/textures/transparency.svg"); background-image: -o-linear-gradient(transparent, transparent), url("themes/mediawiki/images/textures/transparency.png"); }
him2him2/cdnjs
ajax/libs/oojs-ui/0.15.1/oojs-ui-mediawiki.css
CSS
mit
141,648
/*! * OOjs UI v0.17.10 * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2016 OOjs UI Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * * Date: 2016-10-03T18:59:06Z */ .oo-ui-icon-bell { background-image: url('themes/mediawiki/images/icons/bell.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/bell.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/bell.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/bell.png'); } .oo-ui-image-invert.oo-ui-icon-bell { background-image: url('themes/mediawiki/images/icons/bell-invert.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/bell-invert.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/bell-invert.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/bell-invert.png'); } .oo-ui-image-progressive.oo-ui-icon-bell { background-image: url('themes/mediawiki/images/icons/bell-progressive.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/bell-progressive.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/bell-progressive.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/bell-progressive.png'); } .oo-ui-icon-bellOn { background-image: url('themes/mediawiki/images/icons/bellOn-ltr.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/bellOn-ltr.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/bellOn-ltr.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/bellOn-ltr.png'); } .oo-ui-image-invert.oo-ui-icon-bellOn { background-image: url('themes/mediawiki/images/icons/bellOn-ltr-invert.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/bellOn-ltr-invert.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/bellOn-ltr-invert.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/bellOn-ltr-invert.png'); } .oo-ui-image-progressive.oo-ui-icon-bellOn { background-image: url('themes/mediawiki/images/icons/bellOn-ltr-progressive.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/bellOn-ltr-progressive.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/bellOn-ltr-progressive.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/bellOn-ltr-progressive.png'); } .oo-ui-icon-eye { background-image: url('themes/mediawiki/images/icons/eye.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/eye.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/eye.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/eye.png'); } .oo-ui-image-invert.oo-ui-icon-eye { background-image: url('themes/mediawiki/images/icons/eye-invert.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/eye-invert.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/eye-invert.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/eye-invert.png'); } .oo-ui-image-progressive.oo-ui-icon-eye { background-image: url('themes/mediawiki/images/icons/eye-progressive.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/eye-progressive.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/eye-progressive.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/eye-progressive.png'); } .oo-ui-icon-eyeClosed { background-image: url('themes/mediawiki/images/icons/eyeClosed.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/eyeClosed.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/eyeClosed.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/eyeClosed.png'); } .oo-ui-image-invert.oo-ui-icon-eyeClosed { background-image: url('themes/mediawiki/images/icons/eyeClosed-invert.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/eyeClosed-invert.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/eyeClosed-invert.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/eyeClosed-invert.png'); } .oo-ui-image-progressive.oo-ui-icon-eyeClosed { background-image: url('themes/mediawiki/images/icons/eyeClosed-progressive.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/eyeClosed-progressive.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/eyeClosed-progressive.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/eyeClosed-progressive.png'); } .oo-ui-icon-message { background-image: url('themes/mediawiki/images/icons/message-ltr.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/message-ltr.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/message-ltr.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/message-ltr.png'); } .oo-ui-image-invert.oo-ui-icon-message { background-image: url('themes/mediawiki/images/icons/message-ltr-invert.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/message-ltr-invert.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/message-ltr-invert.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/message-ltr-invert.png'); } .oo-ui-image-progressive.oo-ui-icon-message { background-image: url('themes/mediawiki/images/icons/message-ltr-progressive.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/message-ltr-progressive.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/message-ltr-progressive.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/message-ltr-progressive.png'); } .oo-ui-icon-signature { background-image: url('themes/mediawiki/images/icons/signature-ltr.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/signature-ltr.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/signature-ltr.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/signature-ltr.png'); } .oo-ui-image-invert.oo-ui-icon-signature { background-image: url('themes/mediawiki/images/icons/signature-ltr-invert.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/signature-ltr-invert.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/signature-ltr-invert.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/signature-ltr-invert.png'); } .oo-ui-image-progressive.oo-ui-icon-signature { background-image: url('themes/mediawiki/images/icons/signature-ltr-progressive.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/signature-ltr-progressive.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/signature-ltr-progressive.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/signature-ltr-progressive.png'); } .oo-ui-icon-speechBubble { background-image: url('themes/mediawiki/images/icons/speechBubble-ltr.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubble-ltr.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubble-ltr.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/speechBubble-ltr.png'); } .oo-ui-image-invert.oo-ui-icon-speechBubble { background-image: url('themes/mediawiki/images/icons/speechBubble-ltr-invert.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubble-ltr-invert.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubble-ltr-invert.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/speechBubble-ltr-invert.png'); } .oo-ui-image-progressive.oo-ui-icon-speechBubble { background-image: url('themes/mediawiki/images/icons/speechBubble-ltr-progressive.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubble-ltr-progressive.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubble-ltr-progressive.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/speechBubble-ltr-progressive.png'); } .oo-ui-icon-speechBubbleAdd { background-image: url('themes/mediawiki/images/icons/speechBubbleAdd-ltr.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubbleAdd-ltr.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubbleAdd-ltr.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/speechBubbleAdd-ltr.png'); } .oo-ui-image-invert.oo-ui-icon-speechBubbleAdd { background-image: url('themes/mediawiki/images/icons/speechBubbleAdd-ltr-invert.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubbleAdd-ltr-invert.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubbleAdd-ltr-invert.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/speechBubbleAdd-ltr-invert.png'); } .oo-ui-image-progressive.oo-ui-icon-speechBubbleAdd { background-image: url('themes/mediawiki/images/icons/speechBubbleAdd-ltr-progressive.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubbleAdd-ltr-progressive.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubbleAdd-ltr-progressive.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/speechBubbleAdd-ltr-progressive.png'); } .oo-ui-icon-speechBubbles { background-image: url('themes/mediawiki/images/icons/speechBubbles-ltr.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubbles-ltr.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubbles-ltr.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/speechBubbles-ltr.png'); } .oo-ui-image-invert.oo-ui-icon-speechBubbles { background-image: url('themes/mediawiki/images/icons/speechBubbles-ltr-invert.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubbles-ltr-invert.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubbles-ltr-invert.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/speechBubbles-ltr-invert.png'); } .oo-ui-image-progressive.oo-ui-icon-speechBubbles { background-image: url('themes/mediawiki/images/icons/speechBubbles-ltr-progressive.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubbles-ltr-progressive.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/speechBubbles-ltr-progressive.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/speechBubbles-ltr-progressive.png'); } .oo-ui-icon-tray { background-image: url('themes/mediawiki/images/icons/tray.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/tray.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/tray.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/tray.png'); } .oo-ui-image-invert.oo-ui-icon-tray { background-image: url('themes/mediawiki/images/icons/tray-invert.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/tray-invert.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/tray-invert.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/tray-invert.png'); } .oo-ui-image-progressive.oo-ui-icon-tray { background-image: url('themes/mediawiki/images/icons/tray-progressive.png'); background-image: -webkit-linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/tray-progressive.svg'); background-image: linear-gradient(transparent, transparent), /* @embed */ url('themes/mediawiki/images/icons/tray-progressive.svg'); background-image: -o-linear-gradient(transparent, transparent), url('themes/mediawiki/images/icons/tray-progressive.png'); }
dakshshah96/cdnjs
ajax/libs/oojs-ui/0.17.10/oojs-ui-mediawiki-icons-alerts.css
CSS
mit
16,261