diff options
author | Dave Airlie <airlied@redhat.com> | 2008-09-26 15:37:21 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2008-09-30 14:13:49 +1000 |
commit | 972f6572652bc4a2f6c44c525e5e91f2becdb62a (patch) | |
tree | 60af3dc7e8a7c0f8bef7a3927dae161093b10dbe /bsd-core/drm_context.c | |
parent | 89126bb58ec82511758bed36a28e698b721fb435 (diff) | |
parent | 2db8e0c8ef8c7a66460fceda129533b364f6418c (diff) |
Merge remote branch 'origin/master' into modesetting-gem
Conflicts:
libdrm/Makefile.am
libdrm/dri_bufmgr.h
linux-core/drm_irq.c
linux-core/drm_sysfs.c
linux-core/drm_ttm.c
shared-core/i915_dma.c
shared-core/i915_irq.c
shared-core/nouveau_drv.h
shared-core/radeon_cp.c
Diffstat (limited to 'bsd-core/drm_context.c')
-rw-r--r-- | bsd-core/drm_context.c | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/bsd-core/drm_context.c b/bsd-core/drm_context.c index 6d44fbec..bca899cb 100644 --- a/bsd-core/drm_context.c +++ b/bsd-core/drm_context.c @@ -62,7 +62,7 @@ int drm_ctxbitmap_next(struct drm_device *dev) return -1; DRM_LOCK(); - bit = find_first_zero_bit( dev->ctx_bitmap, DRM_MAX_CTXBITMAP ); + bit = find_first_zero_bit(dev->ctx_bitmap, DRM_MAX_CTXBITMAP); if (bit >= DRM_MAX_CTXBITMAP) { DRM_UNLOCK(); return -1; @@ -108,7 +108,7 @@ int drm_ctxbitmap_init(struct drm_device *dev) DRM_LOCK(); dev->ctx_bitmap = malloc(PAGE_SIZE, M_DRM, M_NOWAIT | M_ZERO); - if ( dev->ctx_bitmap == NULL ) { + if (dev->ctx_bitmap == NULL) { DRM_UNLOCK(); return ENOMEM; } @@ -116,9 +116,9 @@ int drm_ctxbitmap_init(struct drm_device *dev) dev->max_context = -1; DRM_UNLOCK(); - for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { + for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { temp = drm_ctxbitmap_next(dev); - DRM_DEBUG( "drm_ctxbitmap_init : %d\n", temp ); + DRM_DEBUG("drm_ctxbitmap_init : %d\n", temp); } return 0; @@ -140,7 +140,7 @@ void drm_ctxbitmap_cleanup(struct drm_device *dev) int drm_getsareactx(struct drm_device *dev, void *data, struct drm_file *file_priv) { - drm_ctx_priv_map_t *request = data; + struct drm_ctx_priv_map *request = data; drm_local_map_t *map; DRM_LOCK(); @@ -161,7 +161,7 @@ int drm_getsareactx(struct drm_device *dev, void *data, int drm_setsareactx(struct drm_device *dev, void *data, struct drm_file *file_priv) { - drm_ctx_priv_map_t *request = data; + struct drm_ctx_priv_map *request = data; drm_local_map_t *map = NULL; DRM_LOCK(); @@ -188,49 +188,49 @@ bad: int drm_context_switch(struct drm_device *dev, int old, int new) { - if ( test_and_set_bit( 0, &dev->context_flag ) ) { - DRM_ERROR( "Reentering -- FIXME\n" ); - return EBUSY; - } + if (test_and_set_bit(0, &dev->context_flag)) { + DRM_ERROR("Reentering -- FIXME\n"); + return EBUSY; + } - DRM_DEBUG( "Context switch from %d to %d\n", old, new ); + DRM_DEBUG("Context switch from %d to %d\n", old, new); - if ( new == dev->last_context ) { - clear_bit( 0, &dev->context_flag ); - return 0; - } + if (new == dev->last_context) { + clear_bit(0, &dev->context_flag); + return 0; + } - return 0; + return 0; } int drm_context_switch_complete(struct drm_device *dev, int new) { - dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ + dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ - if ( !_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) ) { - DRM_ERROR( "Lock isn't held after context switch\n" ); - } + if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("Lock isn't held after context switch\n"); + } - /* If a context switch is ever initiated - when the kernel holds the lock, release - that lock here. */ - clear_bit( 0, &dev->context_flag ); + /* If a context switch is ever initiated + when the kernel holds the lock, release + that lock here. */ + clear_bit(0, &dev->context_flag); - return 0; + return 0; } int drm_resctx(struct drm_device *dev, void *data, struct drm_file *file_priv) { - drm_ctx_res_t *res = data; - drm_ctx_t ctx; + struct drm_ctx_res *res = data; + struct drm_ctx ctx; int i; - if ( res->count >= DRM_RESERVED_CONTEXTS ) { + if (res->count >= DRM_RESERVED_CONTEXTS) { bzero(&ctx, sizeof(ctx)); - for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { + for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { ctx.handle = i; - if ( DRM_COPY_TO_USER( &res->contexts[i], - &ctx, sizeof(ctx) ) ) + if (DRM_COPY_TO_USER(&res->contexts[i], + &ctx, sizeof(ctx))) return EFAULT; } } @@ -241,23 +241,23 @@ int drm_resctx(struct drm_device *dev, void *data, struct drm_file *file_priv) int drm_addctx(struct drm_device *dev, void *data, struct drm_file *file_priv) { - drm_ctx_t *ctx = data; + struct drm_ctx *ctx = data; ctx->handle = drm_ctxbitmap_next(dev); - if ( ctx->handle == DRM_KERNEL_CONTEXT ) { - /* Skip kernel's context and get a new one. */ + if (ctx->handle == DRM_KERNEL_CONTEXT) { + /* Skip kernel's context and get a new one. */ ctx->handle = drm_ctxbitmap_next(dev); } - DRM_DEBUG( "%d\n", ctx->handle ); - if ( ctx->handle == -1 ) { - DRM_DEBUG( "Not enough free contexts.\n" ); - /* Should this return -EBUSY instead? */ + DRM_DEBUG("%d\n", ctx->handle); + if (ctx->handle == -1) { + DRM_DEBUG("Not enough free contexts.\n"); + /* Should this return -EBUSY instead? */ return ENOMEM; } - if (dev->driver.context_ctor && ctx->handle != DRM_KERNEL_CONTEXT) { + if (dev->driver->context_ctor && ctx->handle != DRM_KERNEL_CONTEXT) { DRM_LOCK(); - dev->driver.context_ctor(dev, ctx->handle); + dev->driver->context_ctor(dev, ctx->handle); DRM_UNLOCK(); } @@ -272,7 +272,7 @@ int drm_modctx(struct drm_device *dev, void *data, struct drm_file *file_priv) int drm_getctx(struct drm_device *dev, void *data, struct drm_file *file_priv) { - drm_ctx_t *ctx = data; + struct drm_ctx *ctx = data; /* This is 0, because we don't handle any context flags */ ctx->flags = 0; @@ -283,17 +283,17 @@ int drm_getctx(struct drm_device *dev, void *data, struct drm_file *file_priv) int drm_switchctx(struct drm_device *dev, void *data, struct drm_file *file_priv) { - drm_ctx_t *ctx = data; + struct drm_ctx *ctx = data; - DRM_DEBUG( "%d\n", ctx->handle ); + DRM_DEBUG("%d\n", ctx->handle); return drm_context_switch(dev, dev->last_context, ctx->handle); } int drm_newctx(struct drm_device *dev, void *data, struct drm_file *file_priv) { - drm_ctx_t *ctx = data; + struct drm_ctx *ctx = data; - DRM_DEBUG( "%d\n", ctx->handle ); + DRM_DEBUG("%d\n", ctx->handle); drm_context_switch_complete(dev, ctx->handle); return 0; @@ -301,13 +301,13 @@ int drm_newctx(struct drm_device *dev, void *data, struct drm_file *file_priv) int drm_rmctx(struct drm_device *dev, void *data, struct drm_file *file_priv) { - drm_ctx_t *ctx = data; + struct drm_ctx *ctx = data; - DRM_DEBUG( "%d\n", ctx->handle ); - if ( ctx->handle != DRM_KERNEL_CONTEXT ) { - if (dev->driver.context_dtor) { + DRM_DEBUG("%d\n", ctx->handle); + if (ctx->handle != DRM_KERNEL_CONTEXT) { + if (dev->driver->context_dtor) { DRM_LOCK(); - dev->driver.context_dtor(dev, ctx->handle); + dev->driver->context_dtor(dev, ctx->handle); DRM_UNLOCK(); } |