1782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell/**************************************************************************
2782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell *
3782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * Copyright 2009, VMware, Inc.
4782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * All Rights Reserved.
5782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell *
6782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a
7782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * copy of this software and associated documentation files (the
8782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * "Software"), to deal in the Software without restriction, including
9782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * without limitation the rights to use, copy, modify, merge, publish,
10782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * distribute, sub license, and/or sell copies of the Software, and to
11782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * permit persons to whom the Software is furnished to do so, subject to
12782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * the following conditions:
13782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell *
14782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * The above copyright notice and this permission notice (including the
15782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * next paragraph) shall be included in all copies or substantial portions
16782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * of the Software.
17782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell *
18782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
211d060e36f248b2c1d2575d1e2cbd362b8345ae55Jakob Bornecrantz * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell *
26782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell **************************************************************************/
27782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell
283e492acc579ba0a98d0388aa73605aba5bf9840cKeith Whitwell#ifndef DRI_DRAWABLE_H
293e492acc579ba0a98d0388aa73605aba5bf9840cKeith Whitwell#define DRI_DRAWABLE_H
30782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell
313e492acc579ba0a98d0388aa73605aba5bf9840cKeith Whitwell#include "pipe/p_compiler.h"
32ca69249f25e0cb89dbfc3d98b92e7386a3029efaChia-I Wu#include "pipe/p_format.h"
335ff21634f3074122ed8b8e4019c8092e31be0335Chia-I Wu#include "state_tracker/st_api.h"
34782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell
35782eae916d1f02121785448d4ab4759767a46afdKeith Whitwellstruct pipe_surface;
363e492acc579ba0a98d0388aa73605aba5bf9840cKeith Whitwellstruct st_framebuffer;
37b26aee0ffed3f3baee9d65365812e40598a26138Jakob Bornecrantzstruct dri_context;
38782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell
3923c41233ce9ac13ba60242f9e839d5b13d1ea803Thomas Hellstrom#define DRI_SWAP_FENCES_MAX 4
4023c41233ce9ac13ba60242f9e839d5b13d1ea803Thomas Hellstrom#define DRI_SWAP_FENCES_MASK 3
4123c41233ce9ac13ba60242f9e839d5b13d1ea803Thomas Hellstrom#define DRI_SWAP_FENCES_DEFAULT 1
4223c41233ce9ac13ba60242f9e839d5b13d1ea803Thomas Hellstrom
433e492acc579ba0a98d0388aa73605aba5bf9840cKeith Whitwellstruct dri_drawable
443e492acc579ba0a98d0388aa73605aba5bf9840cKeith Whitwell{
4527779ddad5c61d2fc46367e1556b5e53403c2a97Jakob Bornecrantz   struct st_framebuffer_iface base;
4627779ddad5c61d2fc46367e1556b5e53403c2a97Jakob Bornecrantz   struct st_visual stvis;
4727779ddad5c61d2fc46367e1556b5e53403c2a97Jakob Bornecrantz
4894ccc31ba4f64ac480137fd90f1ded44d2072f6eJakob Bornecrantz   struct dri_screen *screen;
4994ccc31ba4f64ac480137fd90f1ded44d2072f6eJakob Bornecrantz
501d060e36f248b2c1d2575d1e2cbd362b8345ae55Jakob Bornecrantz   /* dri */
51d61f07318c8678901b948fdaa8ccdf37aa3203e9Kristian Høgsberg   __DRIdrawable *dPriv;
52d61f07318c8678901b948fdaa8ccdf37aa3203e9Kristian Høgsberg   __DRIscreen *sPriv;
53782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell
547d11a392d780ef7f0374f8da87e3ba416d880cf2Jakob Bornecrantz   __DRIbuffer old[8];
557d11a392d780ef7f0374f8da87e3ba416d880cf2Jakob Bornecrantz   unsigned old_num;
567d11a392d780ef7f0374f8da87e3ba416d880cf2Jakob Bornecrantz   unsigned old_w;
577d11a392d780ef7f0374f8da87e3ba416d880cf2Jakob Bornecrantz   unsigned old_h;
587d11a392d780ef7f0374f8da87e3ba416d880cf2Jakob Bornecrantz
59287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell   struct pipe_resource *textures[ST_ATTACHMENT_COUNT];
605ff21634f3074122ed8b8e4019c8092e31be0335Chia-I Wu   unsigned int texture_mask, texture_stamp;
615ff21634f3074122ed8b8e4019c8092e31be0335Chia-I Wu
6223c41233ce9ac13ba60242f9e839d5b13d1ea803Thomas Hellstrom   struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX];
6323c41233ce9ac13ba60242f9e839d5b13d1ea803Thomas Hellstrom   unsigned int cur_fences;
6423c41233ce9ac13ba60242f9e839d5b13d1ea803Thomas Hellstrom   unsigned int head;
6523c41233ce9ac13ba60242f9e839d5b13d1ea803Thomas Hellstrom   unsigned int tail;
6623c41233ce9ac13ba60242f9e839d5b13d1ea803Thomas Hellstrom   unsigned int desired_fences;
6723c41233ce9ac13ba60242f9e839d5b13d1ea803Thomas Hellstrom
68a30b966f8345cb99922a416fce2da6edb70f864cGeorge Sapountzis   /* used only by DRISW */
69a30b966f8345cb99922a416fce2da6edb70f864cGeorge Sapountzis   struct pipe_surface *drisw_surface;
70873ddf547d5aeb68f37a172d73131c6bc51101f6George Sapountzis
71873ddf547d5aeb68f37a172d73131c6bc51101f6George Sapountzis   /* hooks filled in by dri2 & drisw */
72873ddf547d5aeb68f37a172d73131c6bc51101f6George Sapountzis   void (*allocate_textures)(struct dri_drawable *drawable,
73873ddf547d5aeb68f37a172d73131c6bc51101f6George Sapountzis                             const enum st_attachment_type *statts,
74873ddf547d5aeb68f37a172d73131c6bc51101f6George Sapountzis                             unsigned count);
75873ddf547d5aeb68f37a172d73131c6bc51101f6George Sapountzis
76873ddf547d5aeb68f37a172d73131c6bc51101f6George Sapountzis   void (*update_drawable_info)(struct dri_drawable *drawable);
77873ddf547d5aeb68f37a172d73131c6bc51101f6George Sapountzis
78873ddf547d5aeb68f37a172d73131c6bc51101f6George Sapountzis   void (*flush_frontbuffer)(struct dri_drawable *drawable,
79873ddf547d5aeb68f37a172d73131c6bc51101f6George Sapountzis                             enum st_attachment_type statt);
8098aa2a8f725e44aec8bd998fe436a134e94f13bbBenjamin Franzke
8198aa2a8f725e44aec8bd998fe436a134e94f13bbBenjamin Franzke   void (*update_tex_buffer)(struct dri_drawable *drawable,
8298aa2a8f725e44aec8bd998fe436a134e94f13bbBenjamin Franzke                             struct dri_context *ctx,
8398aa2a8f725e44aec8bd998fe436a134e94f13bbBenjamin Franzke                             struct pipe_resource *res);
843e492acc579ba0a98d0388aa73605aba5bf9840cKeith Whitwell};
85782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell
863e492acc579ba0a98d0388aa73605aba5bf9840cKeith Whitwellstatic INLINE struct dri_drawable *
87d61f07318c8678901b948fdaa8ccdf37aa3203e9Kristian Høgsbergdri_drawable(__DRIdrawable * driDrawPriv)
883e492acc579ba0a98d0388aa73605aba5bf9840cKeith Whitwell{
895b6ec5a553876266bfa2ef65081aa1075419b97eChia-I Wu   return (struct dri_drawable *) (driDrawPriv)
905b6ec5a553876266bfa2ef65081aa1075419b97eChia-I Wu      ? driDrawPriv->driverPrivate : NULL;
913e492acc579ba0a98d0388aa73605aba5bf9840cKeith Whitwell}
923e492acc579ba0a98d0388aa73605aba5bf9840cKeith Whitwell
933e492acc579ba0a98d0388aa73605aba5bf9840cKeith Whitwell/***********************************************************************
943e492acc579ba0a98d0388aa73605aba5bf9840cKeith Whitwell * dri_drawable.c
953e492acc579ba0a98d0388aa73605aba5bf9840cKeith Whitwell */
961d060e36f248b2c1d2575d1e2cbd362b8345ae55Jakob Bornecrantzboolean
97d61f07318c8678901b948fdaa8ccdf37aa3203e9Kristian Høgsbergdri_create_buffer(__DRIscreen * sPriv,
98d61f07318c8678901b948fdaa8ccdf37aa3203e9Kristian Høgsberg		  __DRIdrawable * dPriv,
99d3491e775fb07f891463b2185d74bbad62f3ed24Kristian Høgsberg		  const struct gl_config * visual, boolean isPixmap);
1003e492acc579ba0a98d0388aa73605aba5bf9840cKeith Whitwell
101d61f07318c8678901b948fdaa8ccdf37aa3203e9Kristian Høgsbergvoid dri_destroy_buffer(__DRIdrawable * dPriv);
102782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell
103ea6a52a1f8e7fd72b5506218c31e58088131f1f5Jakob Bornecrantzvoid
104ea6a52a1f8e7fd72b5506218c31e58088131f1f5Jakob Bornecrantzdri_drawable_get_format(struct dri_drawable *drawable,
105ea6a52a1f8e7fd72b5506218c31e58088131f1f5Jakob Bornecrantz                        enum st_attachment_type statt,
106ea6a52a1f8e7fd72b5506218c31e58088131f1f5Jakob Bornecrantz                        enum pipe_format *format,
107ea6a52a1f8e7fd72b5506218c31e58088131f1f5Jakob Bornecrantz                        unsigned *bind);
108ea6a52a1f8e7fd72b5506218c31e58088131f1f5Jakob Bornecrantz
109c14b4371ed58859d264b7b2581cfedc9cfd8401fGeorge Sapountzisextern const __DRItexBufferExtension driTexBufferExtension;
11023c41233ce9ac13ba60242f9e839d5b13d1ea803Thomas Hellstromextern const __DRI2throttleExtension dri2ThrottleExtension;
111782eae916d1f02121785448d4ab4759767a46afdKeith Whitwell#endif
1121d060e36f248b2c1d2575d1e2cbd362b8345ae55Jakob Bornecrantz
1131d060e36f248b2c1d2575d1e2cbd362b8345ae55Jakob Bornecrantz/* vim: set sw=3 ts=8 sts=3 expandtab: */
114