···30 description = "Allows testing the fonts available in an X server";
31 license = "free";
32 maintainers = with stdenv.lib.maintainers; [viric];
33- platforms = with stdenv.lib.platforms; linux;
34 };
35}
···30 description = "Allows testing the fonts available in an X server";
31 license = "free";
32 maintainers = with stdenv.lib.maintainers; [viric];
33+ platforms = with stdenv.lib.platforms; linux ++ darwin;
34 };
35}
+1-1
pkgs/applications/misc/xlsfonts/default.nix
···18 description = "Lists the fonts available in the X server";
19 license = "free";
20 maintainers = with stdenv.lib.maintainers; [viric];
21- platforms = with stdenv.lib.platforms; linux;
22 };
23}
···18 description = "Lists the fonts available in the X server";
19 license = "free";
20 maintainers = with stdenv.lib.maintainers; [viric];
21+ platforms = with stdenv.lib.platforms; linux ++ darwin;
22 };
23}
···1+/*
2+ * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
3+ * Copyright 2007-2008 Red Hat, Inc.
4+ * (C) Copyright IBM Corporation 2004
5+ * All Rights Reserved.
6+ *
7+ * Permission is hereby granted, free of charge, to any person obtaining a
8+ * copy of this software and associated documentation files (the "Software"),
9+ * to deal in the Software without restriction, including without limitation
10+ * on the rights to use, copy, modify, merge, publish, distribute, sub
11+ * license, and/or sell copies of the Software, and to permit persons to whom
12+ * the Software is furnished to do so, subject to the following conditions:
13+ *
14+ * The above copyright notice and this permission notice (including the next
15+ * paragraph) shall be included in all copies or substantial portions of the
16+ * Software.
17+ *
18+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21+ * THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
22+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
25+ */
26+27+/**
28+ * \file dri_interface.h
29+ *
30+ * This file contains all the types and functions that define the interface
31+ * between a DRI driver and driver loader. Currently, the most common driver
32+ * loader is the XFree86 libGL.so. However, other loaders do exist, and in
33+ * the future the server-side libglx.a will also be a loader.
34+ *
35+ * \author Kevin E. Martin <kevin@precisioninsight.com>
36+ * \author Ian Romanick <idr@us.ibm.com>
37+ * \author Kristian Høgsberg <krh@redhat.com>
38+ */
39+40+#ifndef DRI_INTERFACE_H
41+#define DRI_INTERFACE_H
42+43+/* For archs with no drm.h */
44+#if defined(__APPLE__) || defined(__CYGWIN__) || defined(__GNU__)
45+#ifndef __NOT_HAVE_DRM_H
46+#define __NOT_HAVE_DRM_H
47+#endif
48+#endif
49+50+#ifndef __NOT_HAVE_DRM_H
51+#include <drm.h>
52+#else
53+typedef unsigned int drm_context_t;
54+typedef unsigned int drm_drawable_t;
55+typedef struct drm_clip_rect drm_clip_rect_t;
56+#endif
57+58+/**
59+ * \name DRI interface structures
60+ *
61+ * The following structures define the interface between the GLX client
62+ * side library and the DRI (direct rendering infrastructure).
63+ */
64+/*@{*/
65+typedef struct __DRIdisplayRec __DRIdisplay;
66+typedef struct __DRIscreenRec __DRIscreen;
67+typedef struct __DRIcontextRec __DRIcontext;
68+typedef struct __DRIdrawableRec __DRIdrawable;
69+typedef struct __DRIconfigRec __DRIconfig;
70+typedef struct __DRIframebufferRec __DRIframebuffer;
71+typedef struct __DRIversionRec __DRIversion;
72+73+typedef struct __DRIcoreExtensionRec __DRIcoreExtension;
74+typedef struct __DRIextensionRec __DRIextension;
75+typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension;
76+typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension;
77+typedef struct __DRIframeTrackingExtensionRec __DRIframeTrackingExtension;
78+typedef struct __DRImediaStreamCounterExtensionRec __DRImediaStreamCounterExtension;
79+typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension;
80+typedef struct __DRItexBufferExtensionRec __DRItexBufferExtension;
81+typedef struct __DRIlegacyExtensionRec __DRIlegacyExtension;
82+typedef struct __DRIswrastExtensionRec __DRIswrastExtension;
83+typedef struct __DRIbufferRec __DRIbuffer;
84+typedef struct __DRIdri2ExtensionRec __DRIdri2Extension;
85+typedef struct __DRIdri2LoaderExtensionRec __DRIdri2LoaderExtension;
86+typedef struct __DRI2flushExtensionRec __DRI2flushExtension;
87+typedef struct __DRI2throttleExtensionRec __DRI2throttleExtension;
88+89+90+typedef struct __DRIimageLoaderExtensionRec __DRIimageLoaderExtension;
91+typedef struct __DRIimageDriverExtensionRec __DRIimageDriverExtension;
92+93+/*@}*/
94+95+96+/**
97+ * Extension struct. Drivers 'inherit' from this struct by embedding
98+ * it as the first element in the extension struct.
99+ *
100+ * We never break API in for a DRI extension. If we need to change
101+ * the way things work in a non-backwards compatible manner, we
102+ * introduce a new extension. During a transition period, we can
103+ * leave both the old and the new extension in the driver, which
104+ * allows us to move to the new interface without having to update the
105+ * loader(s) in lock step.
106+ *
107+ * However, we can add entry points to an extension over time as long
108+ * as we don't break the old ones. As we add entry points to an
109+ * extension, we increase the version number. The corresponding
110+ * #define can be used to guard code that accesses the new entry
111+ * points at compile time and the version field in the extension
112+ * struct can be used at run-time to determine how to use the
113+ * extension.
114+ */
115+struct __DRIextensionRec {
116+ const char *name;
117+ int version;
118+};
119+120+/**
121+ * The first set of extension are the screen extensions, returned by
122+ * __DRIcore::getExtensions(). This entry point will return a list of
123+ * extensions and the loader can use the ones it knows about by
124+ * casting them to more specific extensions and advertising any GLX
125+ * extensions the DRI extensions enables.
126+ */
127+128+/**
129+ * Used by drivers to indicate support for setting the read drawable.
130+ */
131+#define __DRI_READ_DRAWABLE "DRI_ReadDrawable"
132+#define __DRI_READ_DRAWABLE_VERSION 1
133+134+/**
135+ * Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
136+ */
137+#define __DRI_COPY_SUB_BUFFER "DRI_CopySubBuffer"
138+#define __DRI_COPY_SUB_BUFFER_VERSION 1
139+struct __DRIcopySubBufferExtensionRec {
140+ __DRIextension base;
141+ void (*copySubBuffer)(__DRIdrawable *drawable, int x, int y, int w, int h);
142+};
143+144+/**
145+ * Used by drivers that implement the GLX_SGI_swap_control or
146+ * GLX_MESA_swap_control extension.
147+ */
148+#define __DRI_SWAP_CONTROL "DRI_SwapControl"
149+#define __DRI_SWAP_CONTROL_VERSION 1
150+struct __DRIswapControlExtensionRec {
151+ __DRIextension base;
152+ void (*setSwapInterval)(__DRIdrawable *drawable, unsigned int inteval);
153+ unsigned int (*getSwapInterval)(__DRIdrawable *drawable);
154+};
155+156+/**
157+ * Used by drivers that implement the GLX_MESA_swap_frame_usage extension.
158+ */
159+#define __DRI_FRAME_TRACKING "DRI_FrameTracking"
160+#define __DRI_FRAME_TRACKING_VERSION 1
161+struct __DRIframeTrackingExtensionRec {
162+ __DRIextension base;
163+164+ /**
165+ * Enable or disable frame usage tracking.
166+ *
167+ * \since Internal API version 20030317.
168+ */
169+ int (*frameTracking)(__DRIdrawable *drawable, GLboolean enable);
170+171+ /**
172+ * Retrieve frame usage information.
173+ *
174+ * \since Internal API version 20030317.
175+ */
176+ int (*queryFrameTracking)(__DRIdrawable *drawable,
177+ int64_t * sbc, int64_t * missedFrames,
178+ float * lastMissedUsage, float * usage);
179+};
180+181+182+/**
183+ * Used by drivers that implement the GLX_SGI_video_sync extension.
184+ */
185+#define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter"
186+#define __DRI_MEDIA_STREAM_COUNTER_VERSION 1
187+struct __DRImediaStreamCounterExtensionRec {
188+ __DRIextension base;
189+190+ /**
191+ * Wait for the MSC to equal target_msc, or, if that has already passed,
192+ * the next time (MSC % divisor) is equal to remainder. If divisor is
193+ * zero, the function will return as soon as MSC is greater than or equal
194+ * to target_msc.
195+ */
196+ int (*waitForMSC)(__DRIdrawable *drawable,
197+ int64_t target_msc, int64_t divisor, int64_t remainder,
198+ int64_t * msc, int64_t * sbc);
199+200+ /**
201+ * Get the number of vertical refreshes since some point in time before
202+ * this function was first called (i.e., system start up).
203+ */
204+ int (*getDrawableMSC)(__DRIscreen *screen, __DRIdrawable *drawable,
205+ int64_t *msc);
206+};
207+208+209+#define __DRI_TEX_OFFSET "DRI_TexOffset"
210+#define __DRI_TEX_OFFSET_VERSION 1
211+struct __DRItexOffsetExtensionRec {
212+ __DRIextension base;
213+214+ /**
215+ * Method to override base texture image with a driver specific 'offset'.
216+ * The depth passed in allows e.g. to ignore the alpha channel of texture
217+ * images where the non-alpha components don't occupy a whole texel.
218+ *
219+ * For GLX_EXT_texture_from_pixmap with AIGLX.
220+ */
221+ void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
222+ unsigned long long offset, GLint depth, GLuint pitch);
223+};
224+225+226+/* Valid values for format in the setTexBuffer2 function below. These
227+ * values match the GLX tokens for compatibility reasons, but we
228+ * define them here since the DRI interface can't depend on GLX. */
229+#define __DRI_TEXTURE_FORMAT_NONE 0x20D8
230+#define __DRI_TEXTURE_FORMAT_RGB 0x20D9
231+#define __DRI_TEXTURE_FORMAT_RGBA 0x20DA
232+233+#define __DRI_TEX_BUFFER "DRI_TexBuffer"
234+#define __DRI_TEX_BUFFER_VERSION 2
235+struct __DRItexBufferExtensionRec {
236+ __DRIextension base;
237+238+ /**
239+ * Method to override base texture image with the contents of a
240+ * __DRIdrawable.
241+ *
242+ * For GLX_EXT_texture_from_pixmap with AIGLX. Deprecated in favor of
243+ * setTexBuffer2 in version 2 of this interface
244+ */
245+ void (*setTexBuffer)(__DRIcontext *pDRICtx,
246+ GLint target,
247+ __DRIdrawable *pDraw);
248+249+ /**
250+ * Method to override base texture image with the contents of a
251+ * __DRIdrawable, including the required texture format attribute.
252+ *
253+ * For GLX_EXT_texture_from_pixmap with AIGLX.
254+ */
255+ void (*setTexBuffer2)(__DRIcontext *pDRICtx,
256+ GLint target,
257+ GLint format,
258+ __DRIdrawable *pDraw);
259+ /**
260+ * Method to release texture buffer in case some special platform
261+ * need this.
262+ *
263+ * For GLX_EXT_texture_from_pixmap with AIGLX.
264+ */
265+ void (*releaseTexBuffer)(__DRIcontext *pDRICtx,
266+ GLint target,
267+ __DRIdrawable *pDraw);
268+};
269+270+/**
271+ * Used by drivers that implement DRI2
272+ */
273+#define __DRI2_FLUSH "DRI2_Flush"
274+#define __DRI2_FLUSH_VERSION 4
275+276+#define __DRI2_FLUSH_DRAWABLE (1 << 0) /* the drawable should be flushed. */
277+#define __DRI2_FLUSH_CONTEXT (1 << 1) /* glFlush should be called */
278+279+enum __DRI2throttleReason {
280+ __DRI2_THROTTLE_SWAPBUFFER,
281+ __DRI2_THROTTLE_COPYSUBBUFFER,
282+ __DRI2_THROTTLE_FLUSHFRONT
283+};
284+285+struct __DRI2flushExtensionRec {
286+ __DRIextension base;
287+ void (*flush)(__DRIdrawable *drawable);
288+289+ /**
290+ * Ask the driver to call getBuffers/getBuffersWithFormat before
291+ * it starts rendering again.
292+ *
293+ * \param drawable the drawable to invalidate
294+ *
295+ * \since 3
296+ */
297+ void (*invalidate)(__DRIdrawable *drawable);
298+299+ /**
300+ * This function reduces the number of flushes in the driver by combining
301+ * several operations into one call.
302+ *
303+ * It can:
304+ * - throttle
305+ * - flush a drawable
306+ * - flush a context
307+ *
308+ * \param context the context
309+ * \param drawable the drawable to flush
310+ * \param flags a combination of _DRI2_FLUSH_xxx flags
311+ * \param throttle_reason the reason for throttling, 0 = no throttling
312+ *
313+ * \since 4
314+ */
315+ void (*flush_with_flags)(__DRIcontext *ctx,
316+ __DRIdrawable *drawable,
317+ unsigned flags,
318+ enum __DRI2throttleReason throttle_reason);
319+};
320+321+322+/**
323+ * Extension that the driver uses to request
324+ * throttle callbacks.
325+ */
326+327+#define __DRI2_THROTTLE "DRI2_Throttle"
328+#define __DRI2_THROTTLE_VERSION 1
329+330+struct __DRI2throttleExtensionRec {
331+ __DRIextension base;
332+ void (*throttle)(__DRIcontext *ctx,
333+ __DRIdrawable *drawable,
334+ enum __DRI2throttleReason reason);
335+};
336+337+/*@}*/
338+339+/**
340+ * The following extensions describe loader features that the DRI
341+ * driver can make use of. Some of these are mandatory, such as the
342+ * getDrawableInfo extension for DRI and the DRI Loader extensions for
343+ * DRI2, while others are optional, and if present allow the driver to
344+ * expose certain features. The loader pass in a NULL terminated
345+ * array of these extensions to the driver in the createNewScreen
346+ * constructor.
347+ */
348+349+typedef struct __DRIgetDrawableInfoExtensionRec __DRIgetDrawableInfoExtension;
350+typedef struct __DRIsystemTimeExtensionRec __DRIsystemTimeExtension;
351+typedef struct __DRIdamageExtensionRec __DRIdamageExtension;
352+typedef struct __DRIloaderExtensionRec __DRIloaderExtension;
353+typedef struct __DRIswrastLoaderExtensionRec __DRIswrastLoaderExtension;
354+355+356+/**
357+ * Callback to getDrawableInfo protocol
358+ */
359+#define __DRI_GET_DRAWABLE_INFO "DRI_GetDrawableInfo"
360+#define __DRI_GET_DRAWABLE_INFO_VERSION 1
361+struct __DRIgetDrawableInfoExtensionRec {
362+ __DRIextension base;
363+364+ /**
365+ * This function is used to get information about the position, size, and
366+ * clip rects of a drawable.
367+ */
368+ GLboolean (* getDrawableInfo) ( __DRIdrawable *drawable,
369+ unsigned int * index, unsigned int * stamp,
370+ int * x, int * y, int * width, int * height,
371+ int * numClipRects, drm_clip_rect_t ** pClipRects,
372+ int * backX, int * backY,
373+ int * numBackClipRects, drm_clip_rect_t ** pBackClipRects,
374+ void *loaderPrivate);
375+};
376+377+/**
378+ * Callback to get system time for media stream counter extensions.
379+ */
380+#define __DRI_SYSTEM_TIME "DRI_SystemTime"
381+#define __DRI_SYSTEM_TIME_VERSION 1
382+struct __DRIsystemTimeExtensionRec {
383+ __DRIextension base;
384+385+ /**
386+ * Get the 64-bit unadjusted system time (UST).
387+ */
388+ int (*getUST)(int64_t * ust);
389+390+ /**
391+ * Get the media stream counter (MSC) rate.
392+ *
393+ * Matching the definition in GLX_OML_sync_control, this function returns
394+ * the rate of the "media stream counter". In practical terms, this is
395+ * the frame refresh rate of the display.
396+ */
397+ GLboolean (*getMSCRate)(__DRIdrawable *draw,
398+ int32_t * numerator, int32_t * denominator,
399+ void *loaderPrivate);
400+};
401+402+/**
403+ * Damage reporting
404+ */
405+#define __DRI_DAMAGE "DRI_Damage"
406+#define __DRI_DAMAGE_VERSION 1
407+struct __DRIdamageExtensionRec {
408+ __DRIextension base;
409+410+ /**
411+ * Reports areas of the given drawable which have been modified by the
412+ * driver.
413+ *
414+ * \param drawable which the drawing was done to.
415+ * \param rects rectangles affected, with the drawable origin as the
416+ * origin.
417+ * \param x X offset of the drawable within the screen (used in the
418+ * front_buffer case)
419+ * \param y Y offset of the drawable within the screen.
420+ * \param front_buffer boolean flag for whether the drawing to the
421+ * drawable was actually done directly to the front buffer (instead
422+ * of backing storage, for example)
423+ * \param loaderPrivate the data passed in at createNewDrawable time
424+ */
425+ void (*reportDamage)(__DRIdrawable *draw,
426+ int x, int y,
427+ drm_clip_rect_t *rects, int num_rects,
428+ GLboolean front_buffer,
429+ void *loaderPrivate);
430+};
431+432+#define __DRI_SWRAST_IMAGE_OP_DRAW 1
433+#define __DRI_SWRAST_IMAGE_OP_CLEAR 2
434+#define __DRI_SWRAST_IMAGE_OP_SWAP 3
435+436+/**
437+ * SWRast Loader extension.
438+ */
439+#define __DRI_SWRAST_LOADER "DRI_SWRastLoader"
440+#define __DRI_SWRAST_LOADER_VERSION 1
441+struct __DRIswrastLoaderExtensionRec {
442+ __DRIextension base;
443+444+ /*
445+ * Drawable position and size
446+ */
447+ void (*getDrawableInfo)(__DRIdrawable *drawable,
448+ int *x, int *y, int *width, int *height,
449+ void *loaderPrivate);
450+451+ /**
452+ * Put image to drawable
453+ */
454+ void (*putImage)(__DRIdrawable *drawable, int op,
455+ int x, int y, int width, int height,
456+ char *data, void *loaderPrivate);
457+458+ /**
459+ * Get image from readable
460+ */
461+ void (*getImage)(__DRIdrawable *readable,
462+ int x, int y, int width, int height,
463+ char *data, void *loaderPrivate);
464+};
465+466+/**
467+ * Invalidate loader extension. The presence of this extension
468+ * indicates to the DRI driver that the loader will call invalidate in
469+ * the __DRI2_FLUSH extension, whenever the needs to query for new
470+ * buffers. This means that the DRI driver can drop the polling in
471+ * glViewport().
472+ *
473+ * The extension doesn't provide any functionality, it's only use to
474+ * indicate to the driver that it can use the new semantics. A DRI
475+ * driver can use this to switch between the different semantics or
476+ * just refuse to initialize if this extension isn't present.
477+ */
478+#define __DRI_USE_INVALIDATE "DRI_UseInvalidate"
479+#define __DRI_USE_INVALIDATE_VERSION 1
480+481+typedef struct __DRIuseInvalidateExtensionRec __DRIuseInvalidateExtension;
482+struct __DRIuseInvalidateExtensionRec {
483+ __DRIextension base;
484+};
485+486+/**
487+ * The remaining extensions describe driver extensions, immediately
488+ * available interfaces provided by the driver. To start using the
489+ * driver, dlsym() for the __DRI_DRIVER_EXTENSIONS symbol and look for
490+ * the extension you need in the array.
491+ */
492+#define __DRI_DRIVER_EXTENSIONS "__driDriverExtensions"
493+494+/**
495+ * This symbol replaces the __DRI_DRIVER_EXTENSIONS symbol, and will be
496+ * suffixed by "_drivername", allowing multiple drivers to be built into one
497+ * library, and also giving the driver the chance to return a variable driver
498+ * extensions struct depending on the driver name being loaded or any other
499+ * system state.
500+ *
501+ * The function prototype is:
502+ *
503+ * const __DRIextension **__driDriverGetExtensions_drivername(void);
504+ */
505+#define __DRI_DRIVER_GET_EXTENSIONS "__driDriverGetExtensions"
506+507+/**
508+ * Tokens for __DRIconfig attribs. A number of attributes defined by
509+ * GLX or EGL standards are not in the table, as they must be provided
510+ * by the loader. For example, FBConfig ID or visual ID, drawable type.
511+ */
512+513+#define __DRI_ATTRIB_BUFFER_SIZE 1
514+#define __DRI_ATTRIB_LEVEL 2
515+#define __DRI_ATTRIB_RED_SIZE 3
516+#define __DRI_ATTRIB_GREEN_SIZE 4
517+#define __DRI_ATTRIB_BLUE_SIZE 5
518+#define __DRI_ATTRIB_LUMINANCE_SIZE 6
519+#define __DRI_ATTRIB_ALPHA_SIZE 7
520+#define __DRI_ATTRIB_ALPHA_MASK_SIZE 8
521+#define __DRI_ATTRIB_DEPTH_SIZE 9
522+#define __DRI_ATTRIB_STENCIL_SIZE 10
523+#define __DRI_ATTRIB_ACCUM_RED_SIZE 11
524+#define __DRI_ATTRIB_ACCUM_GREEN_SIZE 12
525+#define __DRI_ATTRIB_ACCUM_BLUE_SIZE 13
526+#define __DRI_ATTRIB_ACCUM_ALPHA_SIZE 14
527+#define __DRI_ATTRIB_SAMPLE_BUFFERS 15
528+#define __DRI_ATTRIB_SAMPLES 16
529+#define __DRI_ATTRIB_RENDER_TYPE 17
530+#define __DRI_ATTRIB_CONFIG_CAVEAT 18
531+#define __DRI_ATTRIB_CONFORMANT 19
532+#define __DRI_ATTRIB_DOUBLE_BUFFER 20
533+#define __DRI_ATTRIB_STEREO 21
534+#define __DRI_ATTRIB_AUX_BUFFERS 22
535+#define __DRI_ATTRIB_TRANSPARENT_TYPE 23
536+#define __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE 24
537+#define __DRI_ATTRIB_TRANSPARENT_RED_VALUE 25
538+#define __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE 26
539+#define __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE 27
540+#define __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE 28
541+#define __DRI_ATTRIB_FLOAT_MODE 29
542+#define __DRI_ATTRIB_RED_MASK 30
543+#define __DRI_ATTRIB_GREEN_MASK 31
544+#define __DRI_ATTRIB_BLUE_MASK 32
545+#define __DRI_ATTRIB_ALPHA_MASK 33
546+#define __DRI_ATTRIB_MAX_PBUFFER_WIDTH 34
547+#define __DRI_ATTRIB_MAX_PBUFFER_HEIGHT 35
548+#define __DRI_ATTRIB_MAX_PBUFFER_PIXELS 36
549+#define __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH 37
550+#define __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT 38
551+#define __DRI_ATTRIB_VISUAL_SELECT_GROUP 39
552+#define __DRI_ATTRIB_SWAP_METHOD 40
553+#define __DRI_ATTRIB_MAX_SWAP_INTERVAL 41
554+#define __DRI_ATTRIB_MIN_SWAP_INTERVAL 42
555+#define __DRI_ATTRIB_BIND_TO_TEXTURE_RGB 43
556+#define __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA 44
557+#define __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE 45
558+#define __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS 46
559+#define __DRI_ATTRIB_YINVERTED 47
560+#define __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE 48
561+562+/* __DRI_ATTRIB_RENDER_TYPE */
563+#define __DRI_ATTRIB_RGBA_BIT 0x01
564+#define __DRI_ATTRIB_COLOR_INDEX_BIT 0x02
565+#define __DRI_ATTRIB_LUMINANCE_BIT 0x04
566+#define __DRI_ATTRIB_FLOAT_BIT 0x08
567+#define __DRI_ATTRIB_UNSIGNED_FLOAT_BIT 0x10
568+569+/* __DRI_ATTRIB_CONFIG_CAVEAT */
570+#define __DRI_ATTRIB_SLOW_BIT 0x01
571+#define __DRI_ATTRIB_NON_CONFORMANT_CONFIG 0x02
572+573+/* __DRI_ATTRIB_TRANSPARENT_TYPE */
574+#define __DRI_ATTRIB_TRANSPARENT_RGB 0x00
575+#define __DRI_ATTRIB_TRANSPARENT_INDEX 0x01
576+577+/* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */
578+#define __DRI_ATTRIB_TEXTURE_1D_BIT 0x01
579+#define __DRI_ATTRIB_TEXTURE_2D_BIT 0x02
580+#define __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT 0x04
581+582+/**
583+ * This extension defines the core DRI functionality.
584+ */
585+#define __DRI_CORE "DRI_Core"
586+#define __DRI_CORE_VERSION 1
587+588+struct __DRIcoreExtensionRec {
589+ __DRIextension base;
590+591+ __DRIscreen *(*createNewScreen)(int screen, int fd,
592+ unsigned int sarea_handle,
593+ const __DRIextension **extensions,
594+ const __DRIconfig ***driverConfigs,
595+ void *loaderPrivate);
596+597+ void (*destroyScreen)(__DRIscreen *screen);
598+599+ const __DRIextension **(*getExtensions)(__DRIscreen *screen);
600+601+ int (*getConfigAttrib)(const __DRIconfig *config,
602+ unsigned int attrib,
603+ unsigned int *value);
604+605+ int (*indexConfigAttrib)(const __DRIconfig *config, int index,
606+ unsigned int *attrib, unsigned int *value);
607+608+ __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
609+ const __DRIconfig *config,
610+ unsigned int drawable_id,
611+ unsigned int head,
612+ void *loaderPrivate);
613+614+ void (*destroyDrawable)(__DRIdrawable *drawable);
615+616+ void (*swapBuffers)(__DRIdrawable *drawable);
617+618+ __DRIcontext *(*createNewContext)(__DRIscreen *screen,
619+ const __DRIconfig *config,
620+ __DRIcontext *shared,
621+ void *loaderPrivate);
622+623+ int (*copyContext)(__DRIcontext *dest,
624+ __DRIcontext *src,
625+ unsigned long mask);
626+627+ void (*destroyContext)(__DRIcontext *context);
628+629+ int (*bindContext)(__DRIcontext *ctx,
630+ __DRIdrawable *pdraw,
631+ __DRIdrawable *pread);
632+633+ int (*unbindContext)(__DRIcontext *ctx);
634+};
635+636+/**
637+ * Stored version of some component (i.e., server-side DRI module, kernel-side
638+ * DRM, etc.).
639+ *
640+ * \todo
641+ * There are several data structures that explicitly store a major version,
642+ * minor version, and patch level. These structures should be modified to
643+ * have a \c __DRIversionRec instead.
644+ */
645+struct __DRIversionRec {
646+ int major; /**< Major version number. */
647+ int minor; /**< Minor version number. */
648+ int patch; /**< Patch-level. */
649+};
650+651+/**
652+ * Framebuffer information record. Used by libGL to communicate information
653+ * about the framebuffer to the driver's \c __driCreateNewScreen function.
654+ *
655+ * In XFree86, most of this information is derrived from data returned by
656+ * calling \c XF86DRIGetDeviceInfo.
657+ *
658+ * \sa XF86DRIGetDeviceInfo __DRIdisplayRec::createNewScreen
659+ * __driUtilCreateNewScreen CallCreateNewScreen
660+ *
661+ * \bug This structure could be better named.
662+ */
663+struct __DRIframebufferRec {
664+ unsigned char *base; /**< Framebuffer base address in the CPU's
665+ * address space. This value is calculated by
666+ * calling \c drmMap on the framebuffer handle
667+ * returned by \c XF86DRIGetDeviceInfo (or a
668+ * similar function).
669+ */
670+ int size; /**< Framebuffer size, in bytes. */
671+ int stride; /**< Number of bytes from one line to the next. */
672+ int width; /**< Pixel width of the framebuffer. */
673+ int height; /**< Pixel height of the framebuffer. */
674+ int dev_priv_size; /**< Size of the driver's dev-priv structure. */
675+ void *dev_priv; /**< Pointer to the driver's dev-priv structure. */
676+};
677+678+679+/**
680+ * This extension provides alternative screen, drawable and context
681+ * constructors for legacy DRI functionality. This is used in
682+ * conjunction with the core extension.
683+ */
684+#define __DRI_LEGACY "DRI_Legacy"
685+#define __DRI_LEGACY_VERSION 1
686+687+struct __DRIlegacyExtensionRec {
688+ __DRIextension base;
689+690+ __DRIscreen *(*createNewScreen)(int screen,
691+ const __DRIversion *ddx_version,
692+ const __DRIversion *dri_version,
693+ const __DRIversion *drm_version,
694+ const __DRIframebuffer *frame_buffer,
695+ void *pSAREA, int fd,
696+ const __DRIextension **extensions,
697+ const __DRIconfig ***driver_configs,
698+ void *loaderPrivate);
699+700+ __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
701+ const __DRIconfig *config,
702+ drm_drawable_t hwDrawable,
703+ int renderType, const int *attrs,
704+ void *loaderPrivate);
705+706+ __DRIcontext *(*createNewContext)(__DRIscreen *screen,
707+ const __DRIconfig *config,
708+ int render_type,
709+ __DRIcontext *shared,
710+ drm_context_t hwContext,
711+ void *loaderPrivate);
712+};
713+714+/**
715+ * This extension provides alternative screen, drawable and context
716+ * constructors for swrast DRI functionality. This is used in
717+ * conjunction with the core extension.
718+ */
719+#define __DRI_SWRAST "DRI_SWRast"
720+#define __DRI_SWRAST_VERSION 4
721+722+struct __DRIswrastExtensionRec {
723+ __DRIextension base;
724+725+ __DRIscreen *(*createNewScreen)(int screen,
726+ const __DRIextension **extensions,
727+ const __DRIconfig ***driver_configs,
728+ void *loaderPrivate);
729+730+ __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
731+ const __DRIconfig *config,
732+ void *loaderPrivate);
733+734+ /* Since version 2 */
735+ __DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen,
736+ int api,
737+ const __DRIconfig *config,
738+ __DRIcontext *shared,
739+ void *data);
740+741+ /**
742+ * Create a context for a particular API with a set of attributes
743+ *
744+ * \since version 3
745+ *
746+ * \sa __DRIdri2ExtensionRec::createContextAttribs
747+ */
748+ __DRIcontext *(*createContextAttribs)(__DRIscreen *screen,
749+ int api,
750+ const __DRIconfig *config,
751+ __DRIcontext *shared,
752+ unsigned num_attribs,
753+ const uint32_t *attribs,
754+ unsigned *error,
755+ void *loaderPrivate);
756+757+ /**
758+ * createNewScreen() with the driver extensions passed in.
759+ *
760+ * \since version 4
761+ */
762+ __DRIscreen *(*createNewScreen2)(int screen,
763+ const __DRIextension **loader_extensions,
764+ const __DRIextension **driver_extensions,
765+ const __DRIconfig ***driver_configs,
766+ void *loaderPrivate);
767+768+};
769+770+/** Common DRI function definitions, shared among DRI2 and Image extensions
771+ */
772+773+typedef __DRIscreen *
774+(*__DRIcreateNewScreen2Func)(int screen, int fd,
775+ const __DRIextension **extensions,
776+ const __DRIextension **driver_extensions,
777+ const __DRIconfig ***driver_configs,
778+ void *loaderPrivate);
779+780+typedef __DRIdrawable *
781+(*__DRIcreateNewDrawableFunc)(__DRIscreen *screen,
782+ const __DRIconfig *config,
783+ void *loaderPrivate);
784+785+typedef __DRIcontext *
786+(*__DRIcreateContextAttribsFunc)(__DRIscreen *screen,
787+ int api,
788+ const __DRIconfig *config,
789+ __DRIcontext *shared,
790+ unsigned num_attribs,
791+ const uint32_t *attribs,
792+ unsigned *error,
793+ void *loaderPrivate);
794+795+typedef unsigned int
796+(*__DRIgetAPIMaskFunc)(__DRIscreen *screen);
797+798+/**
799+ * DRI2 Loader extension.
800+ */
801+#define __DRI_BUFFER_FRONT_LEFT 0
802+#define __DRI_BUFFER_BACK_LEFT 1
803+#define __DRI_BUFFER_FRONT_RIGHT 2
804+#define __DRI_BUFFER_BACK_RIGHT 3
805+#define __DRI_BUFFER_DEPTH 4
806+#define __DRI_BUFFER_STENCIL 5
807+#define __DRI_BUFFER_ACCUM 6
808+#define __DRI_BUFFER_FAKE_FRONT_LEFT 7
809+#define __DRI_BUFFER_FAKE_FRONT_RIGHT 8
810+#define __DRI_BUFFER_DEPTH_STENCIL 9 /**< Only available with DRI2 1.1 */
811+#define __DRI_BUFFER_HIZ 10
812+813+/* Inofficial and for internal use. Increase when adding a new buffer token. */
814+#define __DRI_BUFFER_COUNT 11
815+816+struct __DRIbufferRec {
817+ unsigned int attachment;
818+ unsigned int name;
819+ unsigned int pitch;
820+ unsigned int cpp;
821+ unsigned int flags;
822+};
823+824+#define __DRI_DRI2_LOADER "DRI_DRI2Loader"
825+#define __DRI_DRI2_LOADER_VERSION 3
826+struct __DRIdri2LoaderExtensionRec {
827+ __DRIextension base;
828+829+ __DRIbuffer *(*getBuffers)(__DRIdrawable *driDrawable,
830+ int *width, int *height,
831+ unsigned int *attachments, int count,
832+ int *out_count, void *loaderPrivate);
833+834+ /**
835+ * Flush pending front-buffer rendering
836+ *
837+ * Any rendering that has been performed to the
838+ * \c __DRI_BUFFER_FAKE_FRONT_LEFT will be flushed to the
839+ * \c __DRI_BUFFER_FRONT_LEFT.
840+ *
841+ * \param driDrawable Drawable whose front-buffer is to be flushed
842+ * \param loaderPrivate Loader's private data that was previously passed
843+ * into __DRIdri2ExtensionRec::createNewDrawable
844+ */
845+ void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
846+847+848+ /**
849+ * Get list of buffers from the server
850+ *
851+ * Gets a list of buffer for the specified set of attachments. Unlike
852+ * \c ::getBuffers, this function takes a list of attachments paired with
853+ * opaque \c unsigned \c int value describing the format of the buffer.
854+ * It is the responsibility of the caller to know what the service that
855+ * allocates the buffers will expect to receive for the format.
856+ *
857+ * \param driDrawable Drawable whose buffers are being queried.
858+ * \param width Output where the width of the buffers is stored.
859+ * \param height Output where the height of the buffers is stored.
860+ * \param attachments List of pairs of attachment ID and opaque format
861+ * requested for the drawable.
862+ * \param count Number of attachment / format pairs stored in
863+ * \c attachments.
864+ * \param loaderPrivate Loader's private data that was previously passed
865+ * into __DRIdri2ExtensionRec::createNewDrawable.
866+ */
867+ __DRIbuffer *(*getBuffersWithFormat)(__DRIdrawable *driDrawable,
868+ int *width, int *height,
869+ unsigned int *attachments, int count,
870+ int *out_count, void *loaderPrivate);
871+};
872+873+/**
874+ * This extension provides alternative screen, drawable and context
875+ * constructors for DRI2.
876+ */
877+#define __DRI_DRI2 "DRI_DRI2"
878+#define __DRI_DRI2_VERSION 4
879+880+#define __DRI_API_OPENGL 0 /**< OpenGL compatibility profile */
881+#define __DRI_API_GLES 1 /**< OpenGL ES 1.x */
882+#define __DRI_API_GLES2 2 /**< OpenGL ES 2.x */
883+#define __DRI_API_OPENGL_CORE 3 /**< OpenGL 3.2+ core profile */
884+#define __DRI_API_GLES3 4 /**< OpenGL ES 3.x */
885+886+#define __DRI_CTX_ATTRIB_MAJOR_VERSION 0
887+#define __DRI_CTX_ATTRIB_MINOR_VERSION 1
888+#define __DRI_CTX_ATTRIB_FLAGS 2
889+890+/**
891+ * \requires __DRI2_ROBUSTNESS.
892+ */
893+#define __DRI_CTX_ATTRIB_RESET_STRATEGY 3
894+895+#define __DRI_CTX_FLAG_DEBUG 0x00000001
896+#define __DRI_CTX_FLAG_FORWARD_COMPATIBLE 0x00000002
897+898+/**
899+ * \requires __DRI2_ROBUSTNESS.
900+ */
901+#define __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS 0x00000004
902+903+/**
904+ * \name Context reset strategies.
905+ */
906+/*@{*/
907+#define __DRI_CTX_RESET_NO_NOTIFICATION 0
908+#define __DRI_CTX_RESET_LOSE_CONTEXT 1
909+/*@}*/
910+911+/**
912+ * \name Reasons that __DRIdri2Extension::createContextAttribs might fail
913+ */
914+/*@{*/
915+/** Success! */
916+#define __DRI_CTX_ERROR_SUCCESS 0
917+918+/** Memory allocation failure */
919+#define __DRI_CTX_ERROR_NO_MEMORY 1
920+921+/** Client requested an API (e.g., OpenGL ES 2.0) that the driver can't do. */
922+#define __DRI_CTX_ERROR_BAD_API 2
923+924+/** Client requested an API version that the driver can't do. */
925+#define __DRI_CTX_ERROR_BAD_VERSION 3
926+927+/** Client requested a flag or combination of flags the driver can't do. */
928+#define __DRI_CTX_ERROR_BAD_FLAG 4
929+930+/** Client requested an attribute the driver doesn't understand. */
931+#define __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE 5
932+933+/** Client requested a flag the driver doesn't understand. */
934+#define __DRI_CTX_ERROR_UNKNOWN_FLAG 6
935+/*@}*/
936+937+struct __DRIdri2ExtensionRec {
938+ __DRIextension base;
939+940+ __DRIscreen *(*createNewScreen)(int screen, int fd,
941+ const __DRIextension **extensions,
942+ const __DRIconfig ***driver_configs,
943+ void *loaderPrivate);
944+945+ __DRIcreateNewDrawableFunc createNewDrawable;
946+ __DRIcontext *(*createNewContext)(__DRIscreen *screen,
947+ const __DRIconfig *config,
948+ __DRIcontext *shared,
949+ void *loaderPrivate);
950+951+ /* Since version 2 */
952+ __DRIgetAPIMaskFunc getAPIMask;
953+954+ __DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen,
955+ int api,
956+ const __DRIconfig *config,
957+ __DRIcontext *shared,
958+ void *data);
959+960+ __DRIbuffer *(*allocateBuffer)(__DRIscreen *screen,
961+ unsigned int attachment,
962+ unsigned int format,
963+ int width,
964+ int height);
965+ void (*releaseBuffer)(__DRIscreen *screen,
966+ __DRIbuffer *buffer);
967+968+ /**
969+ * Create a context for a particular API with a set of attributes
970+ *
971+ * \since version 3
972+ *
973+ * \sa __DRIswrastExtensionRec::createContextAttribs
974+ */
975+ __DRIcreateContextAttribsFunc createContextAttribs;
976+977+ /**
978+ * createNewScreen with the driver's extension list passed in.
979+ *
980+ * \since version 4
981+ */
982+ __DRIcreateNewScreen2Func createNewScreen2;
983+};
984+985+986+/**
987+ * This extension provides functionality to enable various EGLImage
988+ * extensions.
989+ */
990+#define __DRI_IMAGE "DRI_IMAGE"
991+#define __DRI_IMAGE_VERSION 8
992+993+/**
994+ * These formats correspond to the similarly named MESA_FORMAT_*
995+ * tokens, except in the native endian of the CPU. For example, on
996+ * little endian __DRI_IMAGE_FORMAT_XRGB8888 corresponds to
997+ * MESA_FORMAT_XRGB8888, but MESA_FORMAT_XRGB8888_REV on big endian.
998+ *
999+ * __DRI_IMAGE_FORMAT_NONE is for images that aren't directly usable
1000+ * by the driver (YUV planar formats) but serve as a base image for
1001+ * creating sub-images for the different planes within the image.
1002+ *
1003+ * R8, GR88 and NONE should not be used with createImageFormName or
1004+ * createImage, and are returned by query from sub images created with
1005+ * createImageFromNames (NONE, see above) and fromPlane (R8 & GR88).
1006+ */
1007+#define __DRI_IMAGE_FORMAT_RGB565 0x1001
1008+#define __DRI_IMAGE_FORMAT_XRGB8888 0x1002
1009+#define __DRI_IMAGE_FORMAT_ARGB8888 0x1003
1010+#define __DRI_IMAGE_FORMAT_ABGR8888 0x1004
1011+#define __DRI_IMAGE_FORMAT_XBGR8888 0x1005
1012+#define __DRI_IMAGE_FORMAT_R8 0x1006 /* Since version 5 */
1013+#define __DRI_IMAGE_FORMAT_GR88 0x1007
1014+#define __DRI_IMAGE_FORMAT_NONE 0x1008
1015+#define __DRI_IMAGE_FORMAT_XRGB2101010 0x1009
1016+#define __DRI_IMAGE_FORMAT_ARGB2101010 0x100a
1017+#define __DRI_IMAGE_FORMAT_SARGB8 0x100b
1018+1019+#define __DRI_IMAGE_USE_SHARE 0x0001
1020+#define __DRI_IMAGE_USE_SCANOUT 0x0002
1021+#define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */
1022+#define __DRI_IMAGE_USE_LINEAR 0x0008
1023+1024+1025+/**
1026+ * Four CC formats that matches with WL_DRM_FORMAT_* from wayland_drm.h
1027+ * and GBM_FORMAT_* from gbm.h, used with createImageFromNames.
1028+ *
1029+ * \since 5
1030+ */
1031+1032+#define __DRI_IMAGE_FOURCC_RGB565 0x36314752
1033+#define __DRI_IMAGE_FOURCC_ARGB8888 0x34325241
1034+#define __DRI_IMAGE_FOURCC_XRGB8888 0x34325258
1035+#define __DRI_IMAGE_FOURCC_ABGR8888 0x34324241
1036+#define __DRI_IMAGE_FOURCC_XBGR8888 0x34324258
1037+#define __DRI_IMAGE_FOURCC_YUV410 0x39565559
1038+#define __DRI_IMAGE_FOURCC_YUV411 0x31315559
1039+#define __DRI_IMAGE_FOURCC_YUV420 0x32315559
1040+#define __DRI_IMAGE_FOURCC_YUV422 0x36315559
1041+#define __DRI_IMAGE_FOURCC_YUV444 0x34325559
1042+#define __DRI_IMAGE_FOURCC_NV12 0x3231564e
1043+#define __DRI_IMAGE_FOURCC_NV16 0x3631564e
1044+#define __DRI_IMAGE_FOURCC_YUYV 0x56595559
1045+1046+1047+/**
1048+ * Queryable on images created by createImageFromNames.
1049+ *
1050+ * RGB and RGBA are may be usable directly as images but its still
1051+ * recommended to call fromPlanar with plane == 0.
1052+ *
1053+ * Y_U_V, Y_UV and Y_XUXV all requires call to fromPlanar to create
1054+ * usable sub-images, sampling from images return raw YUV data and
1055+ * color conversion needs to be done in the shader.
1056+ *
1057+ * \since 5
1058+ */
1059+1060+#define __DRI_IMAGE_COMPONENTS_RGB 0x3001
1061+#define __DRI_IMAGE_COMPONENTS_RGBA 0x3002
1062+#define __DRI_IMAGE_COMPONENTS_Y_U_V 0x3003
1063+#define __DRI_IMAGE_COMPONENTS_Y_UV 0x3004
1064+#define __DRI_IMAGE_COMPONENTS_Y_XUXV 0x3005
1065+1066+1067+/**
1068+ * queryImage attributes
1069+ */
1070+1071+#define __DRI_IMAGE_ATTRIB_STRIDE 0x2000
1072+#define __DRI_IMAGE_ATTRIB_HANDLE 0x2001
1073+#define __DRI_IMAGE_ATTRIB_NAME 0x2002
1074+#define __DRI_IMAGE_ATTRIB_FORMAT 0x2003 /* available in versions 3+ */
1075+#define __DRI_IMAGE_ATTRIB_WIDTH 0x2004 /* available in versions 4+ */
1076+#define __DRI_IMAGE_ATTRIB_HEIGHT 0x2005
1077+#define __DRI_IMAGE_ATTRIB_COMPONENTS 0x2006 /* available in versions 5+ */
1078+#define __DRI_IMAGE_ATTRIB_FD 0x2007 /* available in versions
1079+ * 7+. Each query will return a
1080+ * new fd. */
1081+1082+enum __DRIYUVColorSpace {
1083+ __DRI_YUV_COLOR_SPACE_UNDEFINED = 0,
1084+ __DRI_YUV_COLOR_SPACE_ITU_REC601 = 0x327F,
1085+ __DRI_YUV_COLOR_SPACE_ITU_REC709 = 0x3280,
1086+ __DRI_YUV_COLOR_SPACE_ITU_REC2020 = 0x3281
1087+};
1088+1089+enum __DRISampleRange {
1090+ __DRI_YUV_RANGE_UNDEFINED = 0,
1091+ __DRI_YUV_FULL_RANGE = 0x3282,
1092+ __DRI_YUV_NARROW_RANGE = 0x3283
1093+};
1094+1095+enum __DRIChromaSiting {
1096+ __DRI_YUV_CHROMA_SITING_UNDEFINED = 0,
1097+ __DRI_YUV_CHROMA_SITING_0 = 0x3284,
1098+ __DRI_YUV_CHROMA_SITING_0_5 = 0x3285
1099+};
1100+1101+/**
1102+ * \name Reasons that __DRIimageExtensionRec::createImageFromTexture might fail
1103+ */
1104+/*@{*/
1105+/** Success! */
1106+#define __DRI_IMAGE_ERROR_SUCCESS 0
1107+1108+/** Memory allocation failure */
1109+#define __DRI_IMAGE_ERROR_BAD_ALLOC 1
1110+1111+/** Client requested an invalid attribute for a texture object */
1112+#define __DRI_IMAGE_ERROR_BAD_MATCH 2
1113+1114+/** Client requested an invalid texture object */
1115+#define __DRI_IMAGE_ERROR_BAD_PARAMETER 3
1116+/*@}*/
1117+1118+typedef struct __DRIimageRec __DRIimage;
1119+typedef struct __DRIimageExtensionRec __DRIimageExtension;
1120+struct __DRIimageExtensionRec {
1121+ __DRIextension base;
1122+1123+ __DRIimage *(*createImageFromName)(__DRIscreen *screen,
1124+ int width, int height, int format,
1125+ int name, int pitch,
1126+ void *loaderPrivate);
1127+1128+ __DRIimage *(*createImageFromRenderbuffer)(__DRIcontext *context,
1129+ int renderbuffer,
1130+ void *loaderPrivate);
1131+1132+ void (*destroyImage)(__DRIimage *image);
1133+1134+ __DRIimage *(*createImage)(__DRIscreen *screen,
1135+ int width, int height, int format,
1136+ unsigned int use,
1137+ void *loaderPrivate);
1138+1139+ GLboolean (*queryImage)(__DRIimage *image, int attrib, int *value);
1140+1141+ /**
1142+ * The new __DRIimage will share the content with the old one, see dup(2).
1143+ */
1144+ __DRIimage *(*dupImage)(__DRIimage *image, void *loaderPrivate);
1145+1146+ /**
1147+ * Validate that a __DRIimage can be used a certain way.
1148+ *
1149+ * \since 2
1150+ */
1151+ GLboolean (*validateUsage)(__DRIimage *image, unsigned int use);
1152+1153+ /**
1154+ * Unlike createImageFromName __DRI_IMAGE_FORMAT is not but instead
1155+ * __DRI_IMAGE_FOURCC and strides are in bytes not pixels. Stride is
1156+ * also per block and not per pixel (for non-RGB, see gallium blocks).
1157+ *
1158+ * \since 5
1159+ */
1160+ __DRIimage *(*createImageFromNames)(__DRIscreen *screen,
1161+ int width, int height, int fourcc,
1162+ int *names, int num_names,
1163+ int *strides, int *offsets,
1164+ void *loaderPrivate);
1165+1166+ /**
1167+ * Create an image out of a sub-region of a parent image. This
1168+ * entry point lets us create individual __DRIimages for different
1169+ * planes in a planar buffer (typically yuv), for example. While a
1170+ * sub-image shares the underlying buffer object with the parent
1171+ * image and other sibling sub-images, the life times of parent and
1172+ * sub-images are not dependent. Destroying the parent or a
1173+ * sub-image doesn't affect other images. The underlying buffer
1174+ * object is free when no __DRIimage remains that references it.
1175+ *
1176+ * Sub-images may overlap, but rendering to overlapping sub-images
1177+ * is undefined.
1178+ *
1179+ * \since 5
1180+ */
1181+ __DRIimage *(*fromPlanar)(__DRIimage *image, int plane,
1182+ void *loaderPrivate);
1183+1184+ /**
1185+ * Create image from texture.
1186+ *
1187+ * \since 6
1188+ */
1189+ __DRIimage *(*createImageFromTexture)(__DRIcontext *context,
1190+ int target,
1191+ unsigned texture,
1192+ int depth,
1193+ int level,
1194+ unsigned *error,
1195+ void *loaderPrivate);
1196+ /**
1197+ * Like createImageFromNames, but takes a prime fd instead.
1198+ *
1199+ * \since 7
1200+ */
1201+ __DRIimage *(*createImageFromFds)(__DRIscreen *screen,
1202+ int width, int height, int fourcc,
1203+ int *fds, int num_fds,
1204+ int *strides, int *offsets,
1205+ void *loaderPrivate);
1206+1207+ /**
1208+ * Like createImageFromFds, but takes additional attributes.
1209+ *
1210+ * For EGL_EXT_image_dma_buf_import.
1211+ *
1212+ * \since 8
1213+ */
1214+ __DRIimage *(*createImageFromDmaBufs)(__DRIscreen *screen,
1215+ int width, int height, int fourcc,
1216+ int *fds, int num_fds,
1217+ int *strides, int *offsets,
1218+ enum __DRIYUVColorSpace color_space,
1219+ enum __DRISampleRange sample_range,
1220+ enum __DRIChromaSiting horiz_siting,
1221+ enum __DRIChromaSiting vert_siting,
1222+ unsigned *error,
1223+ void *loaderPrivate);
1224+};
1225+1226+1227+/**
1228+ * This extension must be implemented by the loader and passed to the
1229+ * driver at screen creation time. The EGLImage entry points in the
1230+ * various client APIs take opaque EGLImage handles and use this
1231+ * extension to map them to a __DRIimage. At version 1, this
1232+ * extensions allows mapping EGLImage pointers to __DRIimage pointers,
1233+ * but future versions could support other EGLImage-like, opaque types
1234+ * with new lookup functions.
1235+ */
1236+#define __DRI_IMAGE_LOOKUP "DRI_IMAGE_LOOKUP"
1237+#define __DRI_IMAGE_LOOKUP_VERSION 1
1238+1239+typedef struct __DRIimageLookupExtensionRec __DRIimageLookupExtension;
1240+struct __DRIimageLookupExtensionRec {
1241+ __DRIextension base;
1242+1243+ __DRIimage *(*lookupEGLImage)(__DRIscreen *screen, void *image,
1244+ void *loaderPrivate);
1245+};
1246+1247+/**
1248+ * This extension allows for common DRI2 options
1249+ */
1250+#define __DRI2_CONFIG_QUERY "DRI_CONFIG_QUERY"
1251+#define __DRI2_CONFIG_QUERY_VERSION 1
1252+1253+typedef struct __DRI2configQueryExtensionRec __DRI2configQueryExtension;
1254+struct __DRI2configQueryExtensionRec {
1255+ __DRIextension base;
1256+1257+ int (*configQueryb)(__DRIscreen *screen, const char *var, GLboolean *val);
1258+ int (*configQueryi)(__DRIscreen *screen, const char *var, GLint *val);
1259+ int (*configQueryf)(__DRIscreen *screen, const char *var, GLfloat *val);
1260+};
1261+1262+/**
1263+ * Robust context driver extension.
1264+ *
1265+ * Existence of this extension means the driver can accept the
1266+ * \c __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS flag and the
1267+ * \c __DRI_CTX_ATTRIB_RESET_STRATEGY attribute in
1268+ * \c __DRIdri2ExtensionRec::createContextAttribs.
1269+ */
1270+#define __DRI2_ROBUSTNESS "DRI_Robustness"
1271+#define __DRI2_ROBUSTNESS_VERSION 1
1272+1273+typedef struct __DRIrobustnessExtensionRec __DRIrobustnessExtension;
1274+struct __DRIrobustnessExtensionRec {
1275+ __DRIextension base;
1276+};
1277+1278+/**
1279+ * DRI config options extension.
1280+ *
1281+ * This extension provides the XML string containing driver options for use by
1282+ * the loader in supporting the driconf application.
1283+ */
1284+#define __DRI_CONFIG_OPTIONS "DRI_ConfigOptions"
1285+#define __DRI_CONFIG_OPTIONS_VERSION 1
1286+1287+typedef struct __DRIconfigOptionsExtensionRec {
1288+ __DRIextension base;
1289+ const char *xml;
1290+} __DRIconfigOptionsExtension;
1291+1292+/**
1293+ * This extension provides a driver vtable to a set of common driver helper
1294+ * functions (driCoreExtension, driDRI2Extension) within the driver
1295+ * implementation, as opposed to having to pass them through a global
1296+ * variable.
1297+ *
1298+ * It is not intended to be public API to the actual loader, and the vtable
1299+ * layout may change at any time.
1300+ */
1301+#define __DRI_DRIVER_VTABLE "DRI_DriverVtable"
1302+#define __DRI_DRIVER_VTABLE_VERSION 1
1303+1304+typedef struct __DRIDriverVtableExtensionRec {
1305+ __DRIextension base;
1306+ const struct __DriverAPIRec *vtable;
1307+} __DRIDriverVtableExtension;
1308+1309+/**
1310+ * Query renderer driver extension
1311+ *
1312+ * This allows the window system layer (either EGL or GLX) to query aspects of
1313+ * hardware and driver support without creating a context.
1314+ */
1315+#define __DRI2_RENDERER_QUERY "DRI_RENDERER_QUERY"
1316+#define __DRI2_RENDERER_QUERY_VERSION 1
1317+1318+#define __DRI2_RENDERER_VENDOR_ID 0x0000
1319+#define __DRI2_RENDERER_DEVICE_ID 0x0001
1320+#define __DRI2_RENDERER_VERSION 0x0002
1321+#define __DRI2_RENDERER_ACCELERATED 0x0003
1322+#define __DRI2_RENDERER_VIDEO_MEMORY 0x0004
1323+#define __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE 0x0005
1324+#define __DRI2_RENDERER_PREFERRED_PROFILE 0x0006
1325+#define __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION 0x0007
1326+#define __DRI2_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION 0x0008
1327+#define __DRI2_RENDERER_OPENGL_ES_PROFILE_VERSION 0x0009
1328+#define __DRI2_RENDERER_OPENGL_ES2_PROFILE_VERSION 0x000a
1329+1330+typedef struct __DRI2rendererQueryExtensionRec __DRI2rendererQueryExtension;
1331+struct __DRI2rendererQueryExtensionRec {
1332+ __DRIextension base;
1333+1334+ int (*queryInteger)(__DRIscreen *screen, int attribute, unsigned int *val);
1335+ int (*queryString)(__DRIscreen *screen, int attribute, const char **val);
1336+};
1337+1338+/**
1339+ * Image Loader extension. Drivers use this to allocate color buffers
1340+ */
1341+1342+enum __DRIimageBufferMask {
1343+ __DRI_IMAGE_BUFFER_BACK = (1 << 0),
1344+ __DRI_IMAGE_BUFFER_FRONT = (1 << 1)
1345+};
1346+1347+struct __DRIimageList {
1348+ uint32_t image_mask;
1349+ __DRIimage *back;
1350+ __DRIimage *front;
1351+};
1352+1353+#define __DRI_IMAGE_LOADER "DRI_IMAGE_LOADER"
1354+#define __DRI_IMAGE_LOADER_VERSION 1
1355+1356+struct __DRIimageLoaderExtensionRec {
1357+ __DRIextension base;
1358+1359+ /**
1360+ * Allocate color buffers.
1361+ *
1362+ * \param driDrawable
1363+ * \param width Width of allocated buffers
1364+ * \param height Height of allocated buffers
1365+ * \param format one of __DRI_IMAGE_FORMAT_*
1366+ * \param stamp Address of variable to be updated when
1367+ * getBuffers must be called again
1368+ * \param loaderPrivate The loaderPrivate for driDrawable
1369+ * \param buffer_mask Set of buffers to allocate
1370+ * \param buffers Returned buffers
1371+ */
1372+ int (*getBuffers)(__DRIdrawable *driDrawable,
1373+ unsigned int format,
1374+ uint32_t *stamp,
1375+ void *loaderPrivate,
1376+ uint32_t buffer_mask,
1377+ struct __DRIimageList *buffers);
1378+1379+ /**
1380+ * Flush pending front-buffer rendering
1381+ *
1382+ * Any rendering that has been performed to the
1383+ * fake front will be flushed to the front
1384+ *
1385+ * \param driDrawable Drawable whose front-buffer is to be flushed
1386+ * \param loaderPrivate Loader's private data that was previously passed
1387+ * into __DRIdri2ExtensionRec::createNewDrawable
1388+ */
1389+ void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
1390+};
1391+1392+/**
1393+ * DRI extension.
1394+ */
1395+1396+#define __DRI_IMAGE_DRIVER "DRI_IMAGE_DRIVER"
1397+#define __DRI_IMAGE_DRIVER_VERSION 1
1398+1399+struct __DRIimageDriverExtensionRec {
1400+ __DRIextension base;
1401+1402+ /* Common DRI functions, shared with DRI2 */
1403+ __DRIcreateNewScreen2Func createNewScreen2;
1404+ __DRIcreateNewDrawableFunc createNewDrawable;
1405+ __DRIcreateContextAttribsFunc createContextAttribs;
1406+ __DRIgetAPIMaskFunc getAPIMask;
1407+};
1408+1409+#endif
···1+#!/bin/bash
2+3+export PATH=@PATH@:$PATH
4+5+export FONTCONFIG_FILE="@FONTCONFIG_FILE@"
6+ENCODINGSDIR="@ENCODINGSDIR@"
7+FC_LOCKFILE=""
8+9+# Are we caching system fonts or user fonts?
10+system=0
11+12+# Are we including OSX font dirs ({/,~/,/System/}Library/Fonts)
13+osxfonts=1
14+15+# Do we want to force a recache?
16+force=0
17+18+# How noisy are we?
19+verbose=0
20+21+# Check if the data in the given directory is newer than its cache
22+check_dirty() {
23+ local dir=$1
24+ local fontfiles=""
25+ local retval=1
26+27+ # If the dir does not exist, we just exit
28+ if [[ ! -d "${dir}" ]]; then
29+ return 1
30+ fi
31+32+ # Create a list of all files in the dir
33+ # Filter out config / cache files. Ugly... counting down the day until
34+ # xfs finally goes away
35+ fontfiles="$(find ${dir}/ -maxdepth 1 -type f | awk '$0 !~ /fonts\..*$|^.*\.dir$/ {print}')"
36+37+ # Fonts were deleted (or never there). Kill off the caches
38+ if [[ -z "${fontfiles}" ]] ; then
39+ local f
40+ for f in "${dir}"/fonts.* "${dir}"/encodings.dir; do
41+ if [[ -f ${f} ]] ; then
42+ rm -f "${f}"
43+ fi
44+ done
45+ return 1
46+ fi
47+48+ # Force a recache
49+ if [[ ${force} == 1 ]] ; then
50+ retval=0
51+ fi
52+53+ # If we don't have our caches, we are dirty
54+ if [[ ! -f "${dir}/fonts.list" || ! -f "${dir}/fonts.dir" || ! -f "${dir}/encodings.dir" ]]; then
55+ retval=0
56+ fi
57+58+ # Check that no files were added or removed....
59+ if [[ "${retval}" -ne 0 && "$(cat ${dir}/fonts.list)" != "${fontfiles}" ]] ; then
60+ retval=0
61+ fi
62+63+ # Check that no files were updated....
64+ if [[ "${retval}" -ne 0 ]] ; then
65+ local changed="$(find ${dir}/ -type f -cnewer ${dir}/fonts.dir | awk '$0 !~ /fonts\..*$|^.*\.dir$/ {print}')"
66+67+ if [[ -n "${changed}" ]] ; then
68+ retval=0
69+ fi
70+ fi
71+72+ # Recreate fonts.list since something changed
73+ if [[ "${retval}" == 0 ]] ; then
74+ echo "${fontfiles}" > "${dir}"/fonts.list
75+ fi
76+77+ return ${retval}
78+}
79+80+get_fontdirs() {
81+ local d
82+ if [[ $system == 1 ]] ; then
83+ if [[ $osxfonts == 1 ]] ; then
84+ find {/System/,/}Library/Fonts -type d
85+ fi
86+ else
87+ if [[ $osxfonts == 1 && -d "${HOME}/Library/Fonts" ]] ; then
88+ find "${HOME}/Library/Fonts" -type d
89+ fi
90+91+ if [[ -d "${HOME}/.fonts" ]] ; then
92+ find "${HOME}/.fonts" -type d
93+ fi
94+ fi
95+}
96+97+setup_fontdirs() {
98+ local x=""
99+ local fontdirs=""
100+ local changed="no"
101+102+ umask 022
103+104+ if [[ $system == 1 ]] ; then
105+ echo "font_cache: Scanning system font directories to generate X11 font caches"
106+ else
107+ echo "font_cache: Scanning user font directories to generate X11 font caches"
108+ fi
109+110+ OIFS=$IFS
111+ IFS='
112+'
113+ for x in $(get_fontdirs) ; do
114+ if [[ -d "${x}" ]] && check_dirty "${x}" ; then
115+ if [[ -z "${fontdirs}" ]] ; then
116+ fontdirs="${x}"
117+ else
118+ fontdirs="${fontdirs}${IFS}${x}"
119+ fi
120+ fi
121+ done
122+123+ if [[ -n "${fontdirs}" ]] ; then
124+ echo "font_cache: Making fonts.dir for updated directories."
125+ for x in ${fontdirs} ; do
126+ if [[ $verbose == 1 ]] ; then
127+ echo "font_cache: ${x}"
128+ fi
129+130+ # First, generate fonts.scale for scaleable fonts that might be there
131+ @MKFONTSCALE@ \
132+ -a $ENCODINGSDIR/encodings.dir \
133+ -a $ENCODINGSDIR/large/encodings.dir \
134+ -- ${x}
135+136+ # Next, generate fonts.dir
137+ if [[ $verbose == 1 ]] ; then
138+ @MKFONTDIR@ \
139+ -e $ENCODINGSDIR \
140+ -e $ENCODINGSDIR/large \
141+ -- ${x}
142+ else
143+ @MKFONTDIR@ \
144+ -e $ENCODINGSDIR \
145+ -e $ENCODINGSDIR/large \
146+ -- ${x} > /dev/null
147+ fi
148+ done
149+ fi
150+ IFS=$OIFS
151+152+ # Finally, update fontconfig's cache
153+ echo "font_cache: Updating FC cache"
154+ if [[ $system == 1 ]] ; then
155+ @FC_CACHE@ -s \
156+ $([[ $force == 1 ]] && echo "-f -r") \
157+ $([[ $verbose == 1 ]] && echo "-v")
158+ else
159+ @FC_CACHE@ \
160+ $([[ $force == 1 ]] && echo "-f -r") \
161+ $([[ $verbose == 1 ]] && echo "-v")
162+ fi
163+ echo "font_cache: Done"
164+}
165+166+do_usage() {
167+ echo "font_cache [options]"
168+ echo " -f, --force : Force cache recreation"
169+ echo " -n, --no-osxfonts : Just cache X11 font directories"
170+ echo " (-n just pertains to XFont cache, not fontconfig)"
171+ echo " -s, --system : Cache system font dirs instead of user dirs"
172+ echo " -v, --verbose : Verbose Output"
173+}
174+175+cleanup() {
176+ [[ -r "${FC_LOCKFILE}" ]] && rm -f "${FC_LOCKFILE}"
177+ exit 1
178+}
179+180+while [[ $# -gt 0 ]] ; do
181+ case $1 in
182+ -s|--system) system=1 ;;
183+ -f|--force) force=1 ;;
184+ -v|--verbose) verbose=1 ;;
185+ -n|--no-osxfonts) osxfonts=0 ;;
186+ --help) do_usage ; exit 0 ;;
187+ *) do_usage ; exit 1 ;;
188+ esac
189+ shift
190+done
191+192+if [[ $system == 1 ]] ; then
193+ FC_LOCKFILE="/tmp/font_cache.$UID.lock"
194+elif [[ -w "${TMPDIR}" ]] ; then
195+ FC_LOCKFILE="${TMPDIR}/font_cache.lock"
196+elif [[ -w "/tmp" ]] ; then
197+ FC_LOCKFILE="/tmp/font_cache.$UID.lock"
198+else
199+ FC_LOCKFILE="${HOME}/.font_cache.lock"
200+fi
201+202+if [[ -x /usr/bin/lockfile ]] ; then
203+ if /usr/bin/lockfile -r 0 -l 240 -s 4 -! "${FC_LOCKFILE}" ; then
204+ echo "font_cache is already running." >&2
205+ echo "If you believe this to be erroneous, please remove ${FC_LOCKFILE}." >&2
206+ exit 1
207+ fi
208+else
209+ if [[ -r "${FC_LOCKFILE}" ]] ; then
210+ read OLD_PID < "${FC_LOCKFILE}"
211+ if kill -0 ${OLD_PID} >& /dev/null ; then
212+ echo "font_cache is already running with PID ${OLD_PID}." >&2
213+ echo "If you believe this to be erroneous, please remove ${FC_LOCKFILE}." >&2
214+ exit 1
215+ fi
216+217+ echo "Removing stale ${FC_LOCKFILE}" >&2
218+ rm -f "${FC_LOCKFILE}"
219+ fi
220+221+ echo $$ > "${FC_LOCKFILE}"
222+223+ if [[ ! -r "${FC_LOCKFILE}" ]] ; then
224+ echo "Unable to write to ${FC_LOCKFILE}." >&2
225+ exit 1
226+ fi
227+228+ # Now make sure we didn't collide mid-air
229+ read OLD_PID < "${FC_LOCKFILE}"
230+ if [[ $$ != ${OLD_PID} ]] ; then
231+ echo "font_cache is already running with PID ${OLD_PID}." >&2
232+ exit 1
233+ fi
234+fi
235+236+trap cleanup SIGINT SIGQUIT SIGABRT SIGTERM
237+238+setup_fontdirs
239+240+rm -f "${FC_LOCKFILE}"
···1+require 'rexml/document'
2+3+# This script is for setting environment variables in OSX applications.
4+#
5+# This script takes two arguments:
6+# 1) A Nix attrset serialized via `builtins.toXML'
7+# 2) The path to an OSX app's Info.plist file.
8+9+def main(serialized_attrs, plist_path)
10+ env = attrs_to_hash(serialized_attrs)
11+ doc = REXML::Document.new(File.open(plist_path, &:read))
12+ topmost_dict = doc.root.elements.detect { |e| e.name == "dict" }
13+ topmost_dict.add_element("key").tap do |key|
14+ key.text = "LSEnvironment"
15+ end
16+ topmost_dict.add_element(env_to_dict(env))
17+18+ formatter = REXML::Formatters::Pretty.new(2)
19+ formatter.compact = true
20+ formatter.write(doc, File.open(plist_path, "w"))
21+end
22+23+# Convert a `builtins.toXML' serialized attrs to a hash.
24+# This assumes the values are strings.
25+def attrs_to_hash(serialized_attrs)
26+ hash = {}
27+ env_vars = REXML::Document.new(serialized_attrs)
28+ env_vars.root.elements[1].elements.each do |attr|
29+ name = attr.attribute("name")
30+ value = attr.elements.first.attribute("value")
31+ hash[name] = value
32+ end
33+ hash
34+end
35+36+def env_to_dict(env)
37+ dict = REXML::Element.new("dict")
38+ env.each do |k, v|
39+ key = dict.add_element("key")
40+ key.text = k
41+ string = dict.add_element("string")
42+ string.text = v
43+ end
44+ dict
45+end
46+47+main(ARGV[0], ARGV[1])
+43
pkgs/servers/x11/xquartz/privileged
···0000000000000000000000000000000000000000000
···1+#!/bin/sh
2+3+export PATH=@PATH@:$PATH
4+export FONTCONFIG_FILE="@FONTCONFIG_FILE@"
5+6+# Our usage of mktemp fails with GNU, so prefer /usr/bin to hopefully
7+# get BSD mktemp
8+if [ -x /usr/bin/mktemp ] ; then
9+ MKTEMP=/usr/bin/mktemp
10+else
11+ MKTEMP=mktemp
12+fi
13+14+STAT=/usr/bin/stat
15+16+for dir in /tmp/.ICE-unix /tmp/.X11-unix /tmp/.font-unix ; do
17+ success=0
18+ for attempt in 1 2 3 4 5 ; do
19+ check=`${STAT} -f '%#p %u %g' ${dir} 2> /dev/null`
20+ if [ "${check}" = "041777 0 0" ] ; then
21+ success=1
22+ break
23+ elif [ -n "${check}" ] ; then
24+ saved=$(${MKTEMP} -d ${dir}-XXXXXXXX)
25+ mv ${dir} ${saved}
26+ echo "${dir} exists but is insecure. It has been moved into ${saved}" >&2
27+ fi
28+29+ # if $dir exists and is a symlink (ie protect against a race)
30+ if ${MKTEMP} -d ${dir} >& /dev/null ; then
31+ chmod 1777 $dir
32+ chown root:wheel $dir
33+ success=1
34+ break
35+ fi
36+ done
37+38+ if [ "${success}" -eq 0 ] ; then
39+ echo "Could not successfully create ${dir}" >&2
40+ fi
41+done
42+43+@FONT_CACHE@ -s &
···1+#!/bin/sh
2+3+# vim :set ts=4 sw=4 sts=4 et :
4+5+#
6+# This is just a sample implementation of a slightly less primitive
7+# interface than xinit. It looks for user .xinitrc and .xserverrc
8+# files, then system xinitrc and xserverrc files, else lets xinit choose
9+# its default. The system xinitrc should probably do things like check
10+# for .Xresources files and merge them in, start up a window manager,
11+# and pop a clock and several xterms.
12+#
13+# Site administrators are STRONGLY urged to write nicer versions.
14+#
15+16+unset DBUS_SESSION_BUS_ADDRESS
17+unset SESSION_MANAGER
18+19+20+# Bourne shell does not automatically export modified environment variables
21+# so export the new PATH just in case the user changes the shell
22+export PATH=@PATH@:$PATH
23+24+export FONTCONFIG_FILE="@FONTCONFIG_FILE@"
25+26+userclientrc=$HOME/.xinitrc
27+sysclientrc=@XINITRC@
28+29+userserverrc=$HOME/.xserverrc
30+sysserverrc=@XINITRC@
31+defaultclient=@DEFAULT_CLIENT@ # xterm
32+defaultserver=@DEFAULT_SERVER@
33+defaultclientargs=""
34+defaultserverargs=""
35+defaultdisplay=":0"
36+clientargs=""
37+serverargs=""
38+39+export X11_PREFS_DOMAIN=org.nixos.xquartz".X11"
40+41+# Initialize defaults (this will cut down on "safe" error messages)
42+if ! /usr/bin/defaults read $X11_PREFS_DOMAIN cache_fonts > /dev/null 2>&1 ; then
43+ /usr/bin/defaults write $X11_PREFS_DOMAIN cache_fonts -bool true
44+fi
45+46+if ! /usr/bin/defaults read $X11_PREFS_DOMAIN no_auth > /dev/null 2>&1 ; then
47+ /usr/bin/defaults write $X11_PREFS_DOMAIN no_auth -bool false
48+fi
49+50+if ! /usr/bin/defaults read $X11_PREFS_DOMAIN nolisten_tcp > /dev/null 2>&1 ; then
51+ /usr/bin/defaults write $X11_PREFS_DOMAIN nolisten_tcp -bool true
52+fi
53+54+# First, start caching fonts
55+if [ x`/usr/bin/defaults read $X11_PREFS_DOMAIN cache_fonts` = x1 ] ; then
56+ @FONT_CACHE@ &
57+fi
58+59+# a race to create /tmp/.X11-unix
60+@PRIVILEGED_STARTX@
61+62+if [ x`/usr/bin/defaults read $X11_PREFS_DOMAIN no_auth` = x0 ] ; then
63+ enable_xauth=1
64+else
65+ enable_xauth=0
66+fi
67+68+if [ x`defaults read $X11_PREFS_DOMAIN nolisten_tcp` = x1 ] ; then
69+ defaultserverargs="$defaultserverargs -nolisten tcp"
70+fi
71+72+# The second check is the real one. The first is to hopefully avoid
73+# needless syslog spamming.
74+if /usr/bin/defaults read $X11_PREFS_DOMAIN 2> /dev/null | grep -q 'dpi' && /usr/bin/defaults read $X11_PREFS_DOMAIN dpi > /dev/null 2>&1 ; then
75+ defaultserverargs="$defaultserverargs -dpi `/usr/bin/defaults read $X11_PREFS_DOMAIN dpi`"
76+fi
77+78+# Automatically determine an unused $DISPLAY
79+d=0
80+while true ; do
81+ [ -e /tmp/.X$d-lock ] || break
82+ d=$(($d + 1))
83+done
84+defaultdisplay=":$d"
85+unset d
86+87+whoseargs="client"
88+while [ x"$1" != x ]; do
89+ case "$1" in
90+ # '' required to prevent cpp from treating "/*" as a C comment.
91+ /''*|\./''*)
92+ if [ "$whoseargs" = "client" ]; then
93+ if [ x"$client" = x ] && [ x"$clientargs" = x ]; then
94+ client="$1"
95+ else
96+ clientargs="$clientargs $1"
97+ fi
98+ else
99+ if [ x"$server" = x ] && [ x"$serverargs" = x ]; then
100+ server="$1"
101+ else
102+ serverargs="$serverargs $1"
103+ fi
104+ fi
105+ ;;
106+ --)
107+ whoseargs="server"
108+ ;;
109+ *)
110+ if [ "$whoseargs" = "client" ]; then
111+ clientargs="$clientargs $1"
112+ else
113+ # display must be the FIRST server argument
114+ if [ x"$serverargs" = x ] && \
115+ expr "$1" : ':[0-9][0-9]*$' > /dev/null 2>&1; then
116+ display="$1"
117+ else
118+ serverargs="$serverargs $1"
119+ fi
120+ fi
121+ ;;
122+ esac
123+ shift
124+done
125+126+# process client arguments
127+if [ x"$client" = x ]; then
128+ client=$defaultclient
129+130+ # For compatibility reasons, only use startxrc if there were no client command line arguments
131+ if [ x"$clientargs" = x ]; then
132+ if [ -f "$userclientrc" ]; then
133+ client=$userclientrc
134+ elif [ -f "$sysclientrc" ]; then
135+ client=$sysclientrc
136+ fi
137+ fi
138+fi
139+140+# if no client arguments, use defaults
141+if [ x"$clientargs" = x ]; then
142+ clientargs=$defaultclientargs
143+fi
144+145+# process server arguments
146+if [ x"$server" = x ]; then
147+ server=$defaultserver
148+149+ # For compatibility reasons, only use xserverrc if there were no server command line arguments
150+ if [ x"$serverargs" = x -a x"$display" = x ]; then
151+ if [ -f "$userserverrc" ]; then
152+ server=$userserverrc
153+ elif [ -f "$sysserverrc" ]; then
154+ server=$sysserverrc
155+ fi
156+ fi
157+fi
158+159+# if no server arguments, use defaults
160+if [ x"$serverargs" = x ]; then
161+ serverargs=$defaultserverargs
162+fi
163+164+# if no display, use default
165+if [ x"$display" = x ]; then
166+ display=$defaultdisplay
167+fi
168+169+if [ x"$enable_xauth" = x1 ] ; then
170+ if [ x"$XAUTHORITY" = x ]; then
171+ XAUTHORITY=$HOME/.Xauthority
172+ export XAUTHORITY
173+ fi
174+175+ removelist=
176+177+ # set up default Xauth info for this machine
178+ hostname=`/bin/hostname`
179+180+ authdisplay=${display:-:0}
181+182+ mcookie=`/usr/bin/openssl rand -hex 16`
183+184+ if test x"$mcookie" = x; then
185+ echo "Couldn't create cookie"
186+ exit 1
187+ fi
188+ dummy=0
189+190+ # create a file with auth information for the server. ':0' is a dummy.
191+ xserverauthfile=$HOME/.serverauth.$$
192+ trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP KILL BUS TERM
193+ @XAUTH@ -q -f "$xserverauthfile" << EOF
194+add :$dummy . $mcookie
195+EOF
196+197+ xserverauthfilequoted=$(echo ${xserverauthfile} | sed "s/'/'\\\\''/g")
198+ serverargs=${serverargs}" -auth '"${xserverauthfilequoted}"'"
199+200+ # now add the same credentials to the client authority file
201+ # if '$displayname' already exists do not overwrite it as another
202+ # server man need it. Add them to the '$xserverauthfile' instead.
203+ for displayname in $authdisplay $hostname$authdisplay; do
204+ authcookie=`@XAUTH@ list "$displayname" \
205+ | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p"` 2>/dev/null;
206+ if [ "z${authcookie}" = "z" ] ; then
207+ @XAUTH@ -q << EOF
208+add $displayname . $mcookie
209+EOF
210+ removelist="$displayname $removelist"
211+ else
212+ dummy=$(($dummy+1));
213+ @XAUTH@ -q -f "$xserverauthfile" << EOF
214+add :$dummy . $authcookie
215+EOF
216+ fi
217+ done
218+fi
219+220+eval @XINIT@ \"$client\" $clientargs -- \"$server\" $display $serverargs "-xkbdir" "@XKEYBOARD_CONFIG@"
221+retval=$?
222+223+if [ x"$enable_xauth" = x1 ] ; then
224+ if [ x"$removelist" != x ]; then
225+ @XAUTH@ remove $removelist
226+ fi
227+ if [ x"$xserverauthfile" != x ]; then
228+ rm -f "$xserverauthfile"
229+ fi
230+fi
231+232+exit $retval
+36
pkgs/servers/x11/xquartz/system-fonts.nix
···000000000000000000000000000000000000
···1+{ stdenv, xorg, fontDirs }:
2+3+stdenv.mkDerivation {
4+ name = "xquartz-system-fonts";
5+ buildInputs = [
6+ xorg.mkfontdir xorg.mkfontscale
7+ ];
8+ buildCommand = ''
9+ source $stdenv/setup
10+11+ for i in ${toString fontDirs} ; do
12+ if [ -d $i/ ]; then
13+ list="$list $i";
14+ fi;
15+ done
16+ list=$(find $list -name fonts.dir -o -name '*.ttf' -o -name '*.otf');
17+ fontDirs=''';
18+ for i in $list ; do
19+ fontDirs="$fontDirs $(dirname $i)";
20+ done;
21+ mkdir -p $out/share/X11-fonts/;
22+ find $fontDirs -type f -o -type l | while read i; do
23+ j="''${i##*/}"
24+ if ! test -e "$out/share/X11-fonts/''${j}"; then
25+ ln -s "$i" "$out/share/X11-fonts/''${j}";
26+ fi;
27+ done;
28+ cd $out/share/X11-fonts/
29+ rm fonts.dir
30+ rm fonts.scale
31+ rm fonts.alias
32+ mkfontdir
33+ mkfontscale
34+ cat $( find ${xorg.fontalias}/ -name fonts.alias) >fonts.alias
35+ '';
36+}
+40
pkgs/servers/x11/xquartz/xinitrc
···0000000000000000000000000000000000000000
···1+#!/bin/sh
2+3+export PATH=@PATH@:$PATH
4+5+userresources=$HOME/.Xresources
6+usermodmap=$HOME/.Xmodmap
7+8+# Fix ridiculously slow key repeat.
9+@XSET@ r rate
10+11+# merge in defaults and keymaps
12+13+if [ -f "$userresources" ]; then
14+ if [ -x /usr/bin/cpp ] ; then
15+ @XRDB@ -merge "$userresources"
16+ else
17+ @XRDB@ -nocpp -merge "$userresources"
18+ fi
19+fi
20+21+if [ -f "$usermodmap" ]; then
22+ @XMODMAP@ "$usermodmap"
23+fi
24+25+fontpath="@SYSTEM_FONTS@"
26+[ -e "$HOME"/.fonts/fonts.dir ] && fontpath="$fontpath,$HOME/.fonts"
27+[ -e "$HOME"/Library/Fonts/fonts.dir ] && fontpath="$fontpath,$HOME/Library/Fonts"
28+[ -e /Library/Fonts/fonts.dir ] && fontpath="$fontpath,/Library/Fonts"
29+[ -e /System/Library/Fonts/fonts.dir ] && fontpath="$fontpath,/System/Library/Fonts"
30+@XSET@ fp= "$fontpath"
31+unset fontpath
32+33+if [ -d "${HOME}/.xinitrc.d" ] ; then
34+ for f in "${HOME}"/.xinitrc.d/*.sh ; do
35+ [ -x "$f" ] && . "$f"
36+ done
37+ unset f
38+fi
39+40+exec @QUARTZ_WM@
+21-20
pkgs/top-level/all-packages.nix
···164165 ### Symbolic names.
166167- x11 = if stdenv.isDarwin then darwinX11AndOpenGL else xlibsWrapper;
168169 # `xlibs' is the set of X library components. This used to be the
170 # old modular X llibraries project (called `xlibs') but now it's just
···45484549 freealut = callPackage ../development/libraries/freealut { };
45504551- freeglut = if stdenv.isDarwin then darwinX11AndOpenGL else
4552- callPackage ../development/libraries/freeglut { };
45534554 freetype = callPackage ../development/libraries/freetype { };
4555···56665667 mesaSupported = lib.elem system lib.platforms.mesaPlatforms;
56685669- mesa_original = callPackage ../development/libraries/mesa {
0005670 # makes it slower, but during runtime we link against just mesa_drivers
5671 # through /run/opengl-driver*, which is overriden according to config.grsecurity
5672 grsecEnabled = true;
5673- };
5674-5675- mesa_noglu = if stdenv.isDarwin
5676- then darwinX11AndOpenGL // { driverLink = mesa_noglu; }
5677- else mesa_original;
5678 mesa_drivers = let
5679- mo = mesa_original.override { grsecEnabled = config.grsecurity or false; };
5680 in mo.drivers;
5681- mesa_glu = callPackage ../development/libraries/mesa-glu { };
5682- mesa = if stdenv.isDarwin then darwinX11AndOpenGL
5683- else buildEnv {
5684- name = "mesa-${mesa_noglu.version}";
5685- paths = [ mesa_glu mesa_noglu ];
5686- };
5687- darwinX11AndOpenGL = callPackage ../os-specific/darwin/native-x11-and-opengl { };
56885689 metaEnvironment = recurseIntoAttrs (let callPackage = newScope pkgs.metaEnvironment; in rec {
5690 sdfLibrary = callPackage ../development/libraries/sdf-library { aterm = aterm28; };
···70127013 xinetd = callPackage ../servers/xinetd { };
70140007015 xorg = recurseIntoAttrs (import ../servers/x11/xorg/default.nix {
7016- inherit fetchurl fetchgit fetchpatch stdenv pkgconfig intltool freetype fontconfig
7017- libxslt expat libdrm libpng zlib perl mesa_drivers
7018 dbus libuuid openssl gperf m4
7019- autoconf automake libtool xmlto asciidoc udev flex bison python mtdev pixman;
7020 mesa = mesa_noglu;
007021 } // {
7022 xf86videointel-testing = callPackage ../servers/x11/xorg/xf86-video-intel-testing.nix { };
7023 });
···164165 ### Symbolic names.
166167+ x11 = xlibsWrapper;
168169 # `xlibs' is the set of X library components. This used to be the
170 # old modular X llibraries project (called `xlibs') but now it's just
···45484549 freealut = callPackage ../development/libraries/freealut { };
45504551+ freeglut = callPackage ../development/libraries/freeglut { };
045524553 freetype = callPackage ../development/libraries/freetype { };
4554···56655666 mesaSupported = lib.elem system lib.platforms.mesaPlatforms;
56675668+ mesaDarwinOr = alternative: if stdenv.isDarwin
5669+ then callPackage ../development/libraries/mesa-darwin { }
5670+ else alternative;
5671+ mesa_noglu = mesaDarwinOr (callPackage ../development/libraries/mesa {
5672 # makes it slower, but during runtime we link against just mesa_drivers
5673 # through /run/opengl-driver*, which is overriden according to config.grsecurity
5674 grsecEnabled = true;
5675+ });
5676+ mesa_glu = mesaDarwinOr (callPackage ../development/libraries/mesa-glu { });
0005677 mesa_drivers = let
5678+ mo = mesa_noglu.override { grsecEnabled = config.grsecurity or false; };
5679 in mo.drivers;
5680+ mesa = mesaDarwinOr (buildEnv {
5681+ name = "mesa-${mesa_noglu.version}";
5682+ paths = [ mesa_noglu mesa_glu ];
5683+ });
00056845685 metaEnvironment = recurseIntoAttrs (let callPackage = newScope pkgs.metaEnvironment; in rec {
5686 sdfLibrary = callPackage ../development/libraries/sdf-library { aterm = aterm28; };
···70087009 xinetd = callPackage ../servers/xinetd { };
70107011+ xquartz = callPackage ../servers/x11/xquartz { };
7012+ quartz-wm = callPackage ../servers/x11/quartz-wm { stdenv = clangStdenv; };
7013+7014 xorg = recurseIntoAttrs (import ../servers/x11/xorg/default.nix {
7015+ inherit clangStdenv fetchurl fetchgit fetchpatch stdenv pkgconfig intltool freetype fontconfig
7016+ libxslt expat libpng zlib perl mesa_drivers
7017 dbus libuuid openssl gperf m4
7018+ autoconf automake libtool xmlto asciidoc flex bison python mtdev pixman;
7019 mesa = mesa_noglu;
7020+ udev = if stdenv.isLinux then udev else null;
7021+ libdrm = if stdenv.isLinux then libdrm else null;
7022 } // {
7023 xf86videointel-testing = callPackage ../servers/x11/xorg/xf86-video-intel-testing.nix { };
7024 });