glamor: Silent compilation warnings due to some deprecated APIs.

those xcalloc/xfree/xalloc/XNFprintf/... are deprecated. Replace
then with the new one. And fix some other minor problems.
This commit is contained in:
Zhigang Gong 2011-05-12 14:49:08 +08:00
parent e3295d4106
commit c97d4533f2
12 changed files with 56 additions and 87 deletions

View File

@ -102,7 +102,7 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
pixmap = fbCreatePixmap (screen, 0, 0, depth, usage);
if (dixAllocatePrivates(pixmap->devPrivates, PRIVATE_PIXMAP) != TRUE) {
if (dixAllocatePrivates(&pixmap->devPrivates, PRIVATE_PIXMAP) != TRUE) {
fbDestroyPixmap(pixmap);
ErrorF("Fail to allocate privates for PIXMAP.\n");
return NullPixmap;
@ -166,16 +166,15 @@ glamor_init(ScreenPtr screen, unsigned int flags)
{
glamor_screen_private *glamor_priv;
if (flags & ~GLAMOR_VALID_FLAGS) {
ErrorF("glamor_init: Invalid flags %x\n", flags);
return FALSE;
}
#ifdef RENDER
PictureScreenPtr ps = GetPictureScreenIfSet(screen);
#endif
glamor_priv = xcalloc(1, sizeof(*glamor_priv));
if (flags & ~GLAMOR_VALID_FLAGS) {
ErrorF("glamor_init: Invalid flags %x\n", flags);
return FALSE;
}
glamor_priv = calloc(1, sizeof(*glamor_priv));
if (glamor_priv == NULL)
return FALSE;
@ -274,7 +273,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
return TRUE;
fail:
xfree(glamor_priv);
free(glamor_priv);
dixSetPrivate(&screen->devPrivates, glamor_screen_private_key, NULL);
return FALSE;
}

View File

@ -311,7 +311,7 @@ glamor_prepare_access(DrawablePtr drawable, glamor_access_t access)
stride = pixmap->devKind;
read_stride = stride;
data = xalloc(stride * pixmap->drawable.height);
data = malloc(stride * pixmap->drawable.height);
switch (drawable->depth) {
case 1:
@ -332,7 +332,7 @@ glamor_prepare_access(DrawablePtr drawable, glamor_access_t access)
break;
default:
ErrorF("Unknown prepareaccess depth %d\n", drawable->depth);
xfree(data);
free(data);
return FALSE;
}
@ -475,9 +475,9 @@ glamor_finish_access(DrawablePtr drawable)
if (pixmap_priv == NULL)
return;
if (glamor_priv->yInverted)
ptexcoords = texcoords_inverted;
ptexcoords = &texcoords_inverted[0][0];
else
ptexcoords = texcoords;
ptexcoords = &texcoords[0][0];
if (pixmap_priv->fb == 0) {
ScreenPtr screen = pixmap->drawable.pScreen;
@ -549,7 +549,7 @@ glamor_finish_access(DrawablePtr drawable)
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDeleteTextures(1, &tex);
xfree(pixmap->devPrivate.ptr);
free(pixmap->devPrivate.ptr);
pixmap->devPrivate.ptr = NULL;
}

View File

@ -61,7 +61,7 @@ glamor_get_spans(DrawablePtr drawable,
switch (drawable->depth) {
case 1:
temp_dst = xalloc(wmax);
temp_dst = malloc(wmax);
format = GL_ALPHA;
type = GL_UNSIGNED_BYTE;
readpixels_dst = temp_dst;
@ -111,7 +111,7 @@ glamor_get_spans(DrawablePtr drawable,
readpixels_dst += PixmapBytePad(widths[i], drawable->depth);
}
}
xfree(temp_dst);
free(temp_dst);
return;
fail:

View File

@ -130,12 +130,12 @@ static void glamor_unrealize_glyph_caches(ScreenPtr screen, unsigned int format)
}
if (cache->hash_entries) {
xfree(cache->hash_entries);
free(cache->hash_entries);
cache->hash_entries = NULL;
}
if (cache->glyphs) {
xfree(cache->glyphs);
free(cache->glyphs);
cache->glyphs = NULL;
}
cache->glyph_count = 0;
@ -215,9 +215,9 @@ static Bool glamor_realize_glyph_caches(ScreenPtr screen, unsigned int format)
cache->picture = picture;
cache->picture->refcnt++;
cache->hash_entries = xalloc(sizeof(int) * cache->hash_size);
cache->hash_entries = malloc(sizeof(int) * cache->hash_size);
cache->glyphs =
xalloc(sizeof(glamor_cached_glyph_t) * cache->size);
malloc(sizeof(glamor_cached_glyph_t) * cache->size);
cache->glyph_count = 0;
if (!cache->hash_entries || !cache->glyphs)

View File

@ -64,7 +64,7 @@ glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
goto fail;
}
rects = xalloc(sizeof(xRectangle) * (n - 1));
rects = malloc(sizeof(xRectangle) * (n - 1));
x1 = points[0].x;
y1 = points[0].y;
/* If we have any non-horizontal/vertical, fall back. */
@ -80,7 +80,7 @@ glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
if (x1 != x2 && y1 != y2) {
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
xfree(rects);
free(rects);
ErrorF("stub diagonal poly_line\n");
glamor_solid_fail_region(pixmap, x1, y1, x2 - x1, y2 - y1);
@ -106,7 +106,7 @@ glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
y1 = y2;
}
gc->ops->PolyFillRect(drawable, gc, n - 1, rects);
xfree(rects);
free(rects);
return;
fail:

View File

@ -231,7 +231,7 @@ glamor_delayed_fallback(ScreenPtr screen, char *format, ...)
return;
va_start(ap, format);
glamor_priv->delayed_fallback_string = XNFvprintf(format, ap);
XNFvasprintf(&glamor_priv->delayed_fallback_string, format, ap);
va_end(ap);
}
@ -240,7 +240,7 @@ glamor_clear_delayed_fallbacks(ScreenPtr screen)
{
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
xfree(glamor_priv->delayed_fallback_string);
free(glamor_priv->delayed_fallback_string);
glamor_priv->delayed_fallback_string = NULL;
}

View File

@ -181,13 +181,15 @@ glamor_create_composite_fs(struct shader_key *key)
FatalError("Bad composite IN type");
}
source = XNFprintf("%s%s%s",
source_fetch,
mask_fetch,
in);
XNFasprintf(&source,
"%s%s%s",
source_fetch,
mask_fetch,
in);
prog = glamor_compile_glsl_prog(GL_FRAGMENT_SHADER_ARB, source);
xfree(source);
free(source);
return prog;
}
@ -216,14 +218,15 @@ glamor_create_composite_vs(struct shader_key *key)
if (key->mask != SHADER_MASK_NONE && key->mask != SHADER_MASK_SOLID)
mask_coords_setup = mask_coords;
source = XNFprintf("%s%s%s%s",
main_opening,
source_coords_setup,
mask_coords_setup,
main_closing);
XNFasprintf(&source,
"%s%s%s%s",
main_opening,
source_coords_setup,
mask_coords_setup,
main_closing);
prog = glamor_compile_glsl_prog(GL_VERTEX_SHADER_ARB, source);
xfree(source);
free(source);
return prog;
}
@ -591,7 +594,7 @@ glamor_setup_composite_vbo(ScreenPtr screen)
glBindBufferARB(GL_ARRAY_BUFFER_ARB, glamor_priv->vbo);
glVertexPointer(2, GL_FLOAT, glamor_priv->vb_stride,
(void *)(glamor_priv->vbo_offset));
(void *)((long)glamor_priv->vbo_offset));
glEnableClientState(GL_VERTEX_ARRAY);
if (glamor_priv->has_source_coords) {

View File

@ -53,7 +53,7 @@ glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
switch (drawable->depth) {
case 1:
temp_src = xalloc(wmax);
temp_src = malloc(wmax);
format = GL_ALPHA;
type = GL_UNSIGNED_BYTE;
drawpixels_src = temp_src;
@ -123,7 +123,7 @@ fail:
glDisable(GL_SCISSOR_TEST);
glamor_set_planemask(dest_pixmap, ~0);
glamor_set_alu(GXcopy);
xfree(temp_src);
free(temp_src);
glamor_fallback("glamor_set_spans(): to %p (%c)\n",
drawable, glamor_get_drawable_location(drawable));

View File

@ -123,44 +123,14 @@ typedef struct GLUmat4Stack GLUmat4Stack;
#ifdef __cplusplus
extern "C" {
#endif
#if 0
GLfloat gluDot4_4v(const GLUvec4 *, const GLUvec4 *);
GLfloat gluDot3_4v(const GLUvec4 *, const GLUvec4 *);
GLfloat gluDot2_4v(const GLUvec4 *, const GLUvec4 *);
void gluCross4v(GLUvec4 *result, const GLUvec4 *, const GLUvec4 *);
void gluNormalize4v(GLUvec4 *result, const GLUvec4 *);
GLfloat gluLength4v(const GLUvec4 *);
GLfloat gluLengthSqr4v(const GLUvec4 *);
void gluOuter4v(GLUmat4 *result, const GLUvec4 *, const GLUvec4 *);
void gluMult4v_4v(GLUvec4 *result, const GLUvec4 *, const GLUvec4 *);
void gluDiv4v_4v(GLUvec4 *result, const GLUvec4 *, const GLUvec4 *);
void gluAdd4v_4v(GLUvec4 *result, const GLUvec4 *, const GLUvec4 *);
void gluSub4v_4v(GLUvec4 *result, const GLUvec4 *, const GLUvec4 *);
void gluMult4v_f(GLUvec4 *result, const GLUvec4 *, GLfloat);
void gluDiv4v_f(GLUvec4 *result, const GLUvec4 *, GLfloat);
void gluAdd4v_f(GLUvec4 *result, const GLUvec4 *, GLfloat);
void gluSub4v_f(GLUvec4 *result, const GLUvec4 *, GLfloat);
void gluMult4m_4m(GLUmat4 *result, const GLUmat4 *, const GLUmat4 *);
void gluAdd4m_4m(GLUmat4 *result, const GLUmat4 *, const GLUmat4 *);
void gluSub4m_4m(GLUmat4 *result, const GLUmat4 *, const GLUmat4 *);
void gluMult4m_4v(GLUvec4 *result, const GLUmat4 *m, const GLUvec4 *v);
void gluMult4m_f(GLUmat4 *result, const GLUmat4 *, GLfloat);
void gluScale4v(GLUmat4 *result, const GLUvec4 *);
void gluTranslate3f(GLUmat4 *result, GLfloat x, GLfloat y, GLfloat z);
void gluTranslate4v(GLUmat4 *result, const GLUvec4 *);
void gluRotate4v(GLUmat4 *result, const GLUvec4 *axis, GLfloat angle);
void gluLookAt4v(GLUmat4 *result, const GLUvec4 *eye, const GLUvec4 *center,
const GLUvec4 *up);
void gluPerspective4f(GLUmat4 *result, GLfloat fovy, GLfloat aspect,
GLfloat near, GLfloat far);
void gluTranspose4m(GLUmat4 *result, const GLUmat4 *m);
void gluFrustum6f(GLUmat4 *result,
GLfloat left, GLfloat right,
GLfloat bottom, GLfloat top,
@ -169,7 +139,6 @@ void gluOrtho6f(GLUmat4 *result,
GLfloat left, GLfloat right,
GLfloat bottom, GLfloat top,
GLfloat near, GLfloat far);
#endif
extern const GLUmat4 gluIdentityMatrix;
#ifdef __cplusplus

View File

@ -103,7 +103,6 @@ glamor_resize(ScrnInfoPtr scrn, int width, int height)
attribs[1] = width;
attribs[3] = height;
EGLint name, handle, stride, i;
image = eglCreateDRMImageMESA(glamor->display, attribs);
if (image == EGL_NO_IMAGE_KHR)
return FALSE;
@ -206,8 +205,9 @@ glamor_pre_init(ScrnInfoPtr scrn, int flags)
return TRUE;
fail:
scrn->driverPrivate = NULL;
xfree(glamor);
scrn->driverPrivate = NULL;
free(glamor);
return FALSE;
}
static void
@ -407,7 +407,7 @@ glamor_free_screen(int scrnIndex, int flags)
if (glamor != NULL)
{
close(glamor->fd);
xfree(glamor);
free(glamor);
scrn->driverPrivate = NULL;
}
}

View File

@ -377,7 +377,7 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
crtc->y = y;
crtc->rotation = rotation;
output_ids = xcalloc(sizeof(uint32_t), xf86_config->num_output);
output_ids = calloc(sizeof(uint32_t), xf86_config->num_output);
if (!output_ids) {
ret = FALSE;
goto done;
@ -469,10 +469,8 @@ static void
drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image)
{
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
drmmode_ptr drmmode = drmmode_crtc->drmmode;
ScrnInfoPtr scrn = crtc->scrn;
if (drmmode_crtc->cursor == NULL)
{
drmmode_crtc->cursor = glamor_create_cursor_argb(scrn, 64, 64);
@ -489,7 +487,6 @@ drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image)
glPixelStorei(GL_UNPACK_ROW_LENGTH, 64);
glBindTexture(GL_TEXTURE_2D, drmmode_crtc->cursor_tex);
// memset(image, 0xff, 64*64*4);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0,
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, image);
@ -775,7 +772,7 @@ static int drmmode_output_lvds_edid(xf86OutputPtr output,
* device. This is similar to what we have done in i830_lvds.c
*/
edid_mon = NULL;
edid_mon = xcalloc(1, sizeof(xf86Monitor));
edid_mon = calloc(1, sizeof(xf86Monitor));
if (!edid_mon) {
xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
"Can't allocate memory for edid_mon.\n");
@ -915,17 +912,17 @@ drmmode_output_destroy(xf86OutputPtr output)
drmModeFreePropertyBlob(drmmode_output->edid_blob);
for (i = 0; i < drmmode_output->num_props; i++) {
drmModeFreeProperty(drmmode_output->props[i].mode_prop);
xfree(drmmode_output->props[i].atoms);
free(drmmode_output->props[i].atoms);
}
xfree(drmmode_output->props);
free(drmmode_output->props);
drmModeFreeConnector(drmmode_output->mode_output);
if (drmmode_output->private_data) {
xfree(drmmode_output->private_data);
free(drmmode_output->private_data);
drmmode_output->private_data = NULL;
}
if (drmmode_output->backlight_iface)
drmmode_backlight_set(output, drmmode_output->backlight_active_level);
xfree(drmmode_output);
free(drmmode_output);
output->driver_private = NULL;
}
@ -1008,7 +1005,7 @@ drmmode_output_create_resources(xf86OutputPtr output)
drmModePropertyPtr drmmode_prop;
int i, j, err;
drmmode_output->props = xcalloc(mode_output->count_props, sizeof(drmmode_prop_rec));
drmmode_output->props = calloc(mode_output->count_props, sizeof(drmmode_prop_rec));
if (!drmmode_output->props)
return;
@ -1033,7 +1030,7 @@ drmmode_output_create_resources(xf86OutputPtr output)
INT32 range[2];
p->num_atoms = 1;
p->atoms = xcalloc(p->num_atoms, sizeof(Atom));
p->atoms = calloc(p->num_atoms, sizeof(Atom));
if (!p->atoms)
continue;
p->atoms[0] = MakeAtom(drmmode_prop->name, strlen(drmmode_prop->name), TRUE);
@ -1055,7 +1052,7 @@ drmmode_output_create_resources(xf86OutputPtr output)
}
} else if (drmmode_prop->flags & DRM_MODE_PROP_ENUM) {
p->num_atoms = drmmode_prop->count_enums + 1;
p->atoms = xcalloc(p->num_atoms, sizeof(Atom));
p->atoms = calloc(p->num_atoms, sizeof(Atom));
if (!p->atoms)
continue;
p->atoms[0] = MakeAtom(drmmode_prop->name, strlen(drmmode_prop->name), TRUE);
@ -1291,7 +1288,7 @@ drmmode_output_init(ScrnInfoPtr scrn, drmmode_ptr drmmode, int num)
return;
}
drmmode_output = xcalloc(sizeof(drmmode_output_private_rec), 1);
drmmode_output = calloc(sizeof(drmmode_output_private_rec), 1);
if (!drmmode_output) {
xf86OutputDestroy(output);
drmModeFreeConnector(koutput);
@ -1305,7 +1302,7 @@ drmmode_output_init(ScrnInfoPtr scrn, drmmode_ptr drmmode, int num)
*/
drmmode_output->private_data = NULL;
if (koutput->connector_type == DRM_MODE_CONNECTOR_LVDS) {
drmmode_output->private_data = xcalloc(
drmmode_output->private_data = calloc(
sizeof(struct fixed_panel_lvds), 1);
if (!drmmode_output->private_data)
xf86DrvMsg(scrn->scrnIndex, X_ERROR,

View File

@ -8,6 +8,7 @@ Bool glamor_load_cursor(ScrnInfoPtr scrn,
CARD32 *image, int width, int height);
void glamor_cursor_handle(ScrnInfoPtr scrn, EGLImageKHR image, uint32_t *handle, uint32_t *pitch);
EGLImageKHR glamor_create_cursor_argb(ScrnInfoPtr scrn, int width, int height);
Bool drmmode_pre_init(ScrnInfoPtr scrn, int fd, int cpp);
void drmmode_closefb(ScrnInfoPtr scrn);