freedreno: implement pipe screen's resource_from_memobj
authorEduardo Lima Mitev <elima@igalia.com>
Wed, 8 Apr 2020 11:59:48 +0000 (13:59 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 18 Aug 2020 20:40:40 +0000 (20:40 +0000)
commit6bef126c6214d68dccc82385f6bc91941ccabacc
treec5bc912016719876ee2275396c07f159d0af2016
parent03fdf418a58c60fcbe1d010f400d3a4692146101
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>
src/gallium/drivers/freedreno/freedreno_resource.c