summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2004-10-18Update Doxygen configuration & comments.Jose Fonseca
2004-10-16Fixed off by one errors in clipping.Ville Syrjala
2004-10-16Fixed bad formatting.Ville Syrjala
2004-10-15Remove drm_init.cJon Smirl
2004-10-15Move drm_cpu_valid out of drm_init. drm_init is empty now.Jon Smirl
2004-10-15Switch linux-core over to 2.6 parameter model to enable debug useJon Smirl
2004-10-13Add a poll function that alternates between zero and normal poll return toJon Smirl
2004-10-12Via updates. Fixed unlikely but possible uint32_t overflow in ring-bufferThomas Hellstrom
2004-10-12Breakout heads into their own data structures.Jon Smirl
2004-10-10Rename fn_tbl to driver. Core driver now uses pci_driver name whichJon Smirl
2004-10-10Vladimir requested support so we can at least load r300 microcode forDave Airlie
2004-10-10Forgot to add the new MakefileJon Smirl
2004-10-10Make the test programs buildJon Smirl
2004-10-09cleanup VIA driver to look a bit like others before kernel mergeDave Airlie
2004-10-09fix up whitespacing in KconfigDave Airlie
2004-10-09Lindent the via stuff so I can include it in kernelDave Airlie
2004-10-09remove unused dma remnants that were gamma only - these could cause an oopsDave Airlie
2004-10-08Changed unsigned to uint32_t in some ioctl parameters. Introduced firstThomas Hellstrom
2004-10-08Fix refcount bug in stealth modeJon Smirl
2004-10-07Fix drm_exit to allow for DRM(global) being deleted when framebuffer isJon Smirl
2004-10-06Revert back to drm_order() instead of using kernel get_order(). TheJon Smirl
2004-10-05Patch for Kconfig for making i830/i915 not build togetherDave Airlie
2004-10-05enable the device in the right order, remove __devinit from drm_intJon Smirl
2004-10-02janitor-list_for_each-drivers-char-drm-radeon_memc.patch from mm kernelJon Smirl
2004-09-30Make the debug memory functions compile for the core model.Jon Smirl
2004-09-30Remove DRM() macros from core ffb driver. DaveA says he'll make it compileJon Smirl
2004-09-30Lindent of core build. Drivers checked for no binary diffs. A few filesJon Smirl
2004-09-30savage.h not used in core buildsJon Smirl
2004-09-30core ffb.h is not used anymoreJon Smirl
2004-09-30Remove unused drm_module.hJon Smirl
2004-09-30Move things around to reduce public symbols and even out files. Switch toJon Smirl
2004-09-30Make fops per driver instead of global, remove default flush, poll, readJon Smirl
2004-09-28Getting the AGP module is a global resource. Make sure a dual PCI/AGPJon Smirl
2004-09-27Fix the shared directory I accidentally stomped onJon Smirl
2004-09-27core needs three new filesJon Smirl
2004-09-27First check in for DRM that splits core from personality modulesJon Smirl
2004-09-27Flip the 2.4 check so that it looks for 2.6 instead. This will allow buildsJon Smirl
2004-09-24README with hints on how to make a 2.6 specific version of a 2.4/2.6 sharedJon Smirl
2004-09-24Makefile reminder to build in 2.6 when on 2.6Jon Smirl
2004-09-24Create new linux-2.6 build. Move all gpl files into the 2.6 build. If youJon Smirl
2004-09-23Remove 2.6 code that allow DRM major device number to be shared. We can addJon Smirl
2004-09-23Add new sysfs support filesJon Smirl
2004-09-231) switches from class_sysfs to drm sysfs implementation to allowJon Smirl
2004-09-22Create permanent maps of framebuffer, aperture and MMIO registers. AddedFelix Kuehling
2004-09-22Remove hotplug reset support from DRM driver. This will be handled by theJon Smirl
2004-09-22Add *.flags to cvsignore.Eric Anholt
2004-09-21Make DRM permanent maps match broken X behavior. X is mapping regions thatJon Smirl
2004-09-20Remove size restriction on permanent addmapJon Smirl
2004-09-20Felix's fix for map request smaller than permanent map sizeJon Smirl
2004-09-20remove HAVE_COUNTERSDave Airlie
/span> drm_device_t *dev = priv->head->dev; int ret; DRM_ASSERT_LOCKED(&dev->struct_mutex); atomic_set(&item->refcount, 1); item->shareable = shareable; item->owner = priv; ret = drm_ht_just_insert_please(&dev->object_hash, &item->hash, (unsigned long)item, 32, 0, 0); if (ret) return ret; list_add_tail(&item->list, &priv->user_objects); return 0; } drm_user_object_t *drm_lookup_user_object(drm_file_t * priv, uint32_t key) { drm_device_t *dev = priv->head->dev; drm_hash_item_t *hash; int ret; drm_user_object_t *item; DRM_ASSERT_LOCKED(&dev->struct_mutex); ret = drm_ht_find_item(&dev->object_hash, key, &hash); if (ret) { return NULL; } item = drm_hash_entry(hash, drm_user_object_t, hash); if (priv != item->owner) { drm_open_hash_t *ht = &priv->refd_object_hash[_DRM_REF_USE]; ret = drm_ht_find_item(ht, (unsigned long)item, &hash); if (ret) { DRM_ERROR("Object not registered for usage\n"); return NULL; } } return item; } static void drm_deref_user_object(drm_file_t * priv, drm_user_object_t * item) { drm_device_t *dev = priv->head->dev; int ret; if (atomic_dec_and_test(&item->refcount)) { ret = drm_ht_remove_item(&dev->object_hash, &item->hash); BUG_ON(ret); list_del_init(&item->list); item->remove(priv, item); } } int drm_remove_user_object(drm_file_t * priv, drm_user_object_t * item) { DRM_ASSERT_LOCKED(&priv->head->dev->struct_mutex); if (item->owner != priv) { DRM_ERROR("Cannot destroy object not owned by you.\n"); return -EINVAL; } item->owner = 0; item->shareable = 0; list_del_init(&item->list); drm_deref_user_object(priv, item); return 0; } static int drm_object_ref_action(drm_file_t * priv, drm_user_object_t * ro, drm_ref_t action) { int ret = 0; switch (action) { case _DRM_REF_USE: atomic_inc(&ro->refcount); break; default: if (!ro->ref_struct_locked) { break; } else { ro->ref_struct_locked(priv, ro, action); } } return ret; } int drm_add_ref_object(drm_file_t * priv, drm_user_object_t * referenced_object, drm_ref_t ref_action) { int ret = 0; drm_ref_object_t *item; drm_open_hash_t *ht = &priv->refd_object_hash[ref_action]; DRM_ASSERT_LOCKED(&priv->head->dev->struct_mutex); if (!referenced_object->shareable && priv != referenced_object->owner) { DRM_ERROR("Not allowed to reference this object\n"); return -EINVAL; } /* * If this is not a usage reference, Check that usage has been registered * first. Otherwise strange things may happen on destruction. */ if ((ref_action != _DRM_REF_USE) && priv != referenced_object->owner) { item = drm_lookup_ref_object(priv, referenced_object, _DRM_REF_USE); if (!item) { DRM_ERROR ("Object not registered for usage by this client\n"); return -EINVAL; } } if (NULL != (item = drm_lookup_ref_object(priv, referenced_object, ref_action))) { atomic_inc(&item->refcount); return drm_object_ref_action(priv, referenced_object, ref_action); } item = drm_ctl_calloc(1, sizeof(*item), DRM_MEM_OBJECTS); if (item == NULL) { DRM_ERROR("Could not allocate reference object\n"); return -ENOMEM; } atomic_set(&item->refcount, 1); item->hash.key = (unsigned long)referenced_object; ret = drm_ht_insert_item(ht, &item->hash); item->unref_action = ref_action; if (ret) goto out; list_add(&item->list, &priv->refd_objects); ret = drm_object_ref_action(priv, referenced_object, ref_action); out: return ret; } drm_ref_object_t *drm_lookup_ref_object(drm_file_t * priv, drm_user_object_t * referenced_object, drm_ref_t ref_action) { drm_hash_item_t *hash; int ret; DRM_ASSERT_LOCKED(&priv->head->dev->struct_mutex); ret = drm_ht_find_item(&priv->refd_object_hash[ref_action], (unsigned long)referenced_object, &hash); if (ret) return NULL; return drm_hash_entry(hash, drm_ref_object_t, hash); } static void drm_remove_other_references(drm_file_t * priv, drm_user_object_t * ro) { int i; drm_open_hash_t *ht; drm_hash_item_t *hash; drm_ref_object_t *item; for (i = _DRM_REF_USE + 1; i < _DRM_NO_REF_TYPES; ++i) { ht = &priv->refd_object_hash[i]; while (!drm_ht_find_item(ht, (unsigned long)ro, &hash)) { item = drm_hash_entry(hash, drm_ref_object_t, hash); drm_remove_ref_object(priv, item); } } } void drm_remove_ref_object(drm_file_t * priv, drm_ref_object_t * item) { int ret; drm_user_object_t *user_object = (drm_user_object_t *) item->hash.key; drm_open_hash_t *ht = &priv->refd_object_hash[item->unref_action]; drm_ref_t unref_action; DRM_ASSERT_LOCKED(&priv->head->dev->struct_mutex); unref_action = item->unref_action; if (atomic_dec_and_test(&item->refcount)) { ret = drm_ht_remove_item(ht, &item->hash); BUG_ON(ret); list_del_init(&item->list); if (unref_action == _DRM_REF_USE) drm_remove_other_references(priv, user_object); drm_ctl_free(item, sizeof(*item), DRM_MEM_OBJECTS); } switch (unref_action) { case _DRM_REF_USE: drm_deref_user_object(priv, user_object); break; default: BUG_ON(!user_object->unref); user_object->unref(priv, user_object, unref_action); break; } } int drm_user_object_ref(drm_file_t * priv, uint32_t user_token, drm_object_type_t type, drm_user_object_t ** object) { drm_device_t *dev = priv->head->dev; drm_user_object_t *uo; drm_hash_item_t *hash; int ret; mutex_lock(&dev->struct_mutex); ret = drm_ht_find_item(&dev->object_hash, user_token, &hash); if (ret) { DRM_ERROR("Could not find user object to reference.\n"); goto out_err; } uo = drm_hash_entry(hash, drm_user_object_t, hash); if (uo->type != type) { ret = -EINVAL; goto out_err; } ret = drm_add_ref_object(priv, uo, _DRM_REF_USE); if (ret) goto out_err; mutex_unlock(&dev->struct_mutex); *object = uo; return 0; out_err: mutex_unlock(&dev->struct_mutex); return ret; } int drm_user_object_unref(drm_file_t * priv, uint32_t user_token, drm_object_type_t type) { drm_device_t *dev = priv->head->dev; drm_user_object_t *uo; drm_ref_object_t *ro; int ret; mutex_lock(&dev->struct_mutex); uo = drm_lookup_user_object(priv, user_token); if (!uo || (uo->type != type)) { ret = -EINVAL; goto out_err; } ro = drm_lookup_ref_object(priv, uo, _DRM_REF_USE); if (!ro) { ret = -EINVAL; goto out_err; } drm_remove_ref_object(priv, ro); mutex_unlock(&dev->struct_mutex); return 0; out_err: mutex_unlock(&dev->struct_mutex); return ret; }