Native surface creation

Brian Paul brian.paul at tungstengraphics.com
Tue Mar 15 06:11:25 PST 2005


Jon Smirl wrote:
> On Mon, 14 Mar 2005 09:03:45 -0700, Brian Paul
> <brian.paul at tungstengraphics.com> wrote:
> 
>>It's clear that you're working at a lower level of implementation
>>detail than I am in trying to specify an EGL API extension.
> 
> 
> I'm working right at the hardware implementing the modesetting.
> 
> A major thing being fixed is to allow normal users to set modes
> without being root. Writing arbitrary modelines let you burn up
> monitors so it has to be a root operation. To get around the need to
> be root a fixed list of modes is exposed and you have to choose from
> the list.

Right.


> Right now the interface for this is very human readable in sysfs:
> cat /sys/class/graphics/fb0/modes  --- list of mode names in human readable form
> echo name >/sys/class/graphics/fb0/mode -- set one of the modes from the list
> 
> This is in current linus bk and it works with fbcon but it isn't
> machine friendly, it relies on the human to know what the mode names
> mean.
> 
> I could alter the attributes to work like this:
> 
> echo "width=1000, height=800, depth=32" >/sys/class/graphics/fb0/mode
> would pick the closest mode and set it
> 
> echo "HDTV 1080i" >/sys/class/graphics/fb0/mode
> would search the names since there is no equal sign.
> 
> cat /sys/class/graphics/fb0/mode
> name="HDTV 720P", width=1024, height=720, depth=32, interlace=no, refresh=60
> 
> cat /sys/class/graphics/fb0/modes -- read only
> name="v:1024x768", width=1024, height=768, depth=32, interlace=no, refresh=60
> name="HDTV 720P", width=1024, height=720, depth=32, interlace=no, refresh=60
> name="HDTV 1080i", width=1280, height=1080, depth=32, interlace=yes, refresh=60
> 
> I'll also change the root priv attribute that builds the mode list to
> take in attribute/value pairs but egl can't change the list.

Can't there be a query in which you pass in a mode name (ex: "HDTV 
1080i") and an attribute to query (ex: "height") and are returned the 
value (ex: "1080")?


>>typedef unsigned int EGLMode;
>>
>>EGLBoolean eglChooseMode(EGLDisplay dpy, const EGLint *attrib_list,
>>EGLMode *modes, EGLint modes_size, EGLint *num_modes);
> 
> translates to 
> open("/sys/class/graphics/fb0/mode")
> write("width=1000, height=800, depth=32");
> close()

Let's make sure you understand you eglChooseMode() is intended to 
work.  eglChooseMode() does not set the current mode, it searches the 
list of available modes for the one that best matches the requested 
attributes in attrib_list.  Just like eglChooseConfig().


>>EGLBoolean eglGetModes(EGLDisplay dpy, EGLint screen_number, EGLMode
>>*modes, EGLint modes_size, EGLint *num_modes);
> 
> translates to 
> open("/sys/class/graphics/fb0/modes")
> read()
> close()
> 
>>EGLBoolean eglGetModeAttribMESA(EGLDisplay dpy, EGLMode mode, EGLint
>>attribute, EGLint *value);
> 
> 
> I can only do this for the currently active mode.

That's a problem.  The EGL library needs to be able to query the 
attributes of modes, without setting the mode first.


> Note that the list of modes can change due to a monitor hotplug. This
> will generate a hal/dbus event.

OK.  We'll need a way for EGL applications to detect this, but I'd 
like to set that aside for now.

-Brian


More information about the dri-egl mailing list