From 881683873e6aeab6529b8e6db8ed0678c87e86d7 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Fri, 22 Sep 2000 18:14:54 +0000 Subject: Import of XFree86 4.0.1d-pre --- linux/sis_context.c | 33 +++++++++++++++++---------------- linux/sis_ds.c | 31 +++++++++++++++++++++++++++++++ linux/sis_ds.h | 29 +++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 16 deletions(-) (limited to 'linux') diff --git a/linux/sis_context.c b/linux/sis_context.c index cabd3868..df66268c 100644 --- a/linux/sis_context.c +++ b/linux/sis_context.c @@ -2,6 +2,7 @@ * Created: Thu Oct 7 10:50:22 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,12 +25,12 @@ * DEALINGS IN THE SOFTWARE. * * Authors: - * Rickard E. (Rik) Faith - * + * Rickard E. (Rik) Faith + * Daryll Strauss + * Sung-Ching Lin + * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_context.c,v 1.2 2000/08/04 03:51:47 tsi Exp $ */ - -#include +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_context.c,v 1.5 2000/08/28 02:43:16 tsi Exp $ */ #define __NO_VERSION__ #include "drmP.h" @@ -39,9 +40,7 @@ extern drm_ctx_t sis_res_ctx; static int sis_alloc_queue(drm_device_t *dev) { - static int context = 0; - - return ++context; /* Should this reuse contexts in the future? */ + return drm_ctxbitmap_next(dev); } int sis_context_switch(drm_device_t *dev, int old, int new) @@ -138,10 +137,15 @@ int sis_addctx(struct inode *inode, struct file *filp, unsigned int cmd, ctx.handle = sis_alloc_queue(dev); } DRM_DEBUG("%d\n", ctx.handle); - + if (ctx.handle == -1) { + DRM_DEBUG("Not enough free contexts.\n"); + /* Should this return -EBUSY instead? */ + return -ENOMEM; + } + /* new added */ sis_init_context(ctx.handle); - + copy_to_user_ret((drm_ctx_t *)arg, &ctx, sizeof(ctx), -EFAULT); return 0; } @@ -198,16 +202,13 @@ int sis_newctx(struct inode *inode, struct file *filp, unsigned int cmd, int sis_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; drm_ctx_t ctx; copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); DRM_DEBUG("%d\n", ctx.handle); - /* This is currently a noop because we - don't reuse context values. Perhaps we - should? */ - - /* new added */ - sis_final_context(ctx.handle); + drm_ctxbitmap_free(dev, ctx.handle); return 0; } diff --git a/linux/sis_ds.c b/linux/sis_ds.c index 592722c7..525d16a6 100644 --- a/linux/sis_ds.c +++ b/linux/sis_ds.c @@ -1,3 +1,34 @@ +/* sis_ds.c -- Private header for Direct Rendering Manager -*- linux-c -*- + * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw + * + * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. + * All rights reserved. + * + * 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 + * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. + * + * Authors: + * Sung-Ching Lin + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.c,v 1.2 2000/08/04 03:51:47 tsi Exp $ */ + #define __NO_VERSION__ #include #include diff --git a/linux/sis_ds.h b/linux/sis_ds.h index 87a8b03d..2258b755 100644 --- a/linux/sis_ds.h +++ b/linux/sis_ds.h @@ -1,3 +1,32 @@ +/* sis_ds.h -- Private header for Direct Rendering Manager -*- linux-c -*- + * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw + * + * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. + * All rights reserved. + * + * 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 + * PRECISION INSIGHT AND/OR ITS SUPPLIERS 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. + * + * Authors: + * Sung-Ching Lin + * + */ /* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_ds.h,v 1.2 2000/08/04 03:51:47 tsi Exp $ */ #ifndef _sis_ds_h_ -- cgit v1.2.3