Path: blob/21.2-virgl/docs/_extra/specs/OLD/EGL_MESA_screen_surface.txt
4574 views
Name12MESA_screen_surface34Name Strings56EGL_MESA_screen_surface78Contact910Brian Paul1112To discuss, join the [email protected] list.1314Status1516Obsolete.1718Version192011 (27 January 2006)2122Number2324TBD2526Dependencies2728EGL 1.0 or later.2930Overview3132EGL 1.1 supports three types of drawing surfaces:33* Window surfaces34* Pixmap surfaces35* Pbuffer surfaces36This extension defines a fourth type of drawing surface:37* Screen surface3839A screen surface is a surface for which the (front) color buffer can40be directly displayed (i.e. scanned out) on a monitor (such as a flat41panel or CRT). In particular the color buffer memory will be allocated42at a location in VRAM (and in a suitable format) which can be displayed43by the graphics hardware.4445Note that the width and height of the screen surface need not exactly46match the monitor's current resolution. For example, while the monitor47may be configured to to show 1024x768 pixels, the associated screen48surface may be larger, such as 1200x1000. The "screen origin" attribute49will specify which region of the screen surface which is visible on the50monitor. The screen surface can be scrolled by changing this origin.5152This extension also defines functions for controlling the monitor's53display mode (width, height, refresh rate, etc), and specifing which54screen surface is to be displayed on a monitor.5556The new EGLModeMESA type and related functions are very similar to the57EGLConfig type and related functions. The user may get a list of58supported modes for a screen and specify the mode to be used when59displaying a screen surface.606162Issues63641. Should EGL_INTERLACE be a supported mode attribute?6566Arguments against:6768No, this should be provided by another extension which would69also provide the mechanisms needed to play back interlaced video70material correctly on hardware that supports it.71This extension should prefer non-interlaced modes. [M. Danzer]7273Arguments for:7475An interlaced display can be of use without considering video76material. Being able to query whether a screen is operating in77interlaced mode can be used by applications to control their78drawing. For example: avoid drawing 1-pixel-wide horizontal lines79if screen is interlaced. [B. Paul]8081Resolution: Defer for future extension?8283842. Should EGL_REFRESH_RATE be a supported mode attribute?8586Arguments for:8788Yes, it's been shown that applications and/or users need to select89modes by this. [M. Danzer]9091Many examples have been given in which it's desirable to let the92user choose from a variety of refresh rates without having to93restart/reconfigure. [B. Paul]9495Arguments against:9697TBD.9899Resolution: Yes.1001011023. Exactly how should the list of modes returned by eglChooseConfigMESA103be sorted?104105Current method is described in the text below. Subject to change.106107Alternately, leave the sorting order undefined so that each108implementation can return the modes in order of "most desirable"109to "least desirable" which may depend on the display technology110(CRT vs LCD, etc) or other factors.1111121134. How should screen blanking be supported? Note that a screen can be114disabled or turned off by calling eglShowSurface(dpy, scrn,115EGL_NO_SURFACE, EGL_NO_MODE_MESA). But what about power-save mode?116117I would defer this to other extensions that depend on this one.118I can imagine people wanting different semantics not just in119relation to the power management API being exposed (DPMS or whatever)120but also relating to what events can trigger EGL_CONTEXT_LOST. Also121I'm not sure whether power management commands are properly operations122on the Display or on a screen surface. [A. Jackson]1231241255. Should the EGL_PHYSICAL_SIZE_EGL query be kept? The size information126isn't always reliable (consider video projectors) but can still be127used to determine the pixel aspect ratio.128129Resolution: Omit. The EGL 1.2 specification includes queries for130the display resolution and pixel aspect ratio.1311321336. Should detailed mode timing information be exposed by this API?134135Probably not. Instead, offer that information in a layered extension.1361371387. How should the notion of a screen's "native" mode be expressed?139For example, LCD panels have a native resolution and refresh rate140that looks best but other sub-optimal resolutions may be supported.141142The mode attribute EGL_OPTIMAL_MESA will be set for modes which143best match the screen. [M. Danzer]1441451468. Should eglQueryModeStringMESA() be included? This function returns147a human-readable string which corresponds to an EGLMode.148149Arguments for:150151A mode name such as "HDTV-720P" might mean more to users than152"1280x720@60Hz" if the later were generated via code.153154Arguments against:155156There's no standard syntax for the strings. May cause more157trouble than it's worth.158159Postpone for future extension. [A. Jackson]160161Latest discussion leaning toward omitting this function.1621631649. Should we use "Get" or "Query" for functions which return state?165The EGL 1.x specification doesn't seem to be totally consistent166in this regard, but "Query" is used more often.167168Use "Get" for mode-related queries (as for EGLConfigs) but "Query"169for everything else.17017117210. What should be the default size for screen surfaces?173174For Pbuffer surfaces the default width and height are zero.175We'll do the same for screen surfaces. Since there's no function176to resize surfaces it's useless to have a 0x0 screen, but this isn't177a situation that'll normally be encountered.17817918011. Should there be a function for resizing a screen surface?181182Suppose one wants to change the screen's size in the EGL application.183Also suppose there's a hardware restriction such that only one screen184surface can exist at a time (either for lack of memory or because of185memory layout restrictions).186187The basic idea is that the currently displayed screen surface must188be deallocated before a new one can be created. Perhaps a resize189function would work better?19019119212. How should sub-pixel LCD color information be made available?193What about the display's gamma value?194195Perhaps expose as additional read-only mode attributes.196197Perhaps postpone for a layered extension.19819920013. What happens if the user attempts to delete a screen surface that201is currently being shown?202203Spec currently says that's illegal and that an error (TBD) will be204generated.20520620714. What if the physical screen size can't be determined? Should208a query of EGL_PHYSICAL_SIZE_MESA return [0,0]?209210Obsolete: EGL_PHYSICAL_SIZE_MESA not used.21121221315. Suppose the device's number of RAMDACs is different from the214number of output ports. For example, a graphics card with215two RAMDACs but three ports (VGA, DVI, TV).216217Address this in a follow-on extension. [Matthias Hopf]21821922016. How should we deal with on-the-fly device changes? For example,221the monitor being unplugged and replaced by another with different222characteristics?223224A HAL event could be received via DBUS in the application [J. Smirl,225A. Jackson].226227Should there be an EGL mechanism for detecting this? Maybe an228EGL_SCREEN_LOST error (similar to EGL_CONTEXT_LOST) can be recorded229when there's a screen change. At least then the application can230poll to detect this situation.231232Maybe leave that to a future extension.233234See also the EGL_SCREEN_COUNT_MESA query.23523623717. What if pixel-accurate panning is not supported (see238eglScreenPositionMESA)? [M. Danzer]239240Is this a common problem? Can we ignore it for now?24124224318. Should eglShowSurfaceMESA be renamed to eglShowScreenSurfaceMESA?244245Probably.246247248249New Procedures and Functions250251EGLBoolean eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen,252const EGLint *attrib_list,253EGLModeMESA *modes, EGLint modes_size,254EGLint *num_modes)255256EGLBoolean eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen,257EGLModeMESA *modes, EGLint modes_size,258EGLint *num_modes)259260EGLBoolean eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode,261EGLint attrib, EGLint *value)262263264EGLBoolean eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens,265EGLint screens_size, EGLint *num_screens)266267EGLSurface eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config,268const EGLint *attrib_list)269270EGLBoolean eglShowSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen,271EGLSurface surface, EGLModeMESA mode)272273EGLBoolean eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen,274EGLint x, EGLint y)275276277EGLBoolean eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen,278EGLint attrib, EGLint *value);279280EGLBoolean eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen,281EGLSurface *surface)282283EGLBoolean eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen,284EGLModeMESA *mode)285286const char *eglQueryModeStringMESA(EGLDisplay dpy, EGLMode mode);287288289New Types290291EGLModeMESA292EGLScreenMESA293294New Tokens295296New error codes:297298EGL_BAD_SCREEN_MESA299EGL_BAD_MODE_MESA300301Screen-related tokens:302303EGL_SCREEN_COUNT_MESA304EGL_SCREEN_POSITION_MESA305EGL_SCREEN_BIT_MESA306EGL_SCREEN_POSITION_GRANULARITY_MESA307308Mode-related tokens:309310EGL_MODE_ID_MESA311EGL_REFRESH_RATE_MESA312EGL_INTERLACED_MESA313EGL_OPTIMAL_MESA314EGL_NO_MODE_MESA315316317Additions to Chapter X of the EGL 1.1 Specification318319[XXX this all has to be rewritten to fit into the EGL specification320and match the conventions of an EGL extension. For now, just list321all the functions with brief descriptions.]322323324EGLBoolean eglChooseModeMESA(EGLDisplay dpy, const EGLScreenMESA screen,325EGLint *attrib_list, EGLModeMESA *modes,326EGLint modes_size, EGLint *num_modes)327328Like eglChooseConfig, returns a list of EGLModes which match the given329attribute list. This does not set the screen's current display mode.330The attribute list is a list of token/value pairs terminated with331EGL_NONE. Supported attributes include:332333Name Description334--------------------- ---------------------------------------------335EGL_WIDTH Mode width (resolution)336EGL_HEIGHT Mode height (resolution)337EGL_REFRESH_RATE_MESA The mode's refresh rate, multiplied by 1000338EGL_INTERLACED_MESA 1 indicates an interlaced mode, 0 otherwise339EGL_OPTIMAL_MESA Set if the most is especially optimal for the340screen (ex. for particular LCD resolutions)341342Any other token will generate the error EGL_BAD_ATTRIBUTE.343344The list of modes returned by eglChooseModeMESA will be sorted345according to the following criteria. See the discussion of table 3.3346in the EGL specification for more information.347348Selection Sort Sort349Attribute Default Criteria Order Priority350-------------------- -------------- ----------- ------ --------351EGL_OPTIMAL_MESA EGL_DONT_CARE Exact 1,0 1352EGL_INTERLACED_MESA EGL_DONT_CARE Exact 0,1 2353EGL_REFRESH_RATE EGL_DONT_CARE AtLeast Larger 3354EGL_WIDTH EGL_DONT_CARE AtLeast Larger 4355EGL_HEIGHT EGL_DONT_CARE AtLeast Larger 5356EGL_MODE_ID_MESA EGL_DONT_CARE Exact Smaller 6357358359EGLBoolean eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen,360EGLModeMESA *modes, EGLint modes_size,361EGLint *num_modes)362363Like eglGetConfigs, returns a list of all modes supported by the364given screen. The returned modes will be sorted in the same manner365as for eglChooseModeMESA().366367368369EGLBoolean eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode,370EGLint attrib, EGLint *value)371372Used to query mode attributes. The following attributes are supported:373374Name Return value description375--------------------- ----------------------------------------------376EGL_OPTIMAL_MESA 1 indicates an optimal mode, 0 otherwise377EGL_INTERLACED_MESA 1 indicates an interlaced mode, 0 otherwise378EGL_REFRESH_RATE_MESA The mode's refresh rate, multiplied by 1000379EGL_WIDTH Mode width (resolution)380EGL_HEIGHT Mode height (resolution)381EGL_MODE_ID_MESA A unique small integer identifier for the mode382383Any other token will generate the error EGL_BAD_ATTRIBUTE.384385386387EGLBoolean eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens,388EGLint screens_size, EGLint *num_screens)389390This function returns an array of all available screen handles.391<screens_size> is the maximum number of screens to return in the392<screens> array. <num_screens> will return the number of screen handles393placed in the array, even if <screens> is NULL.394395The number of screens and the availability of each may change over396time (hot-plugging). Screen handles will not be reused. When a397screen handle becomes invalid, function calls which reference an398invalid handle will generate EGL_BAD_SCREEN_MESA.399400The first screen handle returned will be considered to be the primary401one.402403404405EGLSurface eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config,406const EGLint *attrib_list)407408Create a surface that can be displayed on a screen. <attrib_list> is409an array of token/value pairs terminated with EGL_NONE. Valid tokens410include:411412Name Description413---------------- --------------------------------414EGL_WIDTH desired surface width in pixels415EGL_HEIGHT desired surface height in pixels416417Any other token will generate the error EGL_BAD_ATTRIBUTE.418The default width and height are zero.419420421422EGLBoolean eglShowSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen,423EGLSurface surface, EGLModeMESA mode)424425This function causes a screen to show the given surface (or more426precisely, the surface's front color buffer) with the given mode.427428If the surface is in any way incompatible with the mode, the error429EGL_BAD_MATCH will be generated, EGL_FALSE will be returned, and the430previous screen state will remain in effect. This might occur when431the bandwidth of the video-out subsystem is exceeded, or if the mode432specifies a width or height that's greater than the width or height433of the surface.434435To disable a screen, the values EGL_NO_SURFACE and EGL_NO_MODE_MESA436be passed as the <surface> and <mode> parameters.437438The values of EGL_SCREEN_POSITION_MESA are clamped to the new valid439range computed from the screen size and surface size. If the new440surface is EGL_NO_SURFACE, EGL_SCREEN_POSITION_MESA is set to [0, 0].441442443Attempting to delete a screen surface which is currently being444displayed will result in the error EGL_BAD_ACCESS being generated.445446447448EGLBoolean eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen,449EGLint x, EGLint y)450451Specifies the origin of the screen's view into the surface, if the452surface is larger than the screen. Valid values for x and y are453[0, surfaceWidth - screenWidth] and [0, surfaceHeight - screenHeight],454respectively.455456The x and y values are also constrained to be integer multiples of the457EGL_SCREEN_POSITION_GRANULARITY_MESA values.458459460461462EGLBoolean eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen,463EGLint attrib, EGLint *value);464465Used to query screen attributes. <attrib> may be one of the following:466467Name Return value description468------------------------ ---------------------------------------------469EGL_SCREEN_POSITION_MESA x, y position of the screen's origin with470respect to the surface. If no surface is471attached to the screen, [0, 0] is returned.472EGL_SCREEN_POSITION_GRANULARITY_MESA473Returns the granularity, in pixels, for474which the screen position is constrained.475476Any other token will generate the error EGL_BAD_ATTRIBUTE.477478479480481EGLBoolean eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen,482EGLSurface *surface)483484Returns the surface currently displayed on the given screen. <surface>485may be EGL_NO_SURFACE if the screen isn't currently showing any surface.486487488489490EGLBoolean eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen,491EGLModeMESA *mode)492493Returns the given screen's current display mode. The mode may be494EGL_NO_MODE_MESA if the screen is currently disabled.495496497498const char *eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode);499500Returns a human-readable string for the given mode. The string is a501zero-terminated C string which the user should not attempt to free.502There is no standard syntax for mode strings. Applications should503not directly rely on mode strings.504505506507Version History5085091. 15 March 2005 - BrianP510Initial version5115122. 16 March 2005 - BrianP513Removed EGL_DEPTH_MESA514Added EGL_PHYSICAL_WIDTH_MESA, EGL_PHYSICAL_HEIGHT_MESA queries515Added EGL_OPTIMAL_MESA for width/height/refresh rate selection516Added possible eglQueryModeStringMESA() function517More details of the new functions explained.5185193. 18 March 2005 - BrianP520Added screen_number to eglChooseModeMESA().521Fix off by one mistake in value range for ORIGIN attributes522Added Issues section5235244. 21 March 2005 - BrianP525Removed eglScreenAttribsMESA().526Added eglScreenPositionMESA() to set screen origin.527Replaced EGL_SCREEN_X/Y_OFFSET_MESA with EGL_SCREEN_POSITION_MESA.528Replaced EGL_PHYSICAL_WIDTH/HEIGHT_MESA with EGL_PHYSICAL_SIZE_MESA.529Use EGL_OPTIMAL_MESA as a new mode attribute. (Michel Danzer)530Added a few more issues.5315325. 6 April 2005 - BrianP533More language for eglGetModeStringMESA().534Added issues 10, 11, 12, 13, 14.535Updated issue 3 discussion about mode sorting.5365376. 22 April 2005 - BrianP538Fixed "LDC" typo.539Added issues 15, 16.540Changed dependency on EGL 1.1 to EGL 1.0541s/EGL_NUM_SCREENS_MESA/EGL_SCREEN_COUNT_MESA/542Added eglQueryDisplayMESA() to New Functions section.543Clarified language for the EGL_SCREEN_COUNT_MESA query.5445457. 29 April 2005 - BrianP546Added EGLScreenMESA type and eglGetScreensMESA() function. [J. Smirl].547Replaced EGLint screen_number parameters with EGLScreenMESA screen.548Added issue 17 (pixel-accurate panning)5495508. 2 May 2005 - BrianP551Removed eglQueryDisplayMESA.552Fixed a few more EGLint -> EGLScreenMESA changes.5535549. 20 May 2005 - BrianP555Fixed a few typos.556Updated some open issues text.55755810. 10 August 2005 - BrianP559Added EGL_SCREEN_POSITION_GRANULARITY_MESA.56056111. 27 January 2006 - BrianP562EGL_PHYSICAL_SIZE_MESA removed since EGL 1.2 has a similar feature.563564565566