Path: blob/21.2-virgl/src/gallium/drivers/tegra/tegra_resource.h
4570 views
/*1* Copyright © 2014-2018 NVIDIA Corporation2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS20* IN THE SOFTWARE.21*/2223#ifndef TEGRA_RESOURCE_H24#define TEGRA_RESOURCE_H2526#include "pipe/p_state.h"2728struct winsys_handle;2930struct tegra_resource {31struct pipe_resource base;32struct pipe_resource *gpu;3334uint64_t modifier;35uint32_t stride;36uint32_t handle;37size_t size;38};3940static inline struct tegra_resource *41to_tegra_resource(struct pipe_resource *resource)42{43return (struct tegra_resource *)resource;44}4546static inline struct pipe_resource *47tegra_resource_unwrap(struct pipe_resource *resource)48{49if (!resource)50return NULL;5152return to_tegra_resource(resource)->gpu;53}5455struct tegra_surface {56struct pipe_surface base;57struct pipe_surface *gpu;58};5960static inline struct tegra_surface *61to_tegra_surface(struct pipe_surface *surface)62{63return (struct tegra_surface *)surface;64}6566static inline struct pipe_surface *67tegra_surface_unwrap(struct pipe_surface *surface)68{69if (!surface)70return NULL;7172return to_tegra_surface(surface)->gpu;73}7475#endif /* TEGRA_RESOURCE_H */767778