egl_g3d.h revision 4c7001462607e6e99e474d6271dd481d3f8f201c
149381d63e61c724b156b76068058df1c01a906c2Chia-I Wu/*
249381d63e61c724b156b76068058df1c01a906c2Chia-I Wu * Mesa 3-D graphics library
349381d63e61c724b156b76068058df1c01a906c2Chia-I Wu * Version:  7.8
449381d63e61c724b156b76068058df1c01a906c2Chia-I Wu *
549381d63e61c724b156b76068058df1c01a906c2Chia-I Wu * Copyright (C) 2009-2010 Chia-I Wu <olv@0xlab.org>
649381d63e61c724b156b76068058df1c01a906c2Chia-I Wu *
749381d63e61c724b156b76068058df1c01a906c2Chia-I Wu * Permission is hereby granted, free of charge, to any person obtaining a
849381d63e61c724b156b76068058df1c01a906c2Chia-I Wu * copy of this software and associated documentation files (the "Software"),
949381d63e61c724b156b76068058df1c01a906c2Chia-I Wu * to deal in the Software without restriction, including without limitation
1049381d63e61c724b156b76068058df1c01a906c2Chia-I Wu * the rights to use, copy, modify, merge, publish, distribute, sublicense,
1149381d63e61c724b156b76068058df1c01a906c2Chia-I Wu * and/or sell copies of the Software, and to permit persons to whom the
1249381d63e61c724b156b76068058df1c01a906c2Chia-I Wu * Software is furnished to do so, subject to the following conditions:
1349381d63e61c724b156b76068058df1c01a906c2Chia-I Wu *
1449381d63e61c724b156b76068058df1c01a906c2Chia-I Wu * The above copyright notice and this permission notice shall be included
1549381d63e61c724b156b76068058df1c01a906c2Chia-I Wu * in all copies or substantial portions of the Software.
1649381d63e61c724b156b76068058df1c01a906c2Chia-I Wu *
17ba81b0743efd978509b1931d7b4b93f37e8aeb5eChia-I Wu * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18ba81b0743efd978509b1931d7b4b93f37e8aeb5eChia-I Wu * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1949381d63e61c724b156b76068058df1c01a906c2Chia-I Wu * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20ba81b0743efd978509b1931d7b4b93f37e8aeb5eChia-I Wu * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21ba81b0743efd978509b1931d7b4b93f37e8aeb5eChia-I Wu * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22ba81b0743efd978509b1931d7b4b93f37e8aeb5eChia-I Wu * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23ba81b0743efd978509b1931d7b4b93f37e8aeb5eChia-I Wu * DEALINGS IN THE SOFTWARE.
2449381d63e61c724b156b76068058df1c01a906c2Chia-I Wu */
2549381d63e61c724b156b76068058df1c01a906c2Chia-I Wu
2649381d63e61c724b156b76068058df1c01a906c2Chia-I Wu#ifndef _EGL_G3D_H_
2749381d63e61c724b156b76068058df1c01a906c2Chia-I Wu#define _EGL_G3D_H_
2849381d63e61c724b156b76068058df1c01a906c2Chia-I Wu
2949381d63e61c724b156b76068058df1c01a906c2Chia-I Wu#include "pipe/p_compiler.h"
3049381d63e61c724b156b76068058df1c01a906c2Chia-I Wu#include "pipe/p_screen.h"
3149381d63e61c724b156b76068058df1c01a906c2Chia-I Wu#include "pipe/p_context.h"
3249381d63e61c724b156b76068058df1c01a906c2Chia-I Wu#include "pipe/p_format.h"
334b2495661f3a5ac8ed07b68c5d5bf90adee2c37dChia-I Wu#include "os/os_thread.h"
3449381d63e61c724b156b76068058df1c01a906c2Chia-I Wu#include "egldriver.h"
3549381d63e61c724b156b76068058df1c01a906c2Chia-I Wu#include "egldisplay.h"
3649381d63e61c724b156b76068058df1c01a906c2Chia-I Wu#include "eglcontext.h"
3749381d63e61c724b156b76068058df1c01a906c2Chia-I Wu#include "eglsurface.h"
3849381d63e61c724b156b76068058df1c01a906c2Chia-I Wu#include "eglconfig.h"
399373447a614e7b401919328b589b5f2607e456fdChia-I Wu#include "eglimage.h"
404b2495661f3a5ac8ed07b68c5d5bf90adee2c37dChia-I Wu#include "eglsync.h"
412dcdf19ee3a19fb41005d53f0dbc6e8a3970a8b6Chia-I Wu#include "eglscreen.h"
422dcdf19ee3a19fb41005d53f0dbc6e8a3970a8b6Chia-I Wu#include "eglmode.h"
4349381d63e61c724b156b76068058df1c01a906c2Chia-I Wu
4449381d63e61c724b156b76068058df1c01a906c2Chia-I Wu#include "native.h"
45a924dd18c32bbc0056a799cf621dc2835644c16eChia-I Wu#include "egl_g3d_st.h"
46d5ab243d5a5bacbd2ba615d40f13c8ab37364745Chia-I Wu#include "egl_g3d_loader.h"
4749381d63e61c724b156b76068058df1c01a906c2Chia-I Wu
4849381d63e61c724b156b76068058df1c01a906c2Chia-I Wustruct egl_g3d_driver {
4949381d63e61c724b156b76068058df1c01a906c2Chia-I Wu   _EGLDriver base;
50d5ab243d5a5bacbd2ba615d40f13c8ab37364745Chia-I Wu   const struct egl_g3d_loader *loader;
51ea05299ce54ea0463626277907cab8e849884740Chia-I Wu   const struct native_platform *platforms[_EGL_NUM_PLATFORMS];
5249381d63e61c724b156b76068058df1c01a906c2Chia-I Wu};
5349381d63e61c724b156b76068058df1c01a906c2Chia-I Wu
5449381d63e61c724b156b76068058df1c01a906c2Chia-I Wustruct egl_g3d_display {
5549381d63e61c724b156b76068058df1c01a906c2Chia-I Wu   struct native_display *native;
5649381d63e61c724b156b76068058df1c01a906c2Chia-I Wu
57d5ab243d5a5bacbd2ba615d40f13c8ab37364745Chia-I Wu   const struct egl_g3d_loader *loader;
58a924dd18c32bbc0056a799cf621dc2835644c16eChia-I Wu   struct st_manager *smapi;
59fecb97aab42e1a099f12cc7a47ed7219cd041809Chia-I Wu   struct pipe_context *pipe;
6049381d63e61c724b156b76068058df1c01a906c2Chia-I Wu};
6149381d63e61c724b156b76068058df1c01a906c2Chia-I Wu
6249381d63e61c724b156b76068058df1c01a906c2Chia-I Wustruct egl_g3d_context {
6349381d63e61c724b156b76068058df1c01a906c2Chia-I Wu   _EGLContext base;
6449381d63e61c724b156b76068058df1c01a906c2Chia-I Wu
65a924dd18c32bbc0056a799cf621dc2835644c16eChia-I Wu   struct st_api *stapi;
6649381d63e61c724b156b76068058df1c01a906c2Chia-I Wu
67a924dd18c32bbc0056a799cf621dc2835644c16eChia-I Wu   struct st_context_iface *stctxi;
6849381d63e61c724b156b76068058df1c01a906c2Chia-I Wu};
6949381d63e61c724b156b76068058df1c01a906c2Chia-I Wu
7049381d63e61c724b156b76068058df1c01a906c2Chia-I Wustruct egl_g3d_surface {
7149381d63e61c724b156b76068058df1c01a906c2Chia-I Wu   _EGLSurface base;
72a924dd18c32bbc0056a799cf621dc2835644c16eChia-I Wu
73a924dd18c32bbc0056a799cf621dc2835644c16eChia-I Wu   struct st_visual stvis;
74a924dd18c32bbc0056a799cf621dc2835644c16eChia-I Wu   struct st_framebuffer_iface *stfbi;
75a924dd18c32bbc0056a799cf621dc2835644c16eChia-I Wu
76f69b35fa15f43747dde29addaeec845604d7e127Chia-I Wu   /* the native surface;  NULL for pbuffers */
7749381d63e61c724b156b76068058df1c01a906c2Chia-I Wu   struct native_surface *native;
78287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell   struct pipe_resource *render_texture;
79f69b35fa15f43747dde29addaeec845604d7e127Chia-I Wu
80a5183a38c293249dad36a7230ff872ea7485eee0Chia-I Wu   EGLenum client_buffer_type;
81a5183a38c293249dad36a7230ff872ea7485eee0Chia-I Wu   EGLClientBuffer client_buffer;
82a5183a38c293249dad36a7230ff872ea7485eee0Chia-I Wu
836cb89b23eeac50cfb0c5fb8d77e19f869b524eacChia-I Wu   unsigned int sequence_number;
8449381d63e61c724b156b76068058df1c01a906c2Chia-I Wu};
8549381d63e61c724b156b76068058df1c01a906c2Chia-I Wu
8649381d63e61c724b156b76068058df1c01a906c2Chia-I Wustruct egl_g3d_config {
8749381d63e61c724b156b76068058df1c01a906c2Chia-I Wu   _EGLConfig base;
8849381d63e61c724b156b76068058df1c01a906c2Chia-I Wu   const struct native_config *native;
89a924dd18c32bbc0056a799cf621dc2835644c16eChia-I Wu   struct st_visual stvis;
9049381d63e61c724b156b76068058df1c01a906c2Chia-I Wu};
9149381d63e61c724b156b76068058df1c01a906c2Chia-I Wu
929373447a614e7b401919328b589b5f2607e456fdChia-I Wustruct egl_g3d_image {
939373447a614e7b401919328b589b5f2607e456fdChia-I Wu   _EGLImage base;
94287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell   struct pipe_resource *texture;
959373447a614e7b401919328b589b5f2607e456fdChia-I Wu   unsigned level;
964c7001462607e6e99e474d6271dd481d3f8f201cRoland Scheidegger   unsigned layer;
979373447a614e7b401919328b589b5f2607e456fdChia-I Wu};
989373447a614e7b401919328b589b5f2607e456fdChia-I Wu
996c7e0b95a4a16d268aa3ca74c5c8407779533314Chia-I Wu/* standard typecasts */
1006c7e0b95a4a16d268aa3ca74c5c8407779533314Chia-I Wu_EGL_DRIVER_STANDARD_TYPECASTS(egl_g3d)
1016c7e0b95a4a16d268aa3ca74c5c8407779533314Chia-I Wu_EGL_DRIVER_TYPECAST(egl_g3d_image, _EGLImage, obj)
1026c7e0b95a4a16d268aa3ca74c5c8407779533314Chia-I Wu
1034b2495661f3a5ac8ed07b68c5d5bf90adee2c37dChia-I Wu#ifdef EGL_KHR_reusable_sync
1044b2495661f3a5ac8ed07b68c5d5bf90adee2c37dChia-I Wu
1054b2495661f3a5ac8ed07b68c5d5bf90adee2c37dChia-I Wustruct egl_g3d_sync {
1064b2495661f3a5ac8ed07b68c5d5bf90adee2c37dChia-I Wu   _EGLSync base;
1074b2495661f3a5ac8ed07b68c5d5bf90adee2c37dChia-I Wu
1084b2495661f3a5ac8ed07b68c5d5bf90adee2c37dChia-I Wu   /* the mutex protects only the condvar, not the struct */
1094b2495661f3a5ac8ed07b68c5d5bf90adee2c37dChia-I Wu   pipe_mutex mutex;
1104b2495661f3a5ac8ed07b68c5d5bf90adee2c37dChia-I Wu   pipe_condvar condvar;
111f945cb651518025159499999527ff5d4536acaf8Chia-I Wu
112f945cb651518025159499999527ff5d4536acaf8Chia-I Wu   /* for fence sync */
113f945cb651518025159499999527ff5d4536acaf8Chia-I Wu   struct pipe_fence_handle *fence;
1144b2495661f3a5ac8ed07b68c5d5bf90adee2c37dChia-I Wu};
1154b2495661f3a5ac8ed07b68c5d5bf90adee2c37dChia-I Wu_EGL_DRIVER_TYPECAST(egl_g3d_sync, _EGLSync, obj)
1164b2495661f3a5ac8ed07b68c5d5bf90adee2c37dChia-I Wu
1174b2495661f3a5ac8ed07b68c5d5bf90adee2c37dChia-I Wu#endif /* EGL_KHR_reusable_sync */
1184b2495661f3a5ac8ed07b68c5d5bf90adee2c37dChia-I Wu
1196c7e0b95a4a16d268aa3ca74c5c8407779533314Chia-I Wu#ifdef EGL_MESA_screen_surface
1206c7e0b95a4a16d268aa3ca74c5c8407779533314Chia-I Wu
1212dcdf19ee3a19fb41005d53f0dbc6e8a3970a8b6Chia-I Wustruct egl_g3d_screen {
1222dcdf19ee3a19fb41005d53f0dbc6e8a3970a8b6Chia-I Wu   _EGLScreen base;
1232dcdf19ee3a19fb41005d53f0dbc6e8a3970a8b6Chia-I Wu   const struct native_connector *native;
1242dcdf19ee3a19fb41005d53f0dbc6e8a3970a8b6Chia-I Wu   const struct native_mode **native_modes;
1252dcdf19ee3a19fb41005d53f0dbc6e8a3970a8b6Chia-I Wu};
1269a3de505dc5377a47a6ccb29fe60343feb2f5b14Chia-I Wu_EGL_DRIVER_TYPECAST(egl_g3d_screen, _EGLScreen, obj)
1276c7e0b95a4a16d268aa3ca74c5c8407779533314Chia-I Wu
1286c7e0b95a4a16d268aa3ca74c5c8407779533314Chia-I Wu#endif /* EGL_MESA_screen_surface */
1299373447a614e7b401919328b589b5f2607e456fdChia-I Wu
13049381d63e61c724b156b76068058df1c01a906c2Chia-I Wu#endif /* _EGL_G3D_H_ */
131