mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-24 03:00:30 +01:00
egl: Handle dri configs with floating point pixel data
In the case that __DRI_ATTRIB_FLOAT_BIT is set in the dri config, set EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT in the egl config. Add a field to the platform driver visual to indicate if it has components that are in floating point form. Signed-off-by: Kevin Strasser <kevin.strasser@intel.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
parent
86d31c2c12
commit
482ed4347d
4 changed files with 30 additions and 2 deletions
|
|
@ -239,6 +239,17 @@ dri2_get_shifts_and_sizes(const __DRIcoreExtension *core,
|
|||
core->getConfigAttrib(config, __DRI_ATTRIB_ALPHA_SIZE, &sizes[3]);
|
||||
}
|
||||
|
||||
void
|
||||
dri2_get_render_type_float(const __DRIcoreExtension *core,
|
||||
const __DRIconfig *config,
|
||||
bool *is_float)
|
||||
{
|
||||
unsigned int render_type;
|
||||
|
||||
core->getConfigAttrib(config, __DRI_ATTRIB_RENDER_TYPE, &render_type);
|
||||
*is_float = (render_type & __DRI_ATTRIB_FLOAT_BIT) ? true : false;
|
||||
}
|
||||
|
||||
struct dri2_egl_config *
|
||||
dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
|
||||
EGLint surface_type, const EGLint *attr_list,
|
||||
|
|
@ -268,6 +279,9 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
|
|||
|
||||
switch (attrib) {
|
||||
case __DRI_ATTRIB_RENDER_TYPE:
|
||||
if (value & __DRI_ATTRIB_FLOAT_BIT)
|
||||
_eglSetConfigKey(&base, EGL_COLOR_COMPONENT_TYPE_EXT,
|
||||
EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT);
|
||||
if (value & __DRI_ATTRIB_RGBA_BIT)
|
||||
value = EGL_RGB_BUFFER;
|
||||
else if (value & __DRI_ATTRIB_LUMINANCE_BIT)
|
||||
|
|
|
|||
|
|
@ -409,6 +409,11 @@ dri2_get_shifts_and_sizes(const __DRIcoreExtension *core,
|
|||
const __DRIconfig *config, int *shifts,
|
||||
unsigned int *sizes);
|
||||
|
||||
void
|
||||
dri2_get_render_type_float(const __DRIcoreExtension *core,
|
||||
const __DRIconfig *config,
|
||||
bool *is_float);
|
||||
|
||||
struct dri2_egl_config *
|
||||
dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
|
||||
EGLint surface_type, const EGLint *attr_list,
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ dri2_drm_config_is_compatible(struct dri2_egl_display *dri2_dpy,
|
|||
const struct gbm_dri_visual *visual = NULL;
|
||||
int shifts[4];
|
||||
unsigned int sizes[4];
|
||||
bool is_float;
|
||||
int i;
|
||||
|
||||
/* Check that the EGLConfig being used to render to the surface is
|
||||
|
|
@ -107,6 +108,8 @@ dri2_drm_config_is_compatible(struct dri2_egl_display *dri2_dpy,
|
|||
*/
|
||||
dri2_get_shifts_and_sizes(dri2_dpy->core, config, shifts, sizes);
|
||||
|
||||
dri2_get_render_type_float(dri2_dpy->core, config, &is_float);
|
||||
|
||||
for (i = 0; i < dri2_dpy->gbm_dri->num_visuals; i++) {
|
||||
visual = &dri2_dpy->gbm_dri->visual_table[i];
|
||||
if (visual->gbm_format == surface->format)
|
||||
|
|
@ -123,7 +126,8 @@ dri2_drm_config_is_compatible(struct dri2_egl_display *dri2_dpy,
|
|||
sizes[0] != visual->rgba_sizes.red ||
|
||||
sizes[1] != visual->rgba_sizes.green ||
|
||||
sizes[2] != visual->rgba_sizes.blue ||
|
||||
(sizes[3] > 0 && sizes[3] != visual->rgba_sizes.alpha)) {
|
||||
(sizes[3] > 0 && sizes[3] != visual->rgba_sizes.alpha) ||
|
||||
is_float != visual->is_float) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -617,9 +621,12 @@ drm_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *disp)
|
|||
const __DRIconfig *config = dri2_dpy->driver_configs[i];
|
||||
int shifts[4];
|
||||
unsigned int sizes[4];
|
||||
bool is_float;
|
||||
|
||||
dri2_get_shifts_and_sizes(dri2_dpy->core, config, shifts, sizes);
|
||||
|
||||
dri2_get_render_type_float(dri2_dpy->core, config, &is_float);
|
||||
|
||||
for (unsigned j = 0; j < num_visuals; j++) {
|
||||
struct dri2_egl_config *dri2_conf;
|
||||
|
||||
|
|
@ -630,7 +637,8 @@ drm_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *disp)
|
|||
visuals[j].rgba_sizes.red != sizes[0] ||
|
||||
visuals[j].rgba_sizes.green != sizes[1] ||
|
||||
visuals[j].rgba_sizes.blue != sizes[2] ||
|
||||
visuals[j].rgba_sizes.alpha != sizes[3])
|
||||
visuals[j].rgba_sizes.alpha != sizes[3] ||
|
||||
visuals[j].is_float != is_float)
|
||||
continue;
|
||||
|
||||
const EGLint attr_list[] = {
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ struct gbm_dri_visual {
|
|||
unsigned int blue;
|
||||
unsigned int alpha;
|
||||
} rgba_sizes;
|
||||
bool is_float;
|
||||
};
|
||||
|
||||
struct gbm_dri_device {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue