summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c28
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_api.c22
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_image.c21
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_st.c4
-rw-r--r--src/gallium/state_trackers/egl/common/native.h2
-rw-r--r--src/gallium/state_trackers/egl/kms/native_kms.c44
-rw-r--r--src/gallium/state_trackers/egl/x11/native_dri2.c16
-rw-r--r--src/gallium/state_trackers/egl/x11/native_x11.c12
-rw-r--r--src/gallium/state_trackers/egl/x11/native_ximage.c18
-rw-r--r--src/gallium/state_trackers/egl/x11/x11_screen.c11
10 files changed, 86 insertions, 92 deletions
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 34c52e60465..3ab72dce2f3 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -23,7 +23,6 @@
* DEALINGS IN THE SOFTWARE.
*/
-#include <stdio.h>
#include "egldriver.h"
#include "eglcurrent.h"
#include "egllog.h"
@@ -31,6 +30,7 @@
#include "pipe/p_screen.h"
#include "util/u_memory.h"
#include "util/u_format.h"
+#include "util/u_string.h"
#include "egl_g3d.h"
#include "egl_g3d_api.h"
@@ -115,7 +115,7 @@ egl_g3d_add_screens(_EGLDriver *drv, _EGLDisplay *dpy)
gdpy->native->modeset->get_connectors(gdpy->native, &num_connectors, NULL);
if (!num_connectors) {
if (native_connectors)
- free(native_connectors);
+ FREE(native_connectors);
return;
}
@@ -130,13 +130,13 @@ egl_g3d_add_screens(_EGLDriver *drv, _EGLDisplay *dpy)
gdpy->native->modeset->get_modes(gdpy->native, nconn, &num_modes);
if (!num_modes) {
if (native_modes)
- free(native_modes);
+ FREE(native_modes);
continue;
}
gscr = CALLOC_STRUCT(egl_g3d_screen);
if (!gscr) {
- free(native_modes);
+ FREE(native_modes);
continue;
}
@@ -160,7 +160,7 @@ egl_g3d_add_screens(_EGLDriver *drv, _EGLDisplay *dpy)
_eglAddScreen(dpy, &gscr->base);
}
- free(native_connectors);
+ FREE(native_connectors);
}
#endif /* EGL_MESA_screen_surface */
@@ -377,7 +377,7 @@ egl_g3d_add_configs(_EGLDriver *drv, _EGLDisplay *dpy, EGLint id)
native_configs = gdpy->native->get_configs(gdpy->native, &num_configs);
if (!num_configs) {
if (native_configs)
- free(native_configs);
+ FREE(native_configs);
return id;
}
@@ -393,7 +393,7 @@ egl_g3d_add_configs(_EGLDriver *drv, _EGLDisplay *dpy, EGLint id)
_eglInitConfig(&gconf->base, dpy, id);
if (!egl_g3d_init_config(drv, dpy, &gconf->base,
native_configs[i], depth_stencil_formats[j])) {
- free(gconf);
+ FREE(gconf);
break;
}
@@ -403,7 +403,7 @@ egl_g3d_add_configs(_EGLDriver *drv, _EGLDisplay *dpy, EGLint id)
}
}
- free(native_configs);
+ FREE(native_configs);
return id;
}
@@ -444,10 +444,10 @@ egl_g3d_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
if (dpy->Screens) {
for (i = 0; i < dpy->NumScreens; i++) {
struct egl_g3d_screen *gscr = egl_g3d_screen(dpy->Screens[i]);
- free(gscr->native_modes);
- free(gscr);
+ FREE(gscr->native_modes);
+ FREE(gscr);
}
- free(dpy->Screens);
+ FREE(dpy->Screens);
}
if (gdpy->smapi)
@@ -456,7 +456,7 @@ egl_g3d_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
if (gdpy->native)
gdpy->native->destroy(gdpy->native);
- free(gdpy);
+ FREE(gdpy);
dpy->DriverData = NULL;
return EGL_TRUE;
@@ -589,7 +589,7 @@ egl_g3d_unload(_EGLDriver *drv)
}
egl_g3d_destroy_probe(drv, NULL);
- free(gdrv);
+ FREE(gdrv);
}
_EGLDriver *
@@ -598,7 +598,7 @@ _eglMain(const char *args)
static char driver_name[64];
struct egl_g3d_driver *gdrv;
- snprintf(driver_name, sizeof(driver_name),
+ util_snprintf(driver_name, sizeof(driver_name),
"Gallium/%s", native_get_name());
gdrv = CALLOC_STRUCT(egl_g3d_driver);
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index 47dedc76627..478516453ce 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -93,20 +93,20 @@ egl_g3d_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
}
if (!_eglInitContext(&gctx->base, dpy, conf, attribs)) {
- free(gctx);
+ FREE(gctx);
return NULL;
}
gctx->stapi = egl_g3d_choose_st(drv, &gctx->base);
if (!gctx->stapi) {
- free(gctx);
+ FREE(gctx);
return NULL;
}
gctx->stctxi = gctx->stapi->create_context(gctx->stapi, gdpy->smapi,
&gconf->stvis, (gshare) ? gshare->stctxi : NULL);
if (!gctx->stctxi) {
- free(gctx);
+ FREE(gctx);
return NULL;
}
@@ -129,7 +129,7 @@ destroy_context(_EGLDisplay *dpy, _EGLContext *ctx)
gctx->stctxi->destroy(gctx->stctxi);
- free(gctx);
+ FREE(gctx);
}
static EGLBoolean
@@ -183,7 +183,7 @@ egl_g3d_create_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
}
if (!_eglInitSurface(&gsurf->base, dpy, arg->type, conf, attribs)) {
- free(gsurf);
+ FREE(gsurf);
return NULL;
}
@@ -211,14 +211,14 @@ egl_g3d_create_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
}
if (!nsurf) {
- free(gsurf);
+ FREE(gsurf);
return NULL;
}
/* initialize the geometry */
if (!nsurf->validate(nsurf, 0x0, &gsurf->sequence_number, NULL,
&gsurf->base.Width, &gsurf->base.Height)) {
nsurf->destroy(nsurf);
- free(gsurf);
+ FREE(gsurf);
return NULL;
}
@@ -229,7 +229,7 @@ egl_g3d_create_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
gsurf->stfbi = egl_g3d_create_st_framebuffer(&gsurf->base);
if (!gsurf->stfbi) {
nsurf->destroy(nsurf);
- free(gsurf);
+ FREE(gsurf);
return NULL;
}
@@ -281,7 +281,7 @@ egl_g3d_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy,
}
if (!_eglInitSurface(&gsurf->base, dpy, EGL_PBUFFER_BIT, conf, attribs)) {
- free(gsurf);
+ FREE(gsurf);
return NULL;
}
@@ -289,7 +289,7 @@ egl_g3d_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy,
gsurf->stfbi = egl_g3d_create_st_framebuffer(&gsurf->base);
if (!gsurf->stfbi) {
- free(gsurf);
+ FREE(gsurf);
return NULL;
}
@@ -312,7 +312,7 @@ destroy_surface(_EGLDisplay *dpy, _EGLSurface *surf)
egl_g3d_destroy_st_framebuffer(gsurf->stfbi);
if (gsurf->native)
gsurf->native->destroy(gsurf->native);
- free(gsurf);
+ FREE(gsurf);
}
static EGLBoolean
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.c b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
index 023653ecf65..b1fe30a776c 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
@@ -14,12 +14,13 @@
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*
* Authors:
* Chia-I Wu <[email protected]>
@@ -82,7 +83,7 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
}
if (!_eglInitImage(&gimg->base, dpy, attribs)) {
- free(gimg);
+ FREE(gimg);
return NULL;
}
@@ -97,20 +98,20 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
}
if (!ptex) {
- free(gimg);
+ FREE(gimg);
return NULL;
}
if (level > ptex->last_level) {
_eglError(EGL_BAD_MATCH, "eglCreateEGLImageKHR");
pipe_resource_reference(&gimg->texture, NULL);
- free(gimg);
+ FREE(gimg);
return NULL;
}
if (zslice > ptex->depth0) {
_eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR");
pipe_resource_reference(&gimg->texture, NULL);
- free(gimg);
+ FREE(gimg);
return NULL;
}
@@ -129,7 +130,7 @@ egl_g3d_destroy_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *img)
struct egl_g3d_image *gimg = egl_g3d_image(img);
pipe_resource_reference(&gimg->texture, NULL);
- free(gimg);
+ FREE(gimg);
return EGL_TRUE;
}
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_st.c b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
index 887c7b07c70..57a479f6bca 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_st.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
@@ -138,7 +138,7 @@ void
egl_g3d_destroy_st_manager(struct st_manager *smapi)
{
struct egl_g3d_st_manager *gsmapi = egl_g3d_st_manager(smapi);
- free(gsmapi);
+ FREE(gsmapi);
}
static boolean
@@ -310,5 +310,5 @@ egl_g3d_create_st_framebuffer(_EGLSurface *surf)
void
egl_g3d_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi)
{
- free(stfbi);
+ FREE(stfbi);
}
diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h
index 9a163d0c869..3f60348c489 100644
--- a/src/gallium/state_trackers/egl/common/native.h
+++ b/src/gallium/state_trackers/egl/common/native.h
@@ -150,7 +150,7 @@ struct native_display {
/**
* Get the supported configs. The configs are owned by the display, but
- * the returned array should be free()ed.
+ * the returned array should be FREE()ed.
*/
const struct native_config **(*get_configs)(struct native_display *ndpy,
int *num_configs);
diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c b/src/gallium/state_trackers/egl/kms/native_kms.c
index d1ff0f47b67..860657349bc 100644
--- a/src/gallium/state_trackers/egl/kms/native_kms.c
+++ b/src/gallium/state_trackers/egl/kms/native_kms.c
@@ -23,14 +23,12 @@
* DEALINGS IN THE SOFTWARE.
*/
-#include <stdio.h>
-#include <string.h>
-
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
#include "util/u_debug.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
+#include "util/u_string.h"
#include "egllog.h"
#include "native_kms.h"
@@ -230,7 +228,7 @@ kms_surface_destroy(struct native_surface *nsurf)
pipe_resource_reference(&ptex, NULL);
}
- free(ksurf);
+ FREE(ksurf);
}
static struct kms_surface *
@@ -464,7 +462,7 @@ kms_display_get_modes(struct native_display *ndpy,
/* delete old data */
if (kconn->connector) {
drmModeFreeConnector(kconn->connector);
- free(kconn->kms_modes);
+ FREE(kconn->kms_modes);
kconn->connector = NULL;
kconn->kms_modes = NULL;
@@ -477,7 +475,7 @@ kms_display_get_modes(struct native_display *ndpy,
return NULL;
count = kconn->connector->count_modes;
- kconn->kms_modes = calloc(count, sizeof(*kconn->kms_modes));
+ kconn->kms_modes = CALLOC(count, sizeof(*kconn->kms_modes));
if (!kconn->kms_modes) {
drmModeFreeConnector(kconn->connector);
kconn->connector = NULL;
@@ -500,7 +498,7 @@ kms_display_get_modes(struct native_display *ndpy,
kmode->base.refresh_rate = (kmode->base.refresh_rate + 500) / 1000;
}
- nmodes_return = malloc(count * sizeof(*nmodes_return));
+ nmodes_return = MALLOC(count * sizeof(*nmodes_return));
if (nmodes_return) {
for (i = 0; i < count; i++)
nmodes_return[i] = &kconn->kms_modes[i].base;
@@ -521,7 +519,7 @@ kms_display_get_connectors(struct native_display *ndpy, int *num_connectors,
if (!kdpy->connectors) {
kdpy->connectors =
- calloc(kdpy->resources->count_connectors, sizeof(*kdpy->connectors));
+ CALLOC(kdpy->resources->count_connectors, sizeof(*kdpy->connectors));
if (!kdpy->connectors)
return NULL;
@@ -535,7 +533,7 @@ kms_display_get_connectors(struct native_display *ndpy, int *num_connectors,
kdpy->num_connectors = kdpy->resources->count_connectors;
}
- connectors = malloc(kdpy->num_connectors * sizeof(*connectors));
+ connectors = MALLOC(kdpy->num_connectors * sizeof(*connectors));
if (connectors) {
for (i = 0; i < kdpy->num_connectors; i++)
connectors[i] = &kdpy->connectors[i].base;
@@ -581,7 +579,7 @@ kms_display_get_configs(struct native_display *ndpy, int *num_configs)
struct native_config *nconf;
enum pipe_format format;
- kdpy->config = calloc(1, sizeof(*kdpy->config));
+ kdpy->config = CALLOC(1, sizeof(*kdpy->config));
if (!kdpy->config)
return NULL;
@@ -598,7 +596,7 @@ kms_display_get_configs(struct native_display *ndpy, int *num_configs)
format = PIPE_FORMAT_NONE;
}
if (format == PIPE_FORMAT_NONE) {
- free(kdpy->config);
+ FREE(kdpy->config);
kdpy->config = NULL;
return NULL;
}
@@ -608,7 +606,7 @@ kms_display_get_configs(struct native_display *ndpy, int *num_configs)
nconf->scanout_bit = TRUE;
}
- configs = malloc(sizeof(*configs));
+ configs = MALLOC(sizeof(*configs));
if (configs) {
configs[0] = &kdpy->config->base;
if (num_configs)
@@ -640,21 +638,21 @@ kms_display_destroy(struct native_display *ndpy)
int i;
if (kdpy->config)
- free(kdpy->config);
+ FREE(kdpy->config);
if (kdpy->connectors) {
for (i = 0; i < kdpy->num_connectors; i++) {
struct kms_connector *kconn = &kdpy->connectors[i];
if (kconn->connector) {
drmModeFreeConnector(kconn->connector);
- free(kconn->kms_modes);
+ FREE(kconn->kms_modes);
}
}
- free(kdpy->connectors);
+ FREE(kdpy->connectors);
}
if (kdpy->shown_surfaces)
- free(kdpy->shown_surfaces);
+ FREE(kdpy->shown_surfaces);
if (kdpy->saved_crtcs) {
for (i = 0; i < kdpy->resources->count_crtcs; i++) {
@@ -670,7 +668,7 @@ kms_display_destroy(struct native_display *ndpy)
drmModeFreeCrtc(kcrtc->crtc);
}
}
- free(kdpy->saved_crtcs);
+ FREE(kdpy->saved_crtcs);
}
if (kdpy->resources)
@@ -684,7 +682,7 @@ kms_display_destroy(struct native_display *ndpy)
if (kdpy->api)
kdpy->api->destroy(kdpy->api);
- free(kdpy);
+ FREE(kdpy);
}
/**
@@ -747,7 +745,7 @@ kms_create_display(EGLNativeDisplayType dpy,
kdpy->api = api;
if (!kdpy->api) {
_eglLog(_EGL_WARNING, "failed to create DRM API");
- free(kdpy);
+ FREE(kdpy);
return NULL;
}
@@ -765,14 +763,14 @@ kms_create_display(EGLNativeDisplayType dpy,
}
kdpy->saved_crtcs =
- calloc(kdpy->resources->count_crtcs, sizeof(*kdpy->saved_crtcs));
+ CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->saved_crtcs));
if (!kdpy->saved_crtcs) {
kms_display_destroy(&kdpy->base);
return NULL;
}
kdpy->shown_surfaces =
- calloc(kdpy->resources->count_crtcs, sizeof(*kdpy->shown_surfaces));
+ CALLOC(kdpy->resources->count_crtcs, sizeof(*kdpy->shown_surfaces));
if (!kdpy->shown_surfaces) {
kms_display_destroy(&kdpy->base);
return NULL;
@@ -811,9 +809,9 @@ native_get_name(void)
drm_api = drm_api_create();
if (drm_api)
- snprintf(kms_name, sizeof(kms_name), "KMS/%s", drm_api->name);
+ util_snprintf(kms_name, sizeof(kms_name), "KMS/%s", drm_api->name);
else
- snprintf(kms_name, sizeof(kms_name), "KMS");
+ util_snprintf(kms_name, sizeof(kms_name), "KMS");
return kms_name;
}
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 9499319424e..d77b9b94943 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -233,7 +233,7 @@ dri2_surface_get_buffers(struct native_surface *nsurf, uint buffer_mask)
/* we should be able to do better... */
if (xbufs && dri2surf->last_num_xbufs == num_outs &&
memcmp(dri2surf->last_xbufs, xbufs, sizeof(*xbufs) * num_outs) == 0) {
- free(xbufs);
+ FREE(xbufs);
dri2surf->client_stamp = dri2surf->server_stamp;
return;
}
@@ -244,7 +244,7 @@ dri2_surface_get_buffers(struct native_surface *nsurf, uint buffer_mask)
dri2surf->client_stamp = dri2surf->server_stamp;
if (dri2surf->last_xbufs)
- free(dri2surf->last_xbufs);
+ FREE(dri2surf->last_xbufs);
dri2surf->last_xbufs = xbufs;
dri2surf->last_num_xbufs = num_outs;
}
@@ -379,7 +379,7 @@ dri2_surface_destroy(struct native_surface *nsurf)
int i;
if (dri2surf->last_xbufs)
- free(dri2surf->last_xbufs);
+ FREE(dri2surf->last_xbufs);
for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++) {
struct pipe_resource *ptex = dri2surf->textures[i];
@@ -393,7 +393,7 @@ dri2_surface_destroy(struct native_surface *nsurf)
util_hash_table_remove(dri2surf->dri2dpy->surfaces,
(void *) dri2surf->drawable);
}
- free(dri2surf);
+ FREE(dri2surf);
}
static struct dri2_surface *
@@ -570,7 +570,7 @@ dri2_display_get_configs(struct native_display *ndpy, int *num_configs)
return NULL;
num_modes = x11_context_modes_count(modes);
- dri2dpy->configs = calloc(num_modes, sizeof(*dri2dpy->configs));
+ dri2dpy->configs = CALLOC(num_modes, sizeof(*dri2dpy->configs));
if (!dri2dpy->configs)
return NULL;
@@ -585,7 +585,7 @@ dri2_display_get_configs(struct native_display *ndpy, int *num_configs)
dri2dpy->num_configs = count;
}
- configs = malloc(dri2dpy->num_configs * sizeof(*configs));
+ configs = MALLOC(dri2dpy->num_configs * sizeof(*configs));
if (configs) {
for (i = 0; i < dri2dpy->num_configs; i++)
configs[i] = (const struct native_config *) &dri2dpy->configs[i];
@@ -636,7 +636,7 @@ dri2_display_destroy(struct native_display *ndpy)
struct dri2_display *dri2dpy = dri2_display(ndpy);
if (dri2dpy->configs)
- free(dri2dpy->configs);
+ FREE(dri2dpy->configs);
if (dri2dpy->base.screen)
dri2dpy->base.screen->destroy(dri2dpy->base.screen);
@@ -650,7 +650,7 @@ dri2_display_destroy(struct native_display *ndpy)
XCloseDisplay(dri2dpy->dpy);
if (dri2dpy->api && dri2dpy->api->destroy)
dri2dpy->api->destroy(dri2dpy->api);
- free(dri2dpy);
+ FREE(dri2dpy);
}
static void
diff --git a/src/gallium/state_trackers/egl/x11/native_x11.c b/src/gallium/state_trackers/egl/x11/native_x11.c
index 9bf0ad81143..b6d51bbf9fb 100644
--- a/src/gallium/state_trackers/egl/x11/native_x11.c
+++ b/src/gallium/state_trackers/egl/x11/native_x11.c
@@ -23,10 +23,10 @@
* DEALINGS IN THE SOFTWARE.
*/
-#include <stdio.h>
#include <string.h>
#include "util/u_debug.h"
#include "util/u_memory.h"
+#include "util/u_string.h"
#include "state_tracker/drm_api.h"
#include "egllog.h"
@@ -41,8 +41,8 @@ static void
x11_probe_destroy(struct native_probe *nprobe)
{
if (nprobe->data)
- free(nprobe->data);
- free(nprobe);
+ FREE(nprobe->data);
+ FREE(nprobe);
}
struct native_probe *
@@ -62,7 +62,7 @@ native_create_probe(EGLNativeDisplayType dpy)
if (!xdpy) {
xdpy = XOpenDisplay(NULL);
if (!xdpy) {
- free(nprobe);
+ FREE(nprobe);
return NULL;
}
}
@@ -119,9 +119,9 @@ native_get_name(void)
api = drm_api_create();
if (api)
- snprintf(x11_name, sizeof(x11_name), "X11/%s", api->name);
+ util_snprintf(x11_name, sizeof(x11_name), "X11/%s", api->name);
else
- snprintf(x11_name, sizeof(x11_name), "X11");
+ util_snprintf(x11_name, sizeof(x11_name), "X11");
return x11_name;
}
diff --git a/src/gallium/state_trackers/egl/x11/native_ximage.c b/src/gallium/state_trackers/egl/x11/native_ximage.c
index 203e06e1777..22fcdcfa6d9 100644
--- a/src/gallium/state_trackers/egl/x11/native_ximage.c
+++ b/src/gallium/state_trackers/egl/x11/native_ximage.c
@@ -23,10 +23,6 @@
* DEALINGS IN THE SOFTWARE.
*/
-#include <assert.h>
-#include <sys/ipc.h>
-#include <sys/types.h>
-#include <sys/shm.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "util/u_memory.h"
@@ -373,7 +369,7 @@ ximage_surface_destroy(struct native_surface *nsurf)
for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++)
ximage_surface_free_buffer(&xsurf->base, i);
- free(xsurf);
+ FREE(xsurf);
}
static struct ximage_surface *
@@ -476,7 +472,7 @@ ximage_display_get_configs(struct native_display *ndpy, int *num_configs)
* Create two configs for each visual.
* One with depth/stencil buffer; one without
*/
- xdpy->configs = calloc(num_visuals * 2, sizeof(*xdpy->configs));
+ xdpy->configs = CALLOC(num_visuals * 2, sizeof(*xdpy->configs));
if (!xdpy->configs)
return NULL;
@@ -511,7 +507,7 @@ ximage_display_get_configs(struct native_display *ndpy, int *num_configs)
xdpy->num_configs = count;
}
- configs = malloc(xdpy->num_configs * sizeof(*configs));
+ configs = MALLOC(xdpy->num_configs * sizeof(*configs));
if (configs) {
for (i = 0; i < xdpy->num_configs; i++)
configs[i] = (const struct native_config *) &xdpy->configs[i];
@@ -574,14 +570,14 @@ ximage_display_destroy(struct native_display *ndpy)
struct ximage_display *xdpy = ximage_display(ndpy);
if (xdpy->configs)
- free(xdpy->configs);
+ FREE(xdpy->configs);
xdpy->base.screen->destroy(xdpy->base.screen);
x11_screen_destroy(xdpy->xscr);
if (xdpy->own_dpy)
XCloseDisplay(xdpy->dpy);
- free(xdpy);
+ FREE(xdpy);
}
@@ -652,7 +648,7 @@ x11_create_ximage_display(EGLNativeDisplayType dpy,
if (!xdpy->dpy) {
xdpy->dpy = XOpenDisplay(NULL);
if (!xdpy->dpy) {
- free(xdpy);
+ FREE(xdpy);
return NULL;
}
xdpy->own_dpy = TRUE;
@@ -663,7 +659,7 @@ x11_create_ximage_display(EGLNativeDisplayType dpy,
xdpy->xscr_number = DefaultScreen(xdpy->dpy);
xdpy->xscr = x11_screen_create(xdpy->dpy, xdpy->xscr_number);
if (!xdpy->xscr) {
- free(xdpy);
+ FREE(xdpy);
return NULL;
}
diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.c b/src/gallium/state_trackers/egl/x11/x11_screen.c
index dd820a369ef..6bdff26ec08 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.c
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.c
@@ -27,12 +27,11 @@
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <xf86drm.h>
#include <X11/Xlibint.h>
#include <X11/extensions/XShm.h>
+
#include "util/u_memory.h"
-#include "util/u_math.h"
-#include "util/u_format.h"
-#include "xf86drm.h"
#include "egllog.h"
#include "x11_screen.h"
@@ -110,7 +109,7 @@ x11_screen_destroy(struct x11_screen *xscr)
if (xscr->visuals)
XFree(xscr->visuals);
- free(xscr);
+ FREE(xscr);
}
static boolean
@@ -379,7 +378,7 @@ x11_context_modes_create(unsigned count)
next = &base;
for (i = 0; i < count; i++) {
- *next = (__GLcontextModes *) calloc(1, size);
+ *next = (__GLcontextModes *) CALLOC(1, size);
if (*next == NULL) {
x11_context_modes_destroy(base);
base = NULL;
@@ -399,7 +398,7 @@ x11_context_modes_destroy(__GLcontextModes *modes)
{
while (modes != NULL) {
__GLcontextModes *next = modes->next;
- free(modes);
+ FREE(modes);
modes = next;
}
}