st/egl: Add get_param to native display interface.

get_param can be used to query the parameters of a native display.
There is only NATIVE_PARAM_USE_NATIVE_BUFFER right now.  It queries
whether the window/pixmap surfaces use the native buffers instead of
private buffers.
This commit is contained in:
Chia-I Wu
2010-03-05 11:00:15 +08:00
parent 89a75b7634
commit fade8a6eb6
4 changed files with 72 additions and 0 deletions

View File

@@ -49,6 +49,14 @@ enum native_attachment {
NUM_NATIVE_ATTACHMENTS
};
enum native_param_type {
/*
* Return TRUE if window/pixmap surfaces use the buffers of the native
* types.
*/
NATIVE_PARAM_USE_NATIVE_BUFFER
};
/**
* Enumerations for probe results.
*/
@@ -145,6 +153,14 @@ struct native_display {
void (*destroy)(struct native_display *ndpy);
/**
* Query the parameters of the native display.
*
* The return value is defined by the parameter.
*/
int (*get_param)(struct native_display *ndpy,
enum native_param_type param);
/**
* Get the supported configs. The configs are owned by the display, but
* the returned array should be free()ed.

View File

@@ -665,6 +665,21 @@ kms_display_get_configs(struct native_display *ndpy, int *num_configs)
return configs;
}
static int
kms_display_get_param(struct native_display *ndpy,
enum native_param_type param)
{
int val;
switch (param) {
default:
val = 0;
break;
}
return val;
}
static void
kms_display_destroy(struct native_display *ndpy)
{
@@ -811,6 +826,7 @@ kms_create_display(EGLNativeDisplayType dpy,
}
kdpy->base.destroy = kms_display_destroy;
kdpy->base.get_param = kms_display_get_param;
kdpy->base.get_configs = kms_display_get_configs;
kdpy->base.create_pbuffer_surface = kms_display_create_pbuffer_surface;

View File

@@ -707,6 +707,25 @@ dri2_display_is_pixmap_supported(struct native_display *ndpy,
return (depth == nconf_depth || (depth == 24 && depth + 8 == nconf_depth));
}
static int
dri2_display_get_param(struct native_display *ndpy,
enum native_param_type param)
{
int val;
switch (param) {
case NATIVE_PARAM_USE_NATIVE_BUFFER:
/* DRI2GetBuffers use the native buffers */
val = TRUE;
break;
default:
val = 0;
break;
}
return val;
}
static void
dri2_display_destroy(struct native_display *ndpy)
{
@@ -850,6 +869,7 @@ x11_create_dri2_display(EGLNativeDisplayType dpy,
}
dri2dpy->base.destroy = dri2_display_destroy;
dri2dpy->base.get_param = dri2_display_get_param;
dri2dpy->base.get_configs = dri2_display_get_configs;
dri2dpy->base.is_pixmap_supported = dri2_display_is_pixmap_supported;
dri2dpy->base.create_window_surface = dri2_display_create_window_surface;

View File

@@ -699,6 +699,25 @@ ximage_display_is_pixmap_supported(struct native_display *ndpy,
return (fmt == nconf->color_format);
}
static int
ximage_display_get_param(struct native_display *ndpy,
enum native_param_type param)
{
int val;
switch (param) {
case NATIVE_PARAM_USE_NATIVE_BUFFER:
/* private buffers are allocated */
val = FALSE;
break;
default:
val = 0;
break;
}
return val;
}
static void
ximage_display_destroy(struct native_display *ndpy)
{
@@ -753,6 +772,7 @@ x11_create_ximage_display(EGLNativeDisplayType dpy,
xdpy->base.screen = softpipe_create_screen(xdpy->winsys);
xdpy->base.destroy = ximage_display_destroy;
xdpy->base.get_param = ximage_display_get_param;
xdpy->base.get_configs = ximage_display_get_configs;
xdpy->base.is_pixmap_supported = ximage_display_is_pixmap_supported;