2 * Copyright (C) 2016 Christian Gmeiner <christian.gmeiner@gmail.com>
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:
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
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 FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * Christian Gmeiner <christian.gmeiner@gmail.com>
31 #include "state_tracker/drm_driver.h"
32 #include "pipe/p_state.h"
34 struct renderonly_scanout
{
38 struct pipe_resource
*prime
;
43 * Create a renderonly_scanout object for scanout resource.
45 * This function creates a renderonly_scanout object based on the provided
46 * resource. The library is designed that the driver specific pipe_resource
47 * struct holds a pointer to a renderonly_scanout struct.
49 * struct driver_resource {
50 * struct pipe_resource base;
51 * struct renderonly_scanout *scanout;
55 * The renderonly_scanout object exits for two reasons:
56 * - Do any special treatment for a scanout resource like importing the GPU
57 * resource into the scanout hw.
58 * - Make it easier for a gallium driver to detect if anything special needs
59 * to be done in flush_resource(..) like a resolve to linear.
61 struct renderonly_scanout
*(*create_for_resource
)(struct pipe_resource
*rsc
,
62 struct renderonly
*ro
);
68 renderonly_dup(const struct renderonly
*ro
);
70 static inline struct renderonly_scanout
*
71 renderonly_scanout_for_resource(struct pipe_resource
*rsc
, struct renderonly
*ro
)
73 return ro
->create_for_resource(rsc
, ro
);
76 struct renderonly_scanout
*
77 renderonly_scanout_for_prime(struct pipe_resource
*rsc
, struct renderonly
*ro
);
80 renderonly_scanout_destroy(struct renderonly_scanout
*scanout
,
81 struct renderonly
*ro
);
84 renderonly_get_handle(struct renderonly_scanout
*scanout
,
85 struct winsys_handle
*handle
)
90 handle
->handle
= scanout
->handle
;
91 handle
->stride
= scanout
->stride
;
97 * Create a dumb buffer object for a resource at scanout hw.
99 struct renderonly_scanout
*
100 renderonly_create_kms_dumb_buffer_for_resource(struct pipe_resource
*rsc
,
101 struct renderonly
*ro
);
104 * Import GPU resource into scanout hw.
106 struct renderonly_scanout
*
107 renderonly_create_gpu_import_for_resource(struct pipe_resource
*rsc
,
108 struct renderonly
*ro
);
110 #endif /* RENDERONLY_H_ */