2 #ifndef INTEL_DRM_DEVICE_H
3 #define INTEL_DRM_DEVICE_H
5 #include "pipe/internal/p_winsys_screen.h"
6 #include "pipe/p_context.h"
9 #include "intel_bufmgr.h"
17 struct intel_be_device
19 struct pipe_winsys base
;
24 int fd
; /**< Drm file discriptor */
28 size_t max_batch_size
;
29 size_t max_vertex_size
;
32 drm_intel_bufmgr
*gem
;
36 static INLINE
struct intel_be_device
*
37 intel_be_device(struct pipe_winsys
*winsys
)
39 return (struct intel_be_device
*)winsys
;
43 intel_be_init_device(struct intel_be_device
*device
, int fd
, unsigned id
);
49 struct intel_be_buffer
{
50 struct pipe_buffer base
;
61 * Create a texture from a shared drm handle.
64 intel_be_texture_from_shared_handle(struct drm_api
*api
,
65 struct pipe_screen
*screen
,
66 struct pipe_texture
*templ
,
72 * Gets a shared handle from a texture.
74 * If texture is destroyed handle may become invalid.
77 intel_be_shared_handle_from_texture(struct drm_api
*api
,
78 struct pipe_screen
*screen
,
79 struct pipe_texture
*texture
,
84 * Gets the local handle from a texture. As used by KMS.
86 * If texture is destroyed handle may become invalid.
89 intel_be_local_handle_from_texture(struct drm_api
*api
,
90 struct pipe_screen
*screen
,
91 struct pipe_texture
*texture
,
95 static INLINE
struct intel_be_buffer
*
96 intel_be_buffer(struct pipe_buffer
*buf
)
98 return (struct intel_be_buffer
*)buf
;
101 static INLINE drm_intel_bo
*
102 intel_bo(struct pipe_buffer
*buf
)
104 return intel_be_buffer(buf
)->bo
;