diff options
Diffstat (limited to 'src/gallium/include')
-rw-r--r-- | src/gallium/include/pipe/p_compiler.h | 7 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_defines.h | 5 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_format.h | 58 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_screen.h | 48 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_state.h | 20 | ||||
-rw-r--r-- | src/gallium/include/state_tracker/drm_api.h | 57 |
6 files changed, 88 insertions, 107 deletions
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h index c7d35074948..b93b38310ac 100644 --- a/src/gallium/include/pipe/p_compiler.h +++ b/src/gallium/include/pipe/p_compiler.h @@ -106,8 +106,7 @@ typedef unsigned char boolean; /* Function visibility */ #ifndef PUBLIC -# if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303) \ - || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) +# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define PUBLIC __attribute__((visibility("default"))) # else # define PUBLIC @@ -119,7 +118,7 @@ typedef unsigned char boolean; * If we're not using gcc, define __FUNCTION__ as a cpp symbol here. */ #ifndef __FUNCTION__ -# if (!defined(__GNUC__) || (__GNUC__ < 2)) +# if !defined(__GNUC__) # if (__STDC_VERSION__ >= 199901L) /* C99 */ || \ (defined(__SUNPRO_C) && defined(__C99FEATURES__)) # define __FUNCTION__ __func__ @@ -145,7 +144,7 @@ typedef unsigned char boolean; -#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) +#if defined(__GNUC__) #define PIPE_DEPRECATED __attribute__((__deprecated__)) #else #define PIPE_DEPRECATED diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 5cebd43ace2..5c97dc87e82 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -176,11 +176,12 @@ enum pipe_texture_target { #define PIPE_TEX_COMPARE_R_TO_TEXTURE 1 #define PIPE_TEXTURE_USAGE_RENDER_TARGET 0x1 -#define PIPE_TEXTURE_USAGE_DISPLAY_TARGET 0x2 /* ie a backbuffer */ -#define PIPE_TEXTURE_USAGE_PRIMARY 0x4 /* ie a frontbuffer */ +#define PIPE_TEXTURE_USAGE_DISPLAY_TARGET 0x2 /* windows presentable buffer, ie a backbuffer */ +#define PIPE_TEXTURE_USAGE_SCANOUT 0x4 /* ie a frontbuffer */ #define PIPE_TEXTURE_USAGE_DEPTH_STENCIL 0x8 #define PIPE_TEXTURE_USAGE_SAMPLER 0x10 #define PIPE_TEXTURE_USAGE_DYNAMIC 0x20 +#define PIPE_TEXTURE_USAGE_SHARED 0x40 /** Pipe driver custom usage flags should be greater or equal to this value */ #define PIPE_TEXTURE_USAGE_CUSTOM (1 << 16) diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index f33b0639ef9..cbf3273ec8d 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -45,28 +45,28 @@ extern "C" { enum pipe_format { PIPE_FORMAT_NONE = 0, - PIPE_FORMAT_A8R8G8B8_UNORM = 1, - PIPE_FORMAT_X8R8G8B8_UNORM = 2, - PIPE_FORMAT_B8G8R8A8_UNORM = 3, - PIPE_FORMAT_B8G8R8X8_UNORM = 4, - PIPE_FORMAT_A1R5G5B5_UNORM = 5, - PIPE_FORMAT_A4R4G4B4_UNORM = 6, - PIPE_FORMAT_R5G6B5_UNORM = 7, - PIPE_FORMAT_A2B10G10R10_UNORM = 8, + PIPE_FORMAT_B8G8R8A8_UNORM = 1, + PIPE_FORMAT_B8G8R8X8_UNORM = 2, + PIPE_FORMAT_A8R8G8B8_UNORM = 3, + PIPE_FORMAT_X8R8G8B8_UNORM = 4, + PIPE_FORMAT_B5G5R5A1_UNORM = 5, + PIPE_FORMAT_B4G4R4A4_UNORM = 6, + PIPE_FORMAT_B5G6R5_UNORM = 7, + PIPE_FORMAT_R10G10B10A2_UNORM = 8, PIPE_FORMAT_L8_UNORM = 9, /**< ubyte luminance */ PIPE_FORMAT_A8_UNORM = 10, /**< ubyte alpha */ PIPE_FORMAT_I8_UNORM = 11, /**< ubyte intensity */ - PIPE_FORMAT_A8L8_UNORM = 12, /**< ubyte alpha, luminance */ + PIPE_FORMAT_L8A8_UNORM = 12, /**< ubyte alpha, luminance */ PIPE_FORMAT_L16_UNORM = 13, /**< ushort luminance */ - PIPE_FORMAT_YCBCR = 14, - PIPE_FORMAT_YCBCR_REV = 15, + PIPE_FORMAT_UYVY = 14, + PIPE_FORMAT_YUYV = 15, PIPE_FORMAT_Z16_UNORM = 16, PIPE_FORMAT_Z32_UNORM = 17, PIPE_FORMAT_Z32_FLOAT = 18, - PIPE_FORMAT_S8Z24_UNORM = 19, - PIPE_FORMAT_Z24S8_UNORM = 20, - PIPE_FORMAT_X8Z24_UNORM = 21, - PIPE_FORMAT_Z24X8_UNORM = 22, + PIPE_FORMAT_Z24S8_UNORM = 19, + PIPE_FORMAT_S8Z24_UNORM = 20, + PIPE_FORMAT_Z24X8_UNORM = 21, + PIPE_FORMAT_X8Z24_UNORM = 22, PIPE_FORMAT_S8_UNORM = 23, /**< ubyte stencil */ PIPE_FORMAT_R64_FLOAT = 24, PIPE_FORMAT_R64G64_FLOAT = 25, @@ -112,43 +112,37 @@ enum pipe_format { PIPE_FORMAT_R8G8_UNORM = 65, PIPE_FORMAT_R8G8B8_UNORM = 66, PIPE_FORMAT_R8G8B8A8_UNORM = 67, - PIPE_FORMAT_R8G8B8X8_UNORM = 68, + PIPE_FORMAT_X8B8G8R8_UNORM = 68, PIPE_FORMAT_R8_USCALED = 69, PIPE_FORMAT_R8G8_USCALED = 70, PIPE_FORMAT_R8G8B8_USCALED = 71, PIPE_FORMAT_R8G8B8A8_USCALED = 72, - PIPE_FORMAT_R8G8B8X8_USCALED = 73, PIPE_FORMAT_R8_SNORM = 74, PIPE_FORMAT_R8G8_SNORM = 75, PIPE_FORMAT_R8G8B8_SNORM = 76, PIPE_FORMAT_R8G8B8A8_SNORM = 77, - PIPE_FORMAT_R8G8B8X8_SNORM = 78, - PIPE_FORMAT_B6G5R5_SNORM = 79, - PIPE_FORMAT_A8B8G8R8_SNORM = 80, - PIPE_FORMAT_X8B8G8R8_SNORM = 81, PIPE_FORMAT_R8_SSCALED = 82, PIPE_FORMAT_R8G8_SSCALED = 83, PIPE_FORMAT_R8G8B8_SSCALED = 84, PIPE_FORMAT_R8G8B8A8_SSCALED = 85, - PIPE_FORMAT_R8G8B8X8_SSCALED = 86, PIPE_FORMAT_R32_FIXED = 87, PIPE_FORMAT_R32G32_FIXED = 88, PIPE_FORMAT_R32G32B32_FIXED = 89, PIPE_FORMAT_R32G32B32A32_FIXED = 90, /* sRGB formats */ PIPE_FORMAT_L8_SRGB = 91, - PIPE_FORMAT_A8L8_SRGB = 92, + PIPE_FORMAT_L8A8_SRGB = 92, PIPE_FORMAT_R8G8B8_SRGB = 93, - PIPE_FORMAT_R8G8B8A8_SRGB = 94, - PIPE_FORMAT_R8G8B8X8_SRGB = 95, - PIPE_FORMAT_A8R8G8B8_SRGB = 96, - PIPE_FORMAT_X8R8G8B8_SRGB = 97, - PIPE_FORMAT_B8G8R8A8_SRGB = 98, - PIPE_FORMAT_B8G8R8X8_SRGB = 99, + PIPE_FORMAT_A8B8G8R8_SRGB = 94, + PIPE_FORMAT_X8B8G8R8_SRGB = 95, + PIPE_FORMAT_B8G8R8A8_SRGB = 96, + PIPE_FORMAT_B8G8R8X8_SRGB = 97, + PIPE_FORMAT_A8R8G8B8_SRGB = 98, + PIPE_FORMAT_X8R8G8B8_SRGB = 99, /* mixed formats */ - PIPE_FORMAT_X8UB8UG8SR8S_NORM = 100, - PIPE_FORMAT_B6UG5SR5S_NORM = 101, + PIPE_FORMAT_R8SG8SB8UX8U_NORM = 100, + PIPE_FORMAT_R5SG5SB6U_NORM = 101, /* compressed formats */ PIPE_FORMAT_DXT1_RGB = 102, @@ -162,6 +156,8 @@ enum pipe_format { PIPE_FORMAT_DXT3_SRGBA = 108, PIPE_FORMAT_DXT5_SRGBA = 109, + PIPE_FORMAT_A8B8G8R8_UNORM = 110, + PIPE_FORMAT_COUNT }; diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 48625bf3127..690455f7222 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -50,6 +50,8 @@ extern "C" { /** Opaque type */ +struct winsys_handle; +/** Opaque type */ struct pipe_fence_handle; struct pipe_winsys; struct pipe_buffer; @@ -108,20 +110,29 @@ struct pipe_screen { const struct pipe_texture *templat); /** - * Create a new texture object, using the given template info, but on top of - * existing memory. - * - * It is assumed that the buffer data is layed out according to the expected - * by the hardware. NULL will be returned if any inconsistency is found. + * Create a texture from a winsys_handle. The handle is often created in + * another process by first creating a pipe texture and then calling + * texture_get_handle. + */ + struct pipe_texture * (*texture_from_handle)(struct pipe_screen *, + const struct pipe_texture *templat, + struct winsys_handle *handle); + + /** + * Get a winsys_handle from a texture. Some platforms/winsys requires + * that the texture is created with a special usage flag like + * DISPLAYTARGET or PRIMARY. */ - struct pipe_texture * (*texture_blanket)(struct pipe_screen *, - const struct pipe_texture *templat, - const unsigned *stride, - struct pipe_buffer *buffer); + boolean (*texture_get_handle)(struct pipe_screen *, + struct pipe_texture *tex, + struct winsys_handle *handle); + void (*texture_destroy)(struct pipe_texture *pt); - /** Get a surface which is a "view" into a texture */ + /** Get a 2D surface which is a "view" into a texture + * \param usage bitmaks of PIPE_BUFFER_USAGE_* read/write flags + */ struct pipe_surface *(*get_tex_surface)(struct pipe_screen *, struct pipe_texture *texture, unsigned face, unsigned level, @@ -185,23 +196,6 @@ struct pipe_screen { void *ptr, unsigned bytes); - /** - * Allocate storage for a display target surface. - * - * Often surfaces which are meant to be blitted to the front screen (i.e., - * display targets) must be allocated with special characteristics, memory - * pools, or obtained directly from the windowing system. - * - * This callback is invoked by the pipe_screenwhen creating a texture marked - * with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET flag to get the underlying - * buffer storage. - */ - struct pipe_buffer *(*surface_buffer_create)(struct pipe_screen *screen, - unsigned width, unsigned height, - enum pipe_format format, - unsigned usage, - unsigned tex_usage, - unsigned *stride); /** diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 5670f7a0887..3a97d888ce6 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -114,16 +114,6 @@ struct pipe_rasterizer_state unsigned line_last_pixel:1; /** - * Vertex coordinates are pre-transformed to screen space. Skip - * the vertex shader, clipping and viewport processing. Note that - * a vertex shader is still needed though, to indicate the mapping - * from vertex elements to fragment shader input semantics. - * - * XXX: considered for removal. - */ - unsigned bypass_vs_clip_and_viewport:1; - - /** * Use the first vertex of a primitive as the provoking vertex for * flat shading. */ @@ -259,7 +249,7 @@ struct pipe_framebuffer_state { unsigned width, height; - /** multiple colorbuffers for multiple render targets */ + /** multiple color buffers for multiple render targets */ unsigned nr_cbufs; struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS]; @@ -295,12 +285,12 @@ struct pipe_sampler_state struct pipe_surface { struct pipe_reference reference; - enum pipe_format format; /**< PIPE_FORMAT_x */ + enum pipe_format format; unsigned width; /**< logical width in pixels */ unsigned height; /**< logical height in pixels */ unsigned layout; /**< PIPE_SURFACE_LAYOUT_x */ unsigned offset; /**< offset from start of buffer, in bytes */ - unsigned usage; /**< PIPE_BUFFER_USAGE_* */ + unsigned usage; /**< bitmask of PIPE_BUFFER_USAGE_x */ unsigned zslice; struct pipe_texture *texture; /**< texture into which this is a view */ @@ -346,7 +336,7 @@ struct pipe_texture unsigned nr_samples:8; /**< for multisampled surfaces, nr of samples */ - unsigned tex_usage; /* PIPE_TEXTURE_USAGE_* */ + unsigned tex_usage; /**< bitmask of PIPE_TEXTURE_USAGE_* */ struct pipe_screen *screen; /**< screen that this texture belongs to */ }; @@ -384,7 +374,7 @@ struct pipe_vertex_element */ unsigned vertex_buffer_index:8; - enum pipe_format src_format; /**< PIPE_FORMAT_* */ + enum pipe_format src_format; }; diff --git a/src/gallium/include/state_tracker/drm_api.h b/src/gallium/include/state_tracker/drm_api.h index e9fa9b4d2a3..fe7ef253ef0 100644 --- a/src/gallium/include/state_tracker/drm_api.h +++ b/src/gallium/include/state_tracker/drm_api.h @@ -17,6 +17,32 @@ enum drm_create_screen_mode { DRM_CREATE_MAX }; +#define DRM_API_HANDLE_TYPE_SHARED 0 +#define DRM_API_HANDLE_TYPE_KMS 1 + +/** + * For use with pipe_screen::{texture_from_handle|texture_get_handle}. + */ +struct winsys_handle +{ + /** + * Unused for texture_from_handle, always + * DRM_API_HANDLE_TYPE_SHARED. Input to texture_get_handle, + * use TEXTURE_USAGE to select handle for kms or ipc. + */ + unsigned type; + /** + * Input to texture_from_handle. + * Output for texture_get_handle. + */ + unsigned handle; + /** + * Input to texture_from_handle. + * Output for texture_get_handle. + */ + unsigned stride; +}; + /** * Modes other than DRM_CREATE_NORMAL derive from this struct. */ @@ -28,6 +54,8 @@ struct drm_create_screen_arg { struct drm_api { + void (*destroy)(struct drm_api *api); + const char *name; /** @@ -36,37 +64,10 @@ struct drm_api const char *driver_name; /** - * Special buffer functions + * Create a pipe srcreen. */ - /*@{*/ struct pipe_screen* (*create_screen)(struct drm_api *api, int drm_fd, struct drm_create_screen_arg *arg); - /*@}*/ - - /** - * Special buffer functions - */ - /*@{*/ - struct pipe_texture* - (*texture_from_shared_handle)(struct drm_api *api, - struct pipe_screen *screen, - struct pipe_texture *templ, - const char *name, - unsigned stride, - unsigned handle); - boolean (*shared_handle_from_texture)(struct drm_api *api, - struct pipe_screen *screen, - struct pipe_texture *texture, - unsigned *stride, - unsigned *handle); - boolean (*local_handle_from_texture)(struct drm_api *api, - struct pipe_screen *screen, - struct pipe_texture *texture, - unsigned *stride, - unsigned *handle); - /*@}*/ - - void (*destroy)(struct drm_api *api); }; extern struct drm_api * drm_api_create(void); |