[Mesa-dev] [PATCH mesa] gbm: give a name to rgba fields
Eric Engestrom
eric.engestrom at imgtec.com
Mon Mar 5 14:40:56 UTC 2018
Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
---
Note: `gbm_dri_visuals_table` doesn't need any modification, as the
channel order doesn't change, so `rgba_mask = { r, g, b, a }` still
works.
---
src/egl/drivers/dri2/platform_drm.c | 16 ++++++++--------
src/gbm/backends/dri/gbm_driint.h | 7 ++++++-
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 0121e1fc27dfe14fd9c7..fe1138441617a7ab5785 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -118,10 +118,10 @@ dri2_drm_config_is_compatible(struct dri2_egl_display *dri2_dpy,
if (i == dri2_dpy->gbm_dri->num_visuals)
return false;
- if (red != visual->rgba_masks[0] ||
- green != visual->rgba_masks[1] ||
- blue != visual->rgba_masks[2] ||
- (alpha && visual->rgba_masks[3] && alpha != visual->rgba_masks[3])) {
+ if (red != visual->rgba_masks.red ||
+ green != visual->rgba_masks.green ||
+ blue != visual->rgba_masks.blue ||
+ (alpha && visual->rgba_masks.alpha && alpha != visual->rgba_masks.alpha)) {
return false;
}
@@ -638,10 +638,10 @@ drm_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *disp)
for (unsigned j = 0; j < num_visuals; j++) {
struct dri2_egl_config *dri2_conf;
- if (visuals[j].rgba_masks[0] != red ||
- visuals[j].rgba_masks[1] != green ||
- visuals[j].rgba_masks[2] != blue ||
- visuals[j].rgba_masks[3] != alpha)
+ if (visuals[j].rgba_masks.red != red ||
+ visuals[j].rgba_masks.green != green ||
+ visuals[j].rgba_masks.blue != blue ||
+ visuals[j].rgba_masks.alpha != alpha)
continue;
const EGLint attr_list[] = {
diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h
index 84a98533c7946b986d1f..8497be3e8f6dd976838a 100644
--- a/src/gbm/backends/dri/gbm_driint.h
+++ b/src/gbm/backends/dri/gbm_driint.h
@@ -43,7 +43,12 @@ struct gbm_dri_bo;
struct gbm_dri_visual {
uint32_t gbm_format;
int dri_image_format;
- uint32_t rgba_masks[4];
+ struct {
+ uint32_t red;
+ uint32_t green;
+ uint32_t blue;
+ uint32_t alpha;
+ } rgba_masks;
};
struct gbm_dri_device {
--
Cheers,
Eric
More information about the mesa-dev
mailing list