135c4bbdfSmrg/*
235c4bbdfSmrg * Copyright © 2008 Intel Corporation
335c4bbdfSmrg *
435c4bbdfSmrg * Permission is hereby granted, free of charge, to any person obtaining a
535c4bbdfSmrg * copy of this software and associated documentation files (the "Software"),
635c4bbdfSmrg * to deal in the Software without restriction, including without limitation
735c4bbdfSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
835c4bbdfSmrg * and/or sell copies of the Software, and to permit persons to whom the
935c4bbdfSmrg * Software is furnished to do so, subject to the following conditions:
1035c4bbdfSmrg *
1135c4bbdfSmrg * The above copyright notice and this permission notice (including the next
1235c4bbdfSmrg * paragraph) shall be included in all copies or substantial portions of the
1335c4bbdfSmrg * Software.
1435c4bbdfSmrg *
1535c4bbdfSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1635c4bbdfSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1735c4bbdfSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1835c4bbdfSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1935c4bbdfSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2035c4bbdfSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2135c4bbdfSmrg * IN THE SOFTWARE.
2235c4bbdfSmrg *
2335c4bbdfSmrg * Authors:
2435c4bbdfSmrg *    Eric Anholt <eric@anholt.net>
2535c4bbdfSmrg *    Zhigang Gong <zhigang.gong@linux.intel.com>
2635c4bbdfSmrg *
2735c4bbdfSmrg */
2835c4bbdfSmrg
2935c4bbdfSmrg#ifndef GLAMOR_H
3035c4bbdfSmrg#define GLAMOR_H
3135c4bbdfSmrg
3235c4bbdfSmrg#include <scrnintstr.h>
3335c4bbdfSmrg#include <pixmapstr.h>
3435c4bbdfSmrg#include <gcstruct.h>
3535c4bbdfSmrg#include <picturestr.h>
3635c4bbdfSmrg#include <fb.h>
3735c4bbdfSmrg#include <fbpict.h>
3835c4bbdfSmrg#ifdef GLAMOR_FOR_XORG
3935c4bbdfSmrg#include <xf86xv.h>
4035c4bbdfSmrg#endif
4135c4bbdfSmrg
4235c4bbdfSmrgstruct glamor_context;
431b5d61b8Smrgstruct gbm_bo;
441b5d61b8Smrgstruct gbm_device;
4535c4bbdfSmrg
4635c4bbdfSmrg/*
4735c4bbdfSmrg * glamor_pixmap_type : glamor pixmap's type.
4835c4bbdfSmrg * @MEMORY: pixmap is in memory.
4935c4bbdfSmrg * @TEXTURE_DRM: pixmap is in a texture created from a DRM buffer.
5035c4bbdfSmrg * @SEPARATE_TEXTURE: The texture is created from a DRM buffer, but
5135c4bbdfSmrg * 		      the format is incompatible, so this type of pixmap
5235c4bbdfSmrg * 		      will never fallback to DDX layer.
5335c4bbdfSmrg * @DRM_ONLY: pixmap is in a external DRM buffer.
5435c4bbdfSmrg * @TEXTURE_ONLY: pixmap is in an internal texture.
5535c4bbdfSmrg */
5635c4bbdfSmrgtypedef enum glamor_pixmap_type {
5735c4bbdfSmrg    GLAMOR_MEMORY = 0, /* Newly calloc()ed pixmaps are memory. */
5835c4bbdfSmrg    GLAMOR_TEXTURE_DRM,
5935c4bbdfSmrg    GLAMOR_DRM_ONLY,
6035c4bbdfSmrg    GLAMOR_TEXTURE_ONLY,
6135c4bbdfSmrg} glamor_pixmap_type_t;
6235c4bbdfSmrg
631b5d61b8Smrgtypedef Bool (*GetDrawableModifiersFuncPtr) (DrawablePtr draw,
641b5d61b8Smrg                                             uint32_t format,
651b5d61b8Smrg                                             uint32_t *num_modifiers,
661b5d61b8Smrg                                             uint64_t **modifiers);
671b5d61b8Smrg
6835c4bbdfSmrg#define GLAMOR_EGL_EXTERNAL_BUFFER 3
6935c4bbdfSmrg#define GLAMOR_USE_EGL_SCREEN		(1 << 0)
7035c4bbdfSmrg#define GLAMOR_NO_DRI3			(1 << 1)
7135c4bbdfSmrg#define GLAMOR_VALID_FLAGS      (GLAMOR_USE_EGL_SCREEN                \
7235c4bbdfSmrg                                 | GLAMOR_NO_DRI3)
7335c4bbdfSmrg
7435c4bbdfSmrg/* until we need geometry shaders GL3.1 should suffice. */
7535c4bbdfSmrg#define GLAMOR_GL_CORE_VER_MAJOR 3
7635c4bbdfSmrg#define GLAMOR_GL_CORE_VER_MINOR 1
7735c4bbdfSmrg
7835c4bbdfSmrg/* @glamor_init: Initialize glamor internal data structure.
7935c4bbdfSmrg *
8035c4bbdfSmrg * @screen: Current screen pointer.
8135c4bbdfSmrg * @flags:  Please refer the flags description above.
8235c4bbdfSmrg *
8335c4bbdfSmrg * 	@GLAMOR_USE_EGL_SCREEN:
8435c4bbdfSmrg * 	If you are using EGL layer, then please set this bit
8535c4bbdfSmrg * 	on, otherwise, clear it.
8635c4bbdfSmrg *
8735c4bbdfSmrg *      @GLAMOR_NO_DRI3
8835c4bbdfSmrg *      Disable the built-in DRI3 support
8935c4bbdfSmrg *
9035c4bbdfSmrg * This function initializes necessary internal data structure
9135c4bbdfSmrg * for glamor. And before calling into this function, the OpenGL
9235c4bbdfSmrg * environment should be ready. Should be called before any real
9335c4bbdfSmrg * glamor rendering or texture allocation functions. And should
9435c4bbdfSmrg * be called after the DDX's screen initialization or at the last
9535c4bbdfSmrg * step of the DDX's screen initialization.
9635c4bbdfSmrg */
9735c4bbdfSmrgextern _X_EXPORT Bool glamor_init(ScreenPtr screen, unsigned int flags);
9835c4bbdfSmrgextern _X_EXPORT void glamor_fini(ScreenPtr screen);
9935c4bbdfSmrg
10035c4bbdfSmrg/* This function is used to free the glamor private screen's
10135c4bbdfSmrg * resources. If the DDX driver is not set GLAMOR_USE_SCREEN,
10235c4bbdfSmrg * then, DDX need to call this function at proper stage, if
10335c4bbdfSmrg * it is the xorg DDX driver,then it should be called at free
10435c4bbdfSmrg * screen stage not the close screen stage. The reason is after
10535c4bbdfSmrg * call to this function, the xorg DDX may need to destroy the
10635c4bbdfSmrg * screen pixmap which must be a glamor pixmap and requires
10735c4bbdfSmrg * the internal data structure still exist at that time.
10835c4bbdfSmrg * Otherwise, the glamor internal structure will not be freed.*/
10935c4bbdfSmrgextern _X_EXPORT Bool glamor_close_screen(ScreenPtr screen);
11035c4bbdfSmrg
11135c4bbdfSmrgextern _X_EXPORT uint32_t glamor_get_pixmap_texture(PixmapPtr pixmap);
11235c4bbdfSmrg
113ed6184dfSmrgextern _X_EXPORT Bool glamor_set_pixmap_texture(PixmapPtr pixmap,
11435c4bbdfSmrg                                                unsigned int tex);
11535c4bbdfSmrg
11635c4bbdfSmrgextern _X_EXPORT void glamor_set_pixmap_type(PixmapPtr pixmap,
11735c4bbdfSmrg                                             glamor_pixmap_type_t type);
1185a7dfde8Smrg
1195a7dfde8Smrgextern _X_EXPORT void glamor_clear_pixmap(PixmapPtr pixmap);
1205a7dfde8Smrg
12135c4bbdfSmrgextern _X_EXPORT void glamor_block_handler(ScreenPtr screen);
12235c4bbdfSmrg
12335c4bbdfSmrgextern _X_EXPORT PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h,
12435c4bbdfSmrg                                                int depth, unsigned int usage);
12535c4bbdfSmrgextern _X_EXPORT Bool glamor_destroy_pixmap(PixmapPtr pixmap);
12635c4bbdfSmrg
12735c4bbdfSmrg#define GLAMOR_CREATE_PIXMAP_CPU        0x100
12835c4bbdfSmrg#define GLAMOR_CREATE_PIXMAP_FIXUP      0x101
12935c4bbdfSmrg#define GLAMOR_CREATE_FBO_NO_FBO        0x103
13035c4bbdfSmrg#define GLAMOR_CREATE_NO_LARGE          0x105
13135c4bbdfSmrg#define GLAMOR_CREATE_PIXMAP_NO_TEXTURE 0x106
132ed6184dfSmrg#define GLAMOR_CREATE_FORMAT_CBCR       0x107
13335c4bbdfSmrg
13435c4bbdfSmrg/* @glamor_egl_exchange_buffers: Exchange the underlying buffers(KHR image,fbo).
13535c4bbdfSmrg *
13635c4bbdfSmrg * @front: front pixmap.
13735c4bbdfSmrg * @back: back pixmap.
13835c4bbdfSmrg *
13935c4bbdfSmrg * Used by the DRI2 page flip. This function will exchange the KHR images and
14035c4bbdfSmrg * fbos of the two pixmaps.
14135c4bbdfSmrg * */
14235c4bbdfSmrgextern _X_EXPORT void glamor_egl_exchange_buffers(PixmapPtr front,
14335c4bbdfSmrg                                                  PixmapPtr back);
14435c4bbdfSmrg
14535c4bbdfSmrgextern _X_EXPORT void glamor_pixmap_exchange_fbos(PixmapPtr front,
14635c4bbdfSmrg                                                  PixmapPtr back);
14735c4bbdfSmrg
1481b5d61b8Smrg/* The DDX is not supposed to call these four functions */
14935c4bbdfSmrgextern _X_EXPORT void glamor_enable_dri3(ScreenPtr screen);
1501b5d61b8Smrgextern _X_EXPORT int glamor_egl_fds_from_pixmap(ScreenPtr, PixmapPtr, int *,
1511b5d61b8Smrg                                                uint32_t *, uint32_t *,
1521b5d61b8Smrg                                                uint64_t *);
1531b5d61b8Smrgextern _X_EXPORT int glamor_egl_fd_name_from_pixmap(ScreenPtr, PixmapPtr,
1541b5d61b8Smrg                                                    CARD16 *, CARD32 *);
15535c4bbdfSmrg
1561b5d61b8Smrgextern _X_EXPORT struct gbm_device *glamor_egl_get_gbm_device(ScreenPtr screen);
1571b5d61b8Smrgextern _X_EXPORT int glamor_egl_fd_from_pixmap(ScreenPtr, PixmapPtr, CARD16 *, CARD32 *);
15835c4bbdfSmrg
15935c4bbdfSmrg/* @glamor_supports_pixmap_import_export: Returns whether
1601b5d61b8Smrg * glamor_fds_from_pixmap(), glamor_name_from_pixmap(), and
1611b5d61b8Smrg * glamor_pixmap_from_fds() are supported.
16235c4bbdfSmrg *
16335c4bbdfSmrg * @screen: Current screen pointer.
16435c4bbdfSmrg *
16535c4bbdfSmrg * To have DRI3 support enabled, glamor and glamor_egl need to be
16635c4bbdfSmrg * initialized. glamor also has to be compiled with gbm support.
16735c4bbdfSmrg *
16835c4bbdfSmrg * The EGL layer needs to have the following extensions working:
16935c4bbdfSmrg *
1701b5d61b8Smrg * .EGL_KHR_surfaceless_context
17135c4bbdfSmrg * */
17235c4bbdfSmrgextern _X_EXPORT Bool glamor_supports_pixmap_import_export(ScreenPtr screen);
17335c4bbdfSmrg
1741b5d61b8Smrg/* @glamor_fds_from_pixmap: Get a dma-buf fd from a pixmap.
1751b5d61b8Smrg *
1761b5d61b8Smrg * @screen: Current screen pointer.
1771b5d61b8Smrg * @pixmap: The pixmap from which we want the fd.
1781b5d61b8Smrg * @fds, @strides, @offsets: Pointers to fill info of each plane.
1791b5d61b8Smrg * @modifier: Pointer to fill the modifier of the buffer.
1801b5d61b8Smrg *
1811b5d61b8Smrg * the pixmap and the buffer associated by the fds will share the same
1821b5d61b8Smrg * content. The caller is responsible to close the returned file descriptors.
1831b5d61b8Smrg * Returns the number of planes, -1 on error.
1841b5d61b8Smrg * */
1851b5d61b8Smrgextern _X_EXPORT int glamor_fds_from_pixmap(ScreenPtr screen,
1861b5d61b8Smrg                                            PixmapPtr pixmap,
1871b5d61b8Smrg                                            int *fds,
1881b5d61b8Smrg                                            uint32_t *strides, uint32_t *offsets,
1891b5d61b8Smrg                                            uint64_t *modifier);
1901b5d61b8Smrg
19135c4bbdfSmrg/* @glamor_fd_from_pixmap: Get a dma-buf fd from a pixmap.
19235c4bbdfSmrg *
19335c4bbdfSmrg * @screen: Current screen pointer.
19435c4bbdfSmrg * @pixmap: The pixmap from which we want the fd.
19535c4bbdfSmrg * @stride, @size: Pointers to fill the stride and size of the
19635c4bbdfSmrg * 		   buffer associated to the fd.
19735c4bbdfSmrg *
19835c4bbdfSmrg * the pixmap and the buffer associated by the fd will share the same
19935c4bbdfSmrg * content.
20035c4bbdfSmrg * Returns the fd on success, -1 on error.
20135c4bbdfSmrg * */
20235c4bbdfSmrgextern _X_EXPORT int glamor_fd_from_pixmap(ScreenPtr screen,
20335c4bbdfSmrg                                           PixmapPtr pixmap,
20435c4bbdfSmrg                                           CARD16 *stride, CARD32 *size);
20535c4bbdfSmrg
2061b5d61b8Smrg/* @glamor_shareable_fd_from_pixmap: Get a dma-buf fd suitable for sharing
2071b5d61b8Smrg *				     with other GPUs from a pixmap.
2081b5d61b8Smrg *
2091b5d61b8Smrg * @screen: Current screen pointer.
2101b5d61b8Smrg * @pixmap: The pixmap from which we want the fd.
2111b5d61b8Smrg * @stride, @size: Pointers to fill the stride and size of the
2121b5d61b8Smrg * 		   buffer associated to the fd.
2131b5d61b8Smrg *
2141b5d61b8Smrg * The returned fd will point to a buffer which is suitable for sharing
2151b5d61b8Smrg * across GPUs (not using GPU specific tiling).
2161b5d61b8Smrg * The pixmap and the buffer associated by the fd will share the same
2171b5d61b8Smrg * content.
2181b5d61b8Smrg * The pixmap's stride may be modified by this function.
2191b5d61b8Smrg * Returns the fd on success, -1 on error.
2201b5d61b8Smrg * */
2211b5d61b8Smrgextern _X_EXPORT int glamor_shareable_fd_from_pixmap(ScreenPtr screen,
2221b5d61b8Smrg                                                     PixmapPtr pixmap,
2231b5d61b8Smrg                                                     CARD16 *stride,
2241b5d61b8Smrg                                                     CARD32 *size);
2251b5d61b8Smrg
22635c4bbdfSmrg/**
22735c4bbdfSmrg * @glamor_name_from_pixmap: Gets a gem name from a pixmap.
22835c4bbdfSmrg *
22935c4bbdfSmrg * @pixmap: The pixmap from which we want the gem name.
23035c4bbdfSmrg *
23135c4bbdfSmrg * the pixmap and the buffer associated by the gem name will share the
23235c4bbdfSmrg * same content. This function can be used by the DDX to support DRI2,
23335c4bbdfSmrg * and needs the same set of buffer export GL extensions as DRI3
23435c4bbdfSmrg * support.
23535c4bbdfSmrg *
23635c4bbdfSmrg * Returns the name on success, -1 on error.
23735c4bbdfSmrg * */
23835c4bbdfSmrgextern _X_EXPORT int glamor_name_from_pixmap(PixmapPtr pixmap,
23935c4bbdfSmrg                                             CARD16 *stride, CARD32 *size);
24035c4bbdfSmrg
24135c4bbdfSmrg/* @glamor_gbm_bo_from_pixmap: Get a GBM bo from a pixmap.
24235c4bbdfSmrg *
24335c4bbdfSmrg * @screen: Current screen pointer.
24435c4bbdfSmrg * @pixmap: The pixmap from which we want the fd.
24535c4bbdfSmrg * @stride, @size: Pointers to fill the stride and size of the
24635c4bbdfSmrg * 		   buffer associated to the fd.
24735c4bbdfSmrg *
24835c4bbdfSmrg * the pixmap and the buffer represented by the gbm_bo will share the same
24935c4bbdfSmrg * content.
25035c4bbdfSmrg *
25135c4bbdfSmrg * Returns the gbm_bo on success, NULL on error.
25235c4bbdfSmrg * */
2531b5d61b8Smrgextern _X_EXPORT struct gbm_bo *glamor_gbm_bo_from_pixmap(ScreenPtr screen,
2541b5d61b8Smrg                                                          PixmapPtr pixmap);
2551b5d61b8Smrg
2561b5d61b8Smrg/* @glamor_pixmap_from_fds: Creates a pixmap to wrap a dma-buf fds.
2571b5d61b8Smrg *
2581b5d61b8Smrg * @screen: Current screen pointer.
2591b5d61b8Smrg * @num_fds: Number of fds to import
2601b5d61b8Smrg * @fds: The dma-buf fds to import.
2611b5d61b8Smrg * @width: The width of the buffers.
2621b5d61b8Smrg * @height: The height of the buffers.
2631b5d61b8Smrg * @stride: The stride of the buffers.
2641b5d61b8Smrg * @depth: The depth of the buffers.
2651b5d61b8Smrg * @bpp: The bpp of the buffers.
2661b5d61b8Smrg * @modifier: The modifier of the buffers.
2671b5d61b8Smrg *
2681b5d61b8Smrg * Returns a valid pixmap if the import succeeded, else NULL.
2691b5d61b8Smrg * */
2701b5d61b8Smrgextern _X_EXPORT PixmapPtr glamor_pixmap_from_fds(ScreenPtr screen,
2711b5d61b8Smrg                                                  CARD8 num_fds,
2721b5d61b8Smrg                                                  const int *fds,
2731b5d61b8Smrg                                                  CARD16 width,
2741b5d61b8Smrg                                                  CARD16 height,
2751b5d61b8Smrg                                                  const CARD32 *strides,
2761b5d61b8Smrg                                                  const CARD32 *offsets,
2771b5d61b8Smrg                                                  CARD8 depth,
2781b5d61b8Smrg                                                  CARD8 bpp,
2791b5d61b8Smrg                                                  uint64_t modifier);
28035c4bbdfSmrg
28135c4bbdfSmrg/* @glamor_pixmap_from_fd: Creates a pixmap to wrap a dma-buf fd.
28235c4bbdfSmrg *
28335c4bbdfSmrg * @screen: Current screen pointer.
28435c4bbdfSmrg * @fd: The dma-buf fd to import.
28535c4bbdfSmrg * @width: The width of the buffer.
28635c4bbdfSmrg * @height: The height of the buffer.
28735c4bbdfSmrg * @stride: The stride of the buffer.
28835c4bbdfSmrg * @depth: The depth of the buffer.
2891b5d61b8Smrg * @bpp: The bpp of the buffer.
29035c4bbdfSmrg *
29135c4bbdfSmrg * Returns a valid pixmap if the import succeeded, else NULL.
29235c4bbdfSmrg * */
29335c4bbdfSmrgextern _X_EXPORT PixmapPtr glamor_pixmap_from_fd(ScreenPtr screen,
29435c4bbdfSmrg                                                 int fd,
29535c4bbdfSmrg                                                 CARD16 width,
29635c4bbdfSmrg                                                 CARD16 height,
29735c4bbdfSmrg                                                 CARD16 stride,
29835c4bbdfSmrg                                                 CARD8 depth,
29935c4bbdfSmrg                                                 CARD8 bpp);
30035c4bbdfSmrg
30135c4bbdfSmrg/* @glamor_back_pixmap_from_fd: Backs an existing pixmap with a dma-buf fd.
30235c4bbdfSmrg *
30335c4bbdfSmrg * @pixmap: Pixmap to change backing for
30435c4bbdfSmrg * @fd: The dma-buf fd to import.
30535c4bbdfSmrg * @width: The width of the buffer.
30635c4bbdfSmrg * @height: The height of the buffer.
30735c4bbdfSmrg * @stride: The stride of the buffer.
30835c4bbdfSmrg * @depth: The depth of the buffer.
30935c4bbdfSmrg * @bpp: The number of bpp of the buffer.
31035c4bbdfSmrg *
31135c4bbdfSmrg * Returns TRUE if successful, FALSE on failure.
31235c4bbdfSmrg * */
31335c4bbdfSmrgextern _X_EXPORT Bool glamor_back_pixmap_from_fd(PixmapPtr pixmap,
31435c4bbdfSmrg                                                 int fd,
31535c4bbdfSmrg                                                 CARD16 width,
31635c4bbdfSmrg                                                 CARD16 height,
31735c4bbdfSmrg                                                 CARD16 stride,
31835c4bbdfSmrg                                                 CARD8 depth,
31935c4bbdfSmrg                                                 CARD8 bpp);
3201b5d61b8Smrg
3211b5d61b8Smrgextern _X_EXPORT Bool glamor_get_formats(ScreenPtr screen,
3221b5d61b8Smrg                                         CARD32 *num_formats,
3231b5d61b8Smrg                                         CARD32 **formats);
3241b5d61b8Smrg
3251b5d61b8Smrgextern _X_EXPORT Bool glamor_get_modifiers(ScreenPtr screen,
3261b5d61b8Smrg                                           uint32_t format,
3271b5d61b8Smrg                                           uint32_t *num_modifiers,
3281b5d61b8Smrg                                           uint64_t **modifiers);
3291b5d61b8Smrg
3301b5d61b8Smrgextern _X_EXPORT Bool glamor_get_drawable_modifiers(DrawablePtr draw,
3311b5d61b8Smrg                                                    uint32_t format,
3321b5d61b8Smrg                                                    uint32_t *num_modifiers,
3331b5d61b8Smrg                                                    uint64_t **modifiers);
3341b5d61b8Smrg
3351b5d61b8Smrgextern _X_EXPORT void glamor_set_drawable_modifiers_func(ScreenPtr screen,
3361b5d61b8Smrg                                                         GetDrawableModifiersFuncPtr func);
3371b5d61b8Smrg
33835c4bbdfSmrg#ifdef GLAMOR_FOR_XORG
33935c4bbdfSmrg
34035c4bbdfSmrg#define GLAMOR_EGL_MODULE_NAME  "glamoregl"
34135c4bbdfSmrg
34235c4bbdfSmrg/* @glamor_egl_init: Initialize EGL environment.
34335c4bbdfSmrg *
34435c4bbdfSmrg * @scrn: Current screen info pointer.
34535c4bbdfSmrg * @fd:   Current drm fd.
34635c4bbdfSmrg *
347ed6184dfSmrg * This function creates and initializes EGL contexts.
34835c4bbdfSmrg * Should be called from DDX's preInit function.
34935c4bbdfSmrg * Return TRUE if success, otherwise return FALSE.
35035c4bbdfSmrg * */
35135c4bbdfSmrgextern _X_EXPORT Bool glamor_egl_init(ScrnInfoPtr scrn, int fd);
35235c4bbdfSmrg
35335c4bbdfSmrgextern _X_EXPORT Bool glamor_egl_init_textured_pixmap(ScreenPtr screen);
35435c4bbdfSmrg
35535c4bbdfSmrg/* @glamor_egl_create_textured_screen: Create textured screen pixmap.
35635c4bbdfSmrg *
35735c4bbdfSmrg * @screen: screen pointer to be processed.
35835c4bbdfSmrg * @handle: screen pixmap's BO handle.
35935c4bbdfSmrg * @stride: screen pixmap's stride in bytes.
36035c4bbdfSmrg *
36135c4bbdfSmrg * This function is similar with the create_textured_pixmap. As the
36235c4bbdfSmrg * screen pixmap is a special, we handle it separately in this function.
36335c4bbdfSmrg */
36435c4bbdfSmrgextern _X_EXPORT Bool glamor_egl_create_textured_screen(ScreenPtr screen,
36535c4bbdfSmrg                                                        int handle, int stride);
36635c4bbdfSmrg
3671b5d61b8Smrg/* Obsolete entrypoint, temporarily left here for API compatibility
3681b5d61b8Smrg * for xf86-video-ati.
36935c4bbdfSmrg */
3701b5d61b8Smrg#define glamor_egl_create_textured_screen_ext(a, b, c, d) \
3711b5d61b8Smrg    glamor_egl_create_textured_screen(a, b, c)
37235c4bbdfSmrg
37335c4bbdfSmrg/*
37435c4bbdfSmrg * @glamor_egl_create_textured_pixmap: Try to create a textured pixmap from
37535c4bbdfSmrg * 				       a BO handle.
37635c4bbdfSmrg *
37735c4bbdfSmrg * @pixmap: The pixmap need to be processed.
37835c4bbdfSmrg * @handle: The BO's handle attached to this pixmap at DDX layer.
37935c4bbdfSmrg * @stride: Stride in bytes for this pixmap.
38035c4bbdfSmrg *
38135c4bbdfSmrg * This function try to create a texture from the handle and attach
38235c4bbdfSmrg * the texture to the pixmap , thus glamor can render to this pixmap
38335c4bbdfSmrg * as well. Return true if successful, otherwise return FALSE.
38435c4bbdfSmrg */
38535c4bbdfSmrgextern _X_EXPORT Bool glamor_egl_create_textured_pixmap(PixmapPtr pixmap,
38635c4bbdfSmrg                                                        int handle, int stride);
38735c4bbdfSmrg
38835c4bbdfSmrg/*
38935c4bbdfSmrg * @glamor_egl_create_textured_pixmap_from_bo: Try to create a textured pixmap
39035c4bbdfSmrg * 					       from a gbm_bo.
39135c4bbdfSmrg *
39235c4bbdfSmrg * @pixmap: The pixmap need to be processed.
39335c4bbdfSmrg * @bo: a pointer on a gbm_bo structure attached to this pixmap at DDX layer.
39435c4bbdfSmrg *
39535c4bbdfSmrg * This function is similar to glamor_egl_create_textured_pixmap.
39635c4bbdfSmrg */
39735c4bbdfSmrgextern _X_EXPORT Bool
3981b5d61b8Smrg glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap,
3991b5d61b8Smrg                                               struct gbm_bo *bo,
4001b5d61b8Smrg                                               Bool used_modifiers);
40135c4bbdfSmrg
4025a7dfde8Smrgextern _X_EXPORT const char *glamor_egl_get_driver_name(ScreenPtr screen);
4035a7dfde8Smrg
40435c4bbdfSmrg#endif
40535c4bbdfSmrg
40635c4bbdfSmrgextern _X_EXPORT void glamor_egl_screen_init(ScreenPtr screen,
40735c4bbdfSmrg                                             struct glamor_context *glamor_ctx);
40835c4bbdfSmrg
40935c4bbdfSmrgextern _X_EXPORT int glamor_create_gc(GCPtr gc);
41035c4bbdfSmrg
41135c4bbdfSmrgextern _X_EXPORT void glamor_validate_gc(GCPtr gc, unsigned long changes,
41235c4bbdfSmrg                                         DrawablePtr drawable);
41335c4bbdfSmrg
41435c4bbdfSmrgextern _X_EXPORT void glamor_destroy_gc(GCPtr gc);
41535c4bbdfSmrg
41635c4bbdfSmrg#define HAS_GLAMOR_DESTROY_GC 1
41735c4bbdfSmrg
41835c4bbdfSmrgextern Bool _X_EXPORT glamor_change_window_attributes(WindowPtr pWin, unsigned long mask);
41935c4bbdfSmrgextern void _X_EXPORT glamor_copy_window(WindowPtr window, DDXPointRec old_origin, RegionPtr src_region);
42035c4bbdfSmrg
42135c4bbdfSmrgextern _X_EXPORT void glamor_finish(ScreenPtr screen);
42235c4bbdfSmrg#define HAS_GLAMOR_TEXT 1
42335c4bbdfSmrg
42435c4bbdfSmrg#ifdef GLAMOR_FOR_XORG
42535c4bbdfSmrgextern _X_EXPORT XF86VideoAdaptorPtr glamor_xv_init(ScreenPtr pScreen,
42635c4bbdfSmrg                                                    int num_texture_ports);
42735c4bbdfSmrg#endif
42835c4bbdfSmrg
42935c4bbdfSmrg#endif                          /* GLAMOR_H */
430