freedreno: implement pipe screen's resource_from_memobj

v2: Use 'prsc' and 'rsc', 'pmemobj' and 'memobj' for consistency with
    rest of the code. (Rob Clark)

v3: - Use the existing flag PIPE_BIND_LINEAR instead (Marek Olšák)
    - Assert that the resource is not intended for scanout (Rob Clark)
    - Use the fd_resource_allocate_and_resolve() helper (Rob Clark)
    - Check that bo's resolved size fit into memobj's bo size (Rob Clark)

v4: Don't steal memobj's bo, but share it instead by getting a new
ref. (Rob Clark)

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4565>
1 file changed