[Mesa-dev] [PATCH 06/30] egl/dri2: use dri2_egl_display inline wrapper where possible

Emil Velikov emil.l.velikov at gmail.com
Thu Aug 25 16:18:28 UTC 2016


From: Emil Velikov <emil.velikov at collabora.com>

This way the only places that reference DriverData are the ones that
manipulate it.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 src/egl/drivers/dri2/egl_dri2.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index b4656a8..e120eaa 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -158,7 +158,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
 		const unsigned int *rgba_masks)
 {
    struct dri2_egl_config *conf;
-   struct dri2_egl_display *dri2_dpy;
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    _EGLConfig base;
    unsigned int attrib, value, double_buffer;
    bool srgb = false;
@@ -169,7 +169,6 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
    EGLint config_id;
    int i;
 
-   dri2_dpy = disp->DriverData;
    _eglInitConfig(&base, disp, id);
 
    i = 0;
@@ -423,7 +422,7 @@ dri2_bind_extensions(struct dri2_egl_display *dri2_dpy,
 static const __DRIextension **
 dri2_open_driver(_EGLDisplay *disp)
 {
-   struct dri2_egl_display *dri2_dpy = disp->DriverData;
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    const __DRIextension **extensions = NULL;
    char path[PATH_MAX], *search_paths, *p, *next, *end;
    char *get_extensions_name;
@@ -507,7 +506,7 @@ dri2_open_driver(_EGLDisplay *disp)
 EGLBoolean
 dri2_load_driver_dri3(_EGLDisplay *disp)
 {
-   struct dri2_egl_display *dri2_dpy = disp->DriverData;
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    const __DRIextension **extensions;
 
    extensions = dri2_open_driver(disp);
@@ -526,7 +525,7 @@ dri2_load_driver_dri3(_EGLDisplay *disp)
 EGLBoolean
 dri2_load_driver(_EGLDisplay *disp)
 {
-   struct dri2_egl_display *dri2_dpy = disp->DriverData;
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    const __DRIextension **extensions;
 
    extensions = dri2_open_driver(disp);
@@ -545,7 +544,7 @@ dri2_load_driver(_EGLDisplay *disp)
 EGLBoolean
 dri2_load_driver_swrast(_EGLDisplay *disp)
 {
-   struct dri2_egl_display *dri2_dpy = disp->DriverData;
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    const __DRIextension **extensions;
 
    extensions = dri2_open_driver(disp);
@@ -671,11 +670,9 @@ EGLBoolean
 dri2_create_screen(_EGLDisplay *disp)
 {
    const __DRIextension **extensions;
-   struct dri2_egl_display *dri2_dpy;
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    unsigned i;
 
-   dri2_dpy = disp->DriverData;
-
    if (dri2_dpy->image_driver) {
       dri2_dpy->dri_screen =
          dri2_dpy->image_driver->createNewScreen2(0, dri2_dpy->fd,
-- 
2.9.0



More information about the mesa-dev mailing list