• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**************************************************************************
2  *
3  * Copyright (C) 2009 VMware, Inc.
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sub license, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice (including the
15  * next paragraph) shall be included in all copies or substantial portions
16  * of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  *
26  **************************************************************************/
27 /*
28  * Author: Keith Whitwell <keithw@vmware.com>
29  * Author: Jakob Bornecrantz <wallbraker@gmail.com>
30  */
31 
32 #ifndef DRI_CONTEXT_H
33 #define DRI_CONTEXT_H
34 
35 #include "dri_util.h"
36 #include "util/compiler.h"
37 #include "hud/hud_context.h"
38 
39 struct pipe_context;
40 struct pipe_fence;
41 struct st_context;
42 struct dri_drawable;
43 struct dri_screen;
44 
45 struct dri_context
46 {
47    /* dri */
48    struct dri_screen *screen;
49 
50    /**
51     * Pointer to drawable currently bound to this context for drawing.
52     */
53    struct dri_drawable *draw;
54 
55    /**
56     * Pointer to drawable currently bound to this context for reading.
57     */
58    struct dri_drawable *read;
59 
60    /**
61     * True if the dri_drawable's current __DRIimageBufferMask is
62     * __DRI_IMAGE_BUFFER_SHARED.
63     */
64    bool is_shared_buffer_bound;
65 
66    /**
67     * The loaders's private context data.  This structure is opaque.
68     */
69    void *loaderPrivate;
70 
71    struct {
72        int draw_stamp;
73        int read_stamp;
74    } dri2;
75 
76    /* gallium */
77    struct st_context *st;
78    struct pp_queue_t *pp;
79    struct hud_context *hud;
80 };
81 
82 /***********************************************************************
83  * dri_context.c
84  */
85 void dri_destroy_context(struct dri_context *ctx);
86 
87 bool
88 dri_unbind_context(struct dri_context *ctx);
89 
90 bool
91 dri_make_current(struct dri_context *ctx,
92                  struct dri_drawable *draw,
93 		 struct dri_drawable *read);
94 
95 struct dri_context *
96 dri_get_current(void);
97 
98 struct dri_context *
99 dri_create_context(struct dri_screen *screen,
100                    gl_api api, const struct gl_config *visual,
101                    const struct __DriverContextConfig *ctx_config,
102                    unsigned *error,
103                    struct dri_context *sharedContextPrivate,
104                    void *loaderPrivate);
105 
106 #endif
107 
108 /* vim: set sw=3 ts=8 sts=3 expandtab: */
109