• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2014-2018 NVIDIA Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 #ifndef TEGRA_CONTEXT_H
25 #define TEGRA_CONTEXT_H
26 
27 #include "pipe/p_context.h"
28 #include "pipe/p_state.h"
29 
30 struct tegra_screen;
31 
32 struct tegra_context {
33    struct pipe_context base;
34    struct pipe_context *gpu;
35 };
36 
37 static inline struct tegra_context *
to_tegra_context(struct pipe_context * context)38 to_tegra_context(struct pipe_context *context)
39 {
40    return (struct tegra_context *)context;
41 }
42 
43 struct pipe_context *
44 tegra_screen_context_create(struct pipe_screen *pscreen, void *priv,
45                             unsigned int flags);
46 
47 struct tegra_sampler_view {
48    struct pipe_sampler_view base;
49    struct pipe_sampler_view *gpu;
50 };
51 
52 static inline struct tegra_sampler_view *
to_tegra_sampler_view(struct pipe_sampler_view * view)53 to_tegra_sampler_view(struct pipe_sampler_view *view)
54 {
55    return (struct tegra_sampler_view *)view;
56 }
57 
58 static inline struct pipe_sampler_view *
tegra_sampler_view_unwrap(struct pipe_sampler_view * view)59 tegra_sampler_view_unwrap(struct pipe_sampler_view *view)
60 {
61    if (!view)
62       return NULL;
63 
64    return to_tegra_sampler_view(view)->gpu;
65 }
66 
67 struct tegra_transfer {
68    struct pipe_transfer base;
69    struct pipe_transfer *gpu;
70 
71    unsigned int count;
72    void *map;
73 };
74 
75 static inline struct tegra_transfer *
to_tegra_transfer(struct pipe_transfer * transfer)76 to_tegra_transfer(struct pipe_transfer *transfer)
77 {
78    return (struct tegra_transfer *)transfer;
79 }
80 
81 #endif /* TEGRA_SCREEN_H */
82