diff options
author | Kevin Strasser <[email protected]> | 2019-01-24 16:55:33 -0800 |
---|---|---|
committer | Adam Jackson <[email protected]> | 2019-08-21 18:36:57 +0000 |
commit | 482ed4347d2c672423fcc4659cb20aee19dad7fd (patch) | |
tree | 265c939f1a8b2cb400ca0d6a0c79eade2817d7fa /src | |
parent | 86d31c2c120c458a8df99921ba49773f9e44651a (diff) |
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 <[email protected]>
Reviewed-by: Adam Jackson <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.c | 14 | ||||
-rw-r--r-- | src/egl/drivers/dri2/egl_dri2.h | 5 | ||||
-rw-r--r-- | src/egl/drivers/dri2/platform_drm.c | 12 | ||||
-rw-r--r-- | src/gbm/backends/dri/gbm_driint.h | 1 |
4 files changed, 30 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 56ebcb7c403..a7c0f33f948 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -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) diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 5a148f12118..2a8307ab321 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -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, diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 56b8e59d2c5..f2491054fe6 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -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[] = { diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h index 75299bdb846..a8bfa39e522 100644 --- a/src/gbm/backends/dri/gbm_driint.h +++ b/src/gbm/backends/dri/gbm_driint.h @@ -55,6 +55,7 @@ struct gbm_dri_visual { unsigned int blue; unsigned int alpha; } rgba_sizes; + bool is_float; }; struct gbm_dri_device { |