mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-02 12:18:09 +02:00
g3dvl: Use Gallium MALLOC wrappers.
This commit is contained in:
parent
db1021a37c
commit
1e9c3efcc7
9 changed files with 34 additions and 31 deletions
|
|
@ -3,7 +3,10 @@ OBJECTS = vl_display.o vl_screen.o vl_context.o vl_surface.o vl_shader_build.o
|
|||
vl_r16snorm_mc_buf.o
|
||||
GALLIUMDIR = ../..
|
||||
|
||||
CFLAGS += -g -Wall -fPIC -I${GALLIUMDIR}/include -I${GALLIUMDIR}/auxiliary -I${GALLIUMDIR}/winsys/g3dvl
|
||||
CFLAGS += -g -Wall -Werror=implicit-function-declaration -fPIC \
|
||||
-I${GALLIUMDIR}/include \
|
||||
-I${GALLIUMDIR}/auxiliary \
|
||||
-I${GALLIUMDIR}/winsys/g3dvl \
|
||||
|
||||
#############################################
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#define VL_INTERNAL
|
||||
#include "vl_basic_csc.h"
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <pipe/p_context.h>
|
||||
#include <pipe/p_winsys.h>
|
||||
#include <pipe/p_state.h>
|
||||
#include <pipe/p_inlines.h>
|
||||
#include <tgsi/tgsi_parse.h>
|
||||
#include <tgsi/tgsi_build.h>
|
||||
#include <util/u_memory.h>
|
||||
#include "vl_csc.h"
|
||||
#include "vl_surface.h"
|
||||
#include "vl_shader_build.h"
|
||||
|
|
@ -237,7 +237,7 @@ static int vlDestroy
|
|||
pipe->winsys->buffer_destroy(pipe->winsys, basic_csc->vs_const_buf.buffer);
|
||||
pipe->winsys->buffer_destroy(pipe->winsys, basic_csc->fs_const_buf.buffer);
|
||||
|
||||
free(basic_csc);
|
||||
FREE(basic_csc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -369,7 +369,7 @@ static int vlCreateVertexShader
|
|||
assert(context);
|
||||
|
||||
pipe = csc->pipe;
|
||||
tokens = (struct tgsi_token*)malloc(max_tokens * sizeof(struct tgsi_token));
|
||||
tokens = (struct tgsi_token*)MALLOC(max_tokens * sizeof(struct tgsi_token));
|
||||
|
||||
/* Version */
|
||||
*(struct tgsi_version*)&tokens[0] = tgsi_build_version();
|
||||
|
|
@ -430,7 +430,7 @@ static int vlCreateVertexShader
|
|||
|
||||
vs.tokens = tokens;
|
||||
csc->vertex_shader = pipe->create_vs_state(pipe, &vs);
|
||||
free(tokens);
|
||||
FREE(tokens);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -456,7 +456,7 @@ static int vlCreateFragmentShader
|
|||
assert(context);
|
||||
|
||||
pipe = csc->pipe;
|
||||
tokens = (struct tgsi_token*)malloc(max_tokens * sizeof(struct tgsi_token));
|
||||
tokens = (struct tgsi_token*)MALLOC(max_tokens * sizeof(struct tgsi_token));
|
||||
|
||||
/* Version */
|
||||
*(struct tgsi_version*)&tokens[0] = tgsi_build_version();
|
||||
|
|
@ -517,7 +517,7 @@ static int vlCreateFragmentShader
|
|||
|
||||
fs.tokens = tokens;
|
||||
csc->fragment_shader = pipe->create_fs_state(pipe, &fs);
|
||||
free(tokens);
|
||||
FREE(tokens);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -691,7 +691,7 @@ int vlCreateBasicCSC
|
|||
assert(pipe);
|
||||
assert(csc);
|
||||
|
||||
basic_csc = calloc(1, sizeof(struct vlBasicCSC));
|
||||
basic_csc = CALLOC_STRUCT(vlBasicCSC);
|
||||
|
||||
if (!basic_csc)
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#define VL_INTERNAL
|
||||
#include "vl_context.h"
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <pipe/p_context.h>
|
||||
#include <pipe/p_state.h>
|
||||
#include <util/u_memory.h>
|
||||
#include "vl_render.h"
|
||||
#include "vl_r16snorm_mc_buf.h"
|
||||
#include "vl_csc.h"
|
||||
|
|
@ -111,7 +111,7 @@ int vlCreateContext
|
|||
assert(context);
|
||||
assert(pipe);
|
||||
|
||||
ctx = calloc(1, sizeof(struct vlContext));
|
||||
ctx = CALLOC_STRUCT(vlContext);
|
||||
|
||||
if (!ctx)
|
||||
return 1;
|
||||
|
|
@ -152,7 +152,7 @@ int vlDestroyContext
|
|||
context->pipe->delete_rasterizer_state(context->pipe, context->raster);
|
||||
context->pipe->delete_depth_stencil_alpha_state(context->pipe, context->dsa);
|
||||
|
||||
free(context);
|
||||
FREE(context);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#define VL_INTERNAL
|
||||
#include "vl_display.h"
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <util/u_memory.h>
|
||||
|
||||
int vlCreateDisplay
|
||||
(
|
||||
|
|
@ -14,7 +14,7 @@ int vlCreateDisplay
|
|||
assert(native_display);
|
||||
assert(display);
|
||||
|
||||
dpy = calloc(1, sizeof(struct vlDisplay));
|
||||
dpy = CALLOC_STRUCT(vlDisplay);
|
||||
|
||||
if (!dpy)
|
||||
return 1;
|
||||
|
|
@ -32,7 +32,7 @@ int vlDestroyDisplay
|
|||
{
|
||||
assert(display);
|
||||
|
||||
free(display);
|
||||
FREE(display);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#define VL_INTERNAL
|
||||
#include "vl_r16snorm_mc_buf.h"
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <pipe/p_context.h>
|
||||
#include <pipe/p_winsys.h>
|
||||
#include <pipe/p_screen.h>
|
||||
|
|
@ -10,6 +9,7 @@
|
|||
#include <tgsi/tgsi_parse.h>
|
||||
#include <tgsi/tgsi_build.h>
|
||||
#include <util/u_math.h>
|
||||
#include <util/u_memory.h>
|
||||
#include "vl_render.h"
|
||||
#include "vl_shader_build.h"
|
||||
#include "vl_surface.h"
|
||||
|
|
@ -869,8 +869,8 @@ static int vlDestroy
|
|||
pipe->winsys->buffer_destroy(pipe->winsys, mc->vs_const_buf.buffer);
|
||||
pipe->winsys->buffer_destroy(pipe->winsys, mc->fs_const_buf.buffer);
|
||||
|
||||
free(mc->macroblocks);
|
||||
free(mc);
|
||||
FREE(mc->macroblocks);
|
||||
FREE(mc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1007,7 +1007,7 @@ static int vlCreateDataBufs
|
|||
|
||||
pipe->winsys->buffer_unmap(pipe->winsys, mc->fs_const_buf.buffer);
|
||||
|
||||
mc->macroblocks = malloc(sizeof(struct vlMpeg2MacroBlock) * mc->macroblocks_per_picture);
|
||||
mc->macroblocks = MALLOC(sizeof(struct vlMpeg2MacroBlock) * mc->macroblocks_per_picture);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1133,7 +1133,7 @@ int vlCreateR16SNormBufferedMC
|
|||
assert(pipe);
|
||||
assert(render);
|
||||
|
||||
mc = calloc(1, sizeof(struct vlR16SnormBufferedMC));
|
||||
mc = CALLOC_STRUCT(vlR16SnormBufferedMC);
|
||||
|
||||
mc->base.vlBegin = &vlBegin;
|
||||
mc->base.vlRenderMacroBlocksMpeg2 = &vlRenderMacroBlocksMpeg2R16SnormBuffered;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#define VL_INTERNAL
|
||||
#include "vl_screen.h"
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <util/u_memory.h>
|
||||
|
||||
int vlCreateScreen
|
||||
(
|
||||
|
|
@ -17,7 +17,7 @@ int vlCreateScreen
|
|||
assert(pscreen);
|
||||
assert(vl_screen);
|
||||
|
||||
scrn = calloc(1, sizeof(struct vlScreen));
|
||||
scrn = CALLOC_STRUCT(vlScreen);
|
||||
|
||||
if (!scrn)
|
||||
return 1;
|
||||
|
|
@ -37,7 +37,7 @@ int vlDestroyScreen
|
|||
{
|
||||
assert(screen);
|
||||
|
||||
free(screen);
|
||||
FREE(screen);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#define VL_INTERNAL
|
||||
#include "vl_surface.h"
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <pipe/p_screen.h>
|
||||
#include <pipe/p_state.h>
|
||||
#include <pipe/p_inlines.h>
|
||||
#include <util/u_memory.h>
|
||||
#include <vl_winsys.h>
|
||||
#include "vl_screen.h"
|
||||
#include "vl_context.h"
|
||||
|
|
@ -28,7 +28,7 @@ int vlCreateSurface
|
|||
assert(screen);
|
||||
assert(surface);
|
||||
|
||||
sfc = calloc(1, sizeof(struct vlSurface));
|
||||
sfc = CALLOC_STRUCT(vlSurface);
|
||||
|
||||
if (!sfc)
|
||||
return 1;
|
||||
|
|
@ -64,7 +64,7 @@ int vlDestroySurface
|
|||
assert(surface);
|
||||
|
||||
pipe_texture_release(&surface->texture);
|
||||
free(surface);
|
||||
FREE(surface);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ ifeq (${DRIVER}, softpipe)
|
|||
OBJECTS += ${GALLIUMDIR}/winsys/g3dvl/xsp_winsys.o
|
||||
endif
|
||||
|
||||
CFLAGS += -g -fPIC -Wall \
|
||||
CFLAGS += -g -fPIC -Wall -Werror=implicit-function-declaration \
|
||||
-I${GALLIUMDIR}/state_trackers/g3dvl \
|
||||
-I${GALLIUMDIR}/winsys/g3dvl \
|
||||
-I${GALLIUMDIR}/include \
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/XvMC.h>
|
||||
#include <util/u_memory.h>
|
||||
#include <vl_display.h>
|
||||
#include <vl_screen.h>
|
||||
#include <vl_context.h>
|
||||
|
|
@ -26,7 +26,7 @@ Status XvMCCreateBlocks(Display *display, XvMCContext *context, unsigned int num
|
|||
|
||||
blocks->context_id = context->context_id;
|
||||
blocks->num_blocks = num_blocks;
|
||||
blocks->blocks = malloc(BLOCK_SIZE * num_blocks);
|
||||
blocks->blocks = MALLOC(BLOCK_SIZE * num_blocks);
|
||||
/* Since we don't have a VL type for blocks, set privData to the display so we can catch mismatches */
|
||||
blocks->privData = display;
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ Status XvMCDestroyBlocks(Display *display, XvMCBlockArray *blocks)
|
|||
assert(display);
|
||||
assert(blocks);
|
||||
assert(display == blocks->privData);
|
||||
free(blocks->blocks);
|
||||
FREE(blocks->blocks);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ Status XvMCCreateMacroBlocks(Display *display, XvMCContext *context, unsigned in
|
|||
|
||||
blocks->context_id = context->context_id;
|
||||
blocks->num_blocks = num_blocks;
|
||||
blocks->macro_blocks = malloc(sizeof(XvMCMacroBlock) * num_blocks);
|
||||
blocks->macro_blocks = MALLOC(sizeof(XvMCMacroBlock) * num_blocks);
|
||||
/* Since we don't have a VL type for blocks, set privData to the display so we can catch mismatches */
|
||||
blocks->privData = display;
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ Status XvMCDestroyMacroBlocks(Display *display, XvMCMacroBlockArray *blocks)
|
|||
assert(display);
|
||||
assert(blocks);
|
||||
assert(display == blocks->privData);
|
||||
free(blocks->macro_blocks);
|
||||
FREE(blocks->macro_blocks);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue