The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/drm/via_video.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright 2005 Thomas Hellstrom. All Rights Reserved.
    3  *
    4  * Permission is hereby granted, free of charge, to any person obtaining a
    5  * copy of this software and associated documentation files (the "Software"),
    6  * to deal in the Software without restriction, including without limitation
    7  * the rights to use, copy, modify, merge, publish, distribute, sub license,
    8  * and/or sell copies of the Software, and to permit persons to whom the
    9  * Software is furnished to do so, subject to the following conditions:
   10  *
   11  * The above copyright notice and this permission notice (including the
   12  * next paragraph) shall be included in all copies or substantial portions
   13  * of the Software.
   14  *
   15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   17  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
   18  * THE AUTHOR(S), AND/OR THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
   19  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
   21  * DEALINGS IN THE SOFTWARE.
   22  *
   23  * Author: Thomas Hellstrom 2005.
   24  *
   25  * Video and XvMC related functions.
   26  */
   27 
   28 #include <sys/cdefs.h>
   29 __FBSDID("$FreeBSD$");
   30 
   31 #include "dev/drm/drmP.h"
   32 #include "dev/drm/via_drm.h"
   33 #include "dev/drm/via_drv.h"
   34 
   35 void via_init_futex(drm_via_private_t * dev_priv)
   36 {
   37         unsigned int i;
   38 
   39         DRM_DEBUG("\n");
   40 
   41         for (i = 0; i < VIA_NR_XVMC_LOCKS; ++i) {
   42                 DRM_INIT_WAITQUEUE(&(dev_priv->decoder_queue[i]));
   43                 XVMCLOCKPTR(dev_priv->sarea_priv, i)->lock = 0;
   44         }
   45 }
   46 
   47 void via_cleanup_futex(drm_via_private_t * dev_priv)
   48 {
   49 }
   50 
   51 void via_release_futex(drm_via_private_t * dev_priv, int context)
   52 {
   53         unsigned int i;
   54         volatile int *lock;
   55 
   56         if (!dev_priv->sarea_priv)
   57                 return;
   58 
   59         for (i = 0; i < VIA_NR_XVMC_LOCKS; ++i) {
   60                 lock = (volatile int *)XVMCLOCKPTR(dev_priv->sarea_priv, i);
   61                 if ((_DRM_LOCKING_CONTEXT(*lock) == context)) {
   62                         if (_DRM_LOCK_IS_HELD(*lock)
   63                             && (*lock & _DRM_LOCK_CONT)) {
   64                                 DRM_WAKEUP(&(dev_priv->decoder_queue[i]));
   65                         }
   66                         *lock = 0;
   67                 }
   68         }
   69 }
   70 
   71 int via_decoder_futex(struct drm_device *dev, void *data, struct drm_file *file_priv)
   72 {
   73         drm_via_futex_t *fx = data;
   74         volatile int *lock;
   75         drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
   76         drm_via_sarea_t *sAPriv = dev_priv->sarea_priv;
   77         int ret = 0;
   78 
   79         DRM_DEBUG("\n");
   80 
   81         if (fx->lock >= VIA_NR_XVMC_LOCKS)
   82                 return -EFAULT;
   83 
   84         lock = (volatile int *)XVMCLOCKPTR(sAPriv, fx->lock);
   85 
   86         switch (fx->func) {
   87         case VIA_FUTEX_WAIT:
   88                 DRM_WAIT_ON(ret, dev_priv->decoder_queue[fx->lock],
   89                             (fx->ms / 10) * (DRM_HZ / 100), *lock != fx->val);
   90                 return ret;
   91         case VIA_FUTEX_WAKE:
   92                 DRM_WAKEUP(&(dev_priv->decoder_queue[fx->lock]));
   93                 return 0;
   94         }
   95         return 0;
   96 }

Cache object: d1d031693a20f704bf3c3e4b98fea84b


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.