Squashed commit of the following:
[profile/ivi/mesa.git] / src / gallium / include / state_tracker / dri1_api.h
1 #ifndef _DRI1_API_H_
2 #define _DRI1_API_H_
3
4 #include "pipe/p_compiler.h"
5 #include "pipe/p_screen.h"
6 #include "pipe/p_format.h"
7
8 #include "state_tracker/drm_api.h"
9
10 struct pipe_screen;
11 struct pipe_winsys;
12 struct pipe_buffer;
13 struct pipe_context;
14 struct pipe_resource;
15
16 struct drm_clip_rect;
17
18 struct dri1_api_version
19 {
20    int major;
21    int minor;
22    int patch_level;
23 };
24
25 /**
26  * This callback struct is intended for drivers that need to take
27  * the hardware lock on command submission.
28  */
29
30 struct dri1_api_lock_funcs
31 {
32    void (*lock) (struct pipe_context * pipe);
33    void (*unlock) (struct pipe_context * locked_pipe);
34    boolean(*is_locked) (struct pipe_context * locked_pipe);
35    boolean(*is_lock_lost) (struct pipe_context * locked_pipe);
36    void (*clear_lost_lock) (struct pipe_context * locked_pipe);
37 };
38
39 struct dri1_api
40 {
41    /**
42     * For flushing to the front buffer. A driver should implement one and only
43     * one of the functions below. The present_locked functions allows a dri1
44     * driver to pageflip.
45     */
46
47    /*@{ */
48
49    struct pipe_surface *(*front_srf_locked) (struct pipe_context *
50                                              locked_pipe);
51
52    void (*present_locked) (struct pipe_context * locked_pipe,
53                            struct pipe_surface * surf,
54                            const struct drm_clip_rect * rect,
55                            unsigned int num_clip,
56                            int x_draw, int y_draw,
57                            const struct drm_clip_rect * src_bbox,
58                            struct pipe_fence_handle ** fence);
59    /*@} */
60 };
61
62 struct dri1_create_screen_arg
63 {
64    struct drm_create_screen_arg base;
65
66    struct dri1_api_lock_funcs *lf;
67    void *ddx_info;
68    int ddx_info_size;
69    void *sarea;
70
71    struct dri1_api_version ddx_version;
72    struct dri1_api_version dri_version;
73    struct dri1_api_version drm_version;
74
75    /*
76     * out parameters;
77     */
78
79    struct dri1_api *api;
80 };
81
82 #endif