Skip to content

docs(core/ocl): clarify ownership of arguments passed into OpenCL related functions#20536

Merged
alalek merged 2 commits intoopencv:masterfrom
hedgepigdaniel:fix/ocl-context-create-ownership
Aug 11, 2021
Merged

docs(core/ocl): clarify ownership of arguments passed into OpenCL related functions#20536
alalek merged 2 commits intoopencv:masterfrom
hedgepigdaniel:fix/ocl-context-create-ownership

Conversation

@hedgepigdaniel
Copy link
Copy Markdown
Contributor

@hedgepigdaniel hedgepigdaniel commented Aug 11, 2021

resolves #20518

I've documented the behavior of the following functions, which take ownership of one reference of the raw OpenCL arguments passed in:

  • ocl::OpenCLExecutionContext::create
  • ocl::Device::fromHandle

I did not change the documentation for the following functions, which do not take ownership of their arguments:

  • ocl::Context::fromHandle

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

Although it is technically true that OpenCLExecutionContext::create
calls `clRetainContext` on its context argument, it is misleading
because it does not increase the reference count overall. Clarify that
the ownership of one reference of the passed context and device is
taken.
@hedgepigdaniel hedgepigdaniel changed the title docs(core/ocl): clarify ownership in OpenCLExecutionContext::create docs(core/ocl): clarify ownership of arguments passed into OpenCL related functions Aug 11, 2021
@asmorkalov asmorkalov requested a review from alalek August 11, 2021 14:08
Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍

@alalek alalek merged commit 4d63a89 into opencv:master Aug 11, 2021
@alalek alalek mentioned this pull request Oct 15, 2021
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
…reate-ownership

docs(core/ocl): clarify ownership of arguments passed into OpenCL related functions

* docs(core/ocl): clarify ownership in OpenCLExecutionContext::create

Although it is technically true that OpenCLExecutionContext::create
calls `clRetainContext` on its context argument, it is misleading
because it does not increase the reference count overall. Clarify that
the ownership of one reference of the passed context and device is
taken.

* docs(core/ocl): document ownership transfer in ocl::Device::fromHandle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenCLExecutionContext::create takes ownership of OpenCL context and device

2 participants