Lines Matching full:blob

514 	 * NOTE: The idea seems to have been to use this to read all the blob  in drm_mode_getproperty_ioctl()
517 * read the value for a blob property. It also doesn't make a lot of in drm_mode_getproperty_ioctl()
529 struct drm_property_blob *blob = in drm_property_free_blob() local
532 mutex_lock(&blob->dev->mode_config.blob_lock); in drm_property_free_blob()
533 list_del(&blob->head_global); in drm_property_free_blob()
534 mutex_unlock(&blob->dev->mode_config.blob_lock); in drm_property_free_blob()
536 drm_mode_object_unregister(blob->dev, &blob->base); in drm_property_free_blob()
538 kvfree(blob); in drm_property_free_blob()
542 * drm_property_create_blob - Create new blob property
544 * @length: Length to allocate for blob data
545 * @data: If specified, copies data into blob
547 * Creates a new blob property for a specified DRM device, optionally
548 * copying data. Note that blob properties are meant to be invariant, hence the
549 * data must be filled out before the blob is used as the value of any property.
552 * New blob property with a single reference on success, or an ERR_PTR
559 struct drm_property_blob *blob; in drm_property_create_blob() local
565 blob = kvzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL); in drm_property_create_blob()
566 if (!blob) in drm_property_create_blob()
571 INIT_LIST_HEAD(&blob->head_file); in drm_property_create_blob()
572 blob->data = (void *)blob + sizeof(*blob); in drm_property_create_blob()
573 blob->length = length; in drm_property_create_blob()
574 blob->dev = dev; in drm_property_create_blob()
577 memcpy(blob->data, data, length); in drm_property_create_blob()
579 ret = __drm_mode_object_add(dev, &blob->base, DRM_MODE_OBJECT_BLOB, in drm_property_create_blob()
582 kvfree(blob); in drm_property_create_blob()
587 list_add_tail(&blob->head_global, in drm_property_create_blob()
591 return blob; in drm_property_create_blob()
596 * drm_property_blob_put - release a blob property reference
597 * @blob: DRM blob property
599 * Releases a reference to a blob property. May free the object.
601 void drm_property_blob_put(struct drm_property_blob *blob) in drm_property_blob_put() argument
603 if (!blob) in drm_property_blob_put()
606 drm_mode_object_put(&blob->base); in drm_property_blob_put()
613 struct drm_property_blob *blob, *bt; in drm_property_destroy_user_blobs() local
617 * blob list any more, so no need to grab dev->blob_lock. in drm_property_destroy_user_blobs()
619 list_for_each_entry_safe(blob, bt, &file_priv->blobs, head_file) { in drm_property_destroy_user_blobs()
620 list_del_init(&blob->head_file); in drm_property_destroy_user_blobs()
621 drm_property_blob_put(blob); in drm_property_destroy_user_blobs()
626 * drm_property_blob_get - acquire blob property reference
627 * @blob: DRM blob property
629 * Acquires a reference to an existing blob property. Returns @blob, which
632 struct drm_property_blob *drm_property_blob_get(struct drm_property_blob *blob) in drm_property_blob_get() argument
634 drm_mode_object_get(&blob->base); in drm_property_blob_get()
635 return blob; in drm_property_blob_get()
640 * drm_property_lookup_blob - look up a blob property and take a reference
642 * @id: id of the blob property
644 * If successful, this takes an additional reference to the blob property.
649 * NULL on failure, pointer to the blob on success.
655 struct drm_property_blob *blob = NULL; in drm_property_lookup_blob() local
659 blob = obj_to_blob(obj); in drm_property_lookup_blob()
660 return blob; in drm_property_lookup_blob()
665 * drm_property_replace_global_blob - replace existing blob property
667 * @replace: location of blob property pointer to be replaced
668 * @length: length of data for new blob, or 0 for no data
669 * @data: content for new blob, or NULL for no data
670 * @obj_holds_id: optional object for property holding blob ID
671 * @prop_holds_id: optional property holding blob ID
674 * This function will replace a global property in the blob list, optionally
677 * If length is 0 or data is NULL, no new blob will be created, and the holding
684 * of a blob property with the value of the MST path information. Calling this
733 * drm_property_replace_blob - replace a blob property
734 * @blob: a pointer to the member blob to be replaced
735 * @new_blob: the new blob to replace with
737 * Return: true if the blob was in fact replaced.
739 bool drm_property_replace_blob(struct drm_property_blob **blob, in drm_property_replace_blob() argument
742 struct drm_property_blob *old_blob = *blob; in drm_property_replace_blob()
750 *blob = new_blob; in drm_property_replace_blob()
756 * drm_property_replace_blob_from_id - replace a blob property taking a reference
758 * @blob: a pointer to the member blob to be replaced
759 * @blob_id: the id of the new blob to replace with
760 * @expected_size: expected size of the blob property
761 * @expected_elem_size: expected size of an element in the blob property
762 * @replaced: if the blob was in fact replaced
764 * Look up the new blob from id, take its reference, check expected sizes of
765 * the blob and its element and replace the old blob by the new one. Advertise
768 * Return: true if the blob was in fact replaced. -EINVAL if the new blob was
772 struct drm_property_blob **blob, in drm_property_replace_blob_from_id() argument
784 "cannot find blob ID %llu\n", blob_id); in drm_property_replace_blob_from_id()
791 "[BLOB:%d] length %zu different from expected %zu\n", in drm_property_replace_blob_from_id()
799 "[BLOB:%d] length %zu not divisible by element size %zu\n", in drm_property_replace_blob_from_id()
806 *replaced |= drm_property_replace_blob(blob, new_blob); in drm_property_replace_blob_from_id()
817 struct drm_property_blob *blob; in drm_mode_getblob_ioctl() local
823 blob = drm_property_lookup_blob(dev, out_resp->blob_id); in drm_mode_getblob_ioctl()
824 if (!blob) in drm_mode_getblob_ioctl()
827 if (out_resp->length == blob->length) { in drm_mode_getblob_ioctl()
829 blob->data, in drm_mode_getblob_ioctl()
830 blob->length)) { in drm_mode_getblob_ioctl()
835 out_resp->length = blob->length; in drm_mode_getblob_ioctl()
837 drm_property_blob_put(blob); in drm_mode_getblob_ioctl()
846 struct drm_property_blob *blob; in drm_mode_createblob_ioctl() local
852 blob = drm_property_create_blob(dev, out_resp->length, NULL); in drm_mode_createblob_ioctl()
853 if (IS_ERR(blob)) in drm_mode_createblob_ioctl()
854 return PTR_ERR(blob); in drm_mode_createblob_ioctl()
856 if (copy_from_user(blob->data, in drm_mode_createblob_ioctl()
864 * as only the same file_priv can remove the blob; at this point, it is in drm_mode_createblob_ioctl()
867 out_resp->blob_id = blob->base.id; in drm_mode_createblob_ioctl()
868 list_add_tail(&blob->head_file, &file_priv->blobs); in drm_mode_createblob_ioctl()
874 drm_property_blob_put(blob); in drm_mode_createblob_ioctl()
882 struct drm_property_blob *blob = NULL, *bt; in drm_mode_destroyblob_ioctl() local
889 blob = drm_property_lookup_blob(dev, out_resp->blob_id); in drm_mode_destroyblob_ioctl()
890 if (!blob) in drm_mode_destroyblob_ioctl()
896 if (bt == blob) { in drm_mode_destroyblob_ioctl()
908 * reference on the blob. */ in drm_mode_destroyblob_ioctl()
909 list_del_init(&blob->head_file); in drm_mode_destroyblob_ioctl()
913 drm_property_blob_put(blob); in drm_mode_destroyblob_ioctl()
914 drm_property_blob_put(blob); in drm_mode_destroyblob_ioctl()
920 drm_property_blob_put(blob); in drm_mode_destroyblob_ioctl()
961 struct drm_property_blob *blob; in drm_property_change_valid_get() local
966 blob = drm_property_lookup_blob(property->dev, value); in drm_property_change_valid_get()
967 if (blob) { in drm_property_change_valid_get()
968 *ref = &blob->base; in drm_property_change_valid_get()