From c13efdd3d6d3846078766814b57306a7519bce18 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Wed, 26 Mar 2008 10:11:36 +0800 Subject: More compile warning fixes. o Check for RANDR_GET_CRTC_INTERFACE before defining functions that are used only if it is defined. o Declare a variable before code, and rename it from ret to xvmc_status to better describe it. o if 0 some static functions not used. o Don't declare some unused variables. o Declare as static some functions that are used only in the file defining it. o Add a default/fallback return True to the Bool function src/xvmc/intel_batchbuffer.c:intelInitBatchBuffer(). o Ansify src/xvmc/xf86dri.c. o Add missing prototype to src/xvmc/xf86dri.h and follow pattern of other headers by adding "extern" before function prototype. --- src/xvmc/i915_xvmc.c | 29 ++++++++++-------- src/xvmc/intel_batchbuffer.c | 15 ++++----- src/xvmc/intel_xvmc.c | 4 +-- src/xvmc/intel_xvmc.h | 1 + src/xvmc/xf86dri.c | 73 ++++++++++++-------------------------------- src/xvmc/xf86dri.h | 31 +++++++++++-------- 6 files changed, 66 insertions(+), 87 deletions(-) (limited to 'src/xvmc') diff --git a/src/xvmc/i915_xvmc.c b/src/xvmc/i915_xvmc.c index b30facdf..20b2e613 100644 --- a/src/xvmc/i915_xvmc.c +++ b/src/xvmc/i915_xvmc.c @@ -25,7 +25,6 @@ * */ -#include #include #include "i915_xvmc.h" @@ -56,6 +55,7 @@ typedef union { uint u[2]; } su_t; +#if 0 static int findOverlap(unsigned int width, unsigned int height, short *dstX, short *dstY, short *srcX, short *srcY, @@ -91,6 +91,7 @@ static int findOverlap(unsigned int width, unsigned int height, *areaH = (h <= mHeight) ? h : mHeight; return 0; } +#endif static void i915_flush(int map, int render) { @@ -117,7 +118,7 @@ static void i915_mc_static_indirect_state_buffer(XvMCContext *context, struct i915_3dstate_dest_buffer_variables_mpeg *dest_buffer_variables_mpeg; i915XvMCSurface *pI915Surface = (i915XvMCSurface *)surface->privData; i915XvMCContext *pI915XvMC = (i915XvMCContext *)context->privData; - unsigned int w = surface->width, h = surface->height; + unsigned int w = surface->width; /* 3DSTATE_BUFFER_INFO */ /* DEST Y */ @@ -459,7 +460,7 @@ static void i915_mc_mpeg_macroblock_ipicture(XvMCContext *context, XvMCMacroBloc intelBatchbufferData(¯oblock_ipicture, sizeof(macroblock_ipicture), 0); } - +#if 0 static void i915_mc_mpeg_macroblock_0mv(XvMCContext *context, XvMCMacroBlock *mb) { struct i915_3dmpeg_macroblock_0mv macroblock_0mv; @@ -487,6 +488,7 @@ static void i915_mc_mpeg_macroblock_0mv(XvMCContext *context, XvMCMacroBlock *mb intelBatchbufferData(¯oblock_0mv, sizeof(macroblock_0mv), 0); } +#endif static void i915_mc_mpeg_macroblock_1fbmv(XvMCContext *context, XvMCMacroBlock *mb) { @@ -529,7 +531,6 @@ static void i915_mc_mpeg_macroblock_1fbmv(XvMCContext *context, XvMCMacroBlock * static void i915_mc_mpeg_macroblock_2fbmv(XvMCContext *context, XvMCMacroBlock *mb, unsigned int ps) { struct i915_3dmpeg_macroblock_2fbmv macroblock_2fbmv; - i915XvMCContext *pI915XvMC = (i915XvMCContext *)context->privData; /* Motion Vectors */ su_t fmv; @@ -979,6 +980,7 @@ static void i915_mc_one_time_state_initialization(XvMCContext *context) free(base); } +#if 0 static void i915_mc_invalidate_subcontext_buffers(XvMCContext *context, unsigned int mask) { struct i915_3dstate_load_indirect *load_indirect = NULL; @@ -1086,6 +1088,7 @@ static void i915_mc_invalidate_subcontext_buffers(XvMCContext *context, unsigned intelBatchbufferData(base, size, 0); free(base); } +#endif static int i915_xvmc_map_buffers(i915XvMCContext *pI915XvMC) { @@ -1167,6 +1170,7 @@ static void i915_xvmc_unmap_buffers(i915XvMCContext *pI915XvMC) } } +#if 0 /* * Video post processing */ @@ -1243,7 +1247,9 @@ static void i915_yuv2rgb_map_state_buffer(XvMCSurface *target_surface) tm->tm2.cube_face = 0; tm->tm2.pitch = (privTarget->uvStride >> 2) - 1; /* in DWords - 1 */ } +#endif +#if 0 static void i915_yuv2rgb_sampler_state_buffer(XvMCSurface *surface) { struct i915_3dstate_sampler_state *sampler_state; @@ -1340,7 +1346,9 @@ static void i915_yuv2rgb_sampler_state_buffer(XvMCSurface *surface) ts->ts1.east_deinterlacer = 0; ts->ts2.default_color = 0; } +#endif +#if 0 static void i915_yuv2rgb_static_indirect_state_buffer(XvMCSurface *surface, unsigned int dstaddr, int dstpitch) @@ -1374,7 +1382,9 @@ static void i915_yuv2rgb_static_indirect_state_buffer(XvMCSurface *surface, dest_buffer_variables->dw1.dest_h_bias = 8; dest_buffer_variables->dw1.color_fmt = COLORBUFFER_A8R8G8B8; /* FIXME */ } +#endif +#if 0 static void i915_yuv2rgb_pixel_shader_program_buffer(XvMCSurface *surface) { struct i915_3dstate_pixel_shader_program *pixel_shader_program; @@ -1424,7 +1434,9 @@ static void i915_yuv2rgb_pixel_shader_program_buffer(XvMCSurface *surface) src1 = UREG(REG_TYPE_S, 2); /* SAMPLER */ i915_inst_texld(inst, T0_TEXLD, dest, src0, src1); } +#endif +#if 0 static void i915_yuv2rgb_proc(XvMCSurface *surface) { i915XvMCSurface *privSurface = (i915XvMCSurface *)surface->privData; @@ -1581,6 +1593,7 @@ static void i915_yuv2rgb_proc(XvMCSurface *surface) intelBatchbufferData(base, size, 0); free(base); } +#endif /* * Function: i915_release_resource @@ -1588,7 +1601,6 @@ static void i915_yuv2rgb_proc(XvMCSurface *surface) static void i915_release_resource(Display *display, XvMCContext *context) { i915XvMCContext *pI915XvMC; - int screen = DefaultScreen(display); if (!(pI915XvMC = context->privData)) return; @@ -1608,13 +1620,7 @@ static Status i915_xvmc_mc_create_context(Display *display, XvMCContext *context { i915XvMCContext *pI915XvMC = NULL; I915XvMCCreateContextRec *tmpComm = NULL; - Status ret; drm_sarea_t *pSAREA; - char *curBusID; - uint magic; - int major, minor; - int isCapable; - int screen = DefaultScreen(display); XVMC_DBG("%s\n", __FUNCTION__); @@ -1718,7 +1724,6 @@ static Status i915_xvmc_mc_create_surface(Display *display, XvMCContext *context, XvMCSurface *surface, int priv_count, CARD32 *priv_data) { - Status ret; i915XvMCContext *pI915XvMC; i915XvMCSurface *pI915Surface; I915XvMCCreateSurfaceRec *tmpComm = NULL; diff --git a/src/xvmc/intel_batchbuffer.c b/src/xvmc/intel_batchbuffer.c index a3f82ff1..224d0de0 100644 --- a/src/xvmc/intel_batchbuffer.c +++ b/src/xvmc/intel_batchbuffer.c @@ -48,7 +48,7 @@ #define MI_BATCH_BUFFER_END (0xA << 23) -int intelEmitIrqLocked(void) +static int intelEmitIrqLocked(void) { drmI830IrqEmit ie; int ret, seq; @@ -65,7 +65,7 @@ int intelEmitIrqLocked(void) return seq; } -void intelWaitIrq(int seq) +static void intelWaitIrq(int seq) { int ret; drmI830IrqWait iw; @@ -118,6 +118,7 @@ Bool intelInitBatchBuffer(void) xvmc_driver->alloc.active_buf = 0; assert(xvmc_driver->alloc.ptr); + return True; } void intelFiniBatchBuffer(void) @@ -129,7 +130,7 @@ void intelFiniBatchBuffer(void) intelDestroyBatchBuffer(); } -void intelBatchbufferRequireSpace(unsigned int sz) +static void intelBatchbufferRequireSpace(unsigned int sz) { if (xvmc_driver->batch.space < sz) intelFlushBatch(TRUE); @@ -152,7 +153,7 @@ void intelBatchbufferData(const void *data, unsigned bytes, unsigned flags) #define FLUSH_RENDER_CACHE (0 << 2) #define FLUSH_WRITE_DIRTY_STATE (1 << 4) -void intelRefillBatchLocked(Bool allow_unlock ) +static void intelRefillBatchLocked(Bool allow_unlock) { unsigned half = xvmc_driver->alloc.size >> 1; unsigned buf = (xvmc_driver->alloc.active_buf ^= 1); @@ -175,9 +176,9 @@ void intelRefillBatchLocked(Bool allow_unlock ) } -void intelFlushBatchLocked(Bool ignore_cliprects, - Bool refill, - Bool allow_unlock) +static void intelFlushBatchLocked(Bool ignore_cliprects, + Bool refill, + Bool allow_unlock) { drmI830BatchBuffer batch; diff --git a/src/xvmc/intel_xvmc.c b/src/xvmc/intel_xvmc.c index 489a2c2c..1be8cc6b 100644 --- a/src/xvmc/intel_xvmc.c +++ b/src/xvmc/intel_xvmc.c @@ -250,7 +250,7 @@ Status XvMCCreateContext(Display *display, XvPortID port, XVMC_ERR("Unable to create XvMC Context."); return ret; } - XVMC_DBG("new context %d created\n", context->context_id); + XVMC_DBG("new context %d created\n", (int)context->context_id); comm = (struct _intel_xvmc_common *)priv_data; @@ -341,7 +341,7 @@ Status XvMCCreateContext(Display *display, XvPortID port, context->context_id, &intel_ctx->hw_context)) { XVMC_ERR("Could not create DRI context for xvmc ctx %d.", - context->context_id); + (int)context->context_id); XFree(priv_data); context->privData = NULL; drmUnmap(xvmc_driver->sarea_address, xvmc_driver->sarea_size); diff --git a/src/xvmc/intel_xvmc.h b/src/xvmc/intel_xvmc.h index 3375ffc4..55066838 100644 --- a/src/xvmc/intel_xvmc.h +++ b/src/xvmc/intel_xvmc.h @@ -27,6 +27,7 @@ #ifndef INTEL_XVMC_H #define INTEL_XVMC_H +#include #include #include #include diff --git a/src/xvmc/xf86dri.c b/src/xvmc/xf86dri.c index 798c1a84..96987bfa 100644 --- a/src/xvmc/xf86dri.c +++ b/src/xvmc/xf86dri.c @@ -88,9 +88,8 @@ XEXT_GENERATE_FIND_DISPLAY(find_display, xf86dri_info, #else #define TRACE(msg, arg...) #endif - Bool uniDRIQueryExtension(dpy, event_basep, error_basep) - Display *dpy; - int *event_basep, *error_basep; +Bool +uniDRIQueryExtension(Display *dpy, int *event_basep, int *error_basep) { XExtDisplayInfo *info = find_display(dpy); @@ -107,11 +106,8 @@ XEXT_GENERATE_FIND_DISPLAY(find_display, xf86dri_info, } Bool -uniDRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion) - Display *dpy; - int *majorVersion; - int *minorVersion; - int *patchVersion; +uniDRIQueryVersion(Display *dpy, int *majorVersion, int *minorVersion, + int *patchVersion) { XExtDisplayInfo *info = find_display(dpy); xXF86DRIQueryVersionReply rep; @@ -141,10 +137,7 @@ uniDRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion) } Bool -uniDRIQueryDirectRenderingCapable(dpy, screen, isCapable) - Display *dpy; - int screen; - Bool *isCapable; +uniDRIQueryDirectRenderingCapable(Display *dpy, int screen, Bool *isCapable) { XExtDisplayInfo *info = find_display(dpy); xXF86DRIQueryDirectRenderingCapableReply rep; @@ -173,11 +166,8 @@ uniDRIQueryDirectRenderingCapable(dpy, screen, isCapable) } Bool -uniDRIOpenConnection(dpy, screen, hSAREA, busIdString) - Display *dpy; - int screen; - drm_handle_t *hSAREA; - char **busIdString; +uniDRIOpenConnection(Display *dpy, int screen, + drm_handle_t *hSAREA, char **busIdString) { XExtDisplayInfo *info = find_display(dpy); xXF86DRIOpenConnectionReply rep; @@ -224,10 +214,7 @@ uniDRIOpenConnection(dpy, screen, hSAREA, busIdString) } Bool -uniDRIAuthConnection(dpy, screen, magic) - Display *dpy; - int screen; - drm_magic_t magic; +uniDRIAuthConnection(Display *dpy, int screen, drm_magic_t magic) { XExtDisplayInfo *info = find_display(dpy); xXF86DRIAuthConnectionReq *req; @@ -256,9 +243,7 @@ uniDRIAuthConnection(dpy, screen, magic) } Bool -uniDRICloseConnection(dpy, screen) - Display *dpy; - int screen; +uniDRICloseConnection(Display *dpy, int screen) { XExtDisplayInfo *info = find_display(dpy); xXF86DRICloseConnectionReq *req; @@ -279,14 +264,9 @@ uniDRICloseConnection(dpy, screen) } Bool -uniDRIGetClientDriverName(dpy, screen, ddxDriverMajorVersion, - ddxDriverMinorVersion, ddxDriverPatchVersion, clientDriverName) - Display *dpy; - int screen; - int *ddxDriverMajorVersion; - int *ddxDriverMinorVersion; - int *ddxDriverPatchVersion; - char **clientDriverName; +uniDRIGetClientDriverName(Display *dpy, int screen, int *ddxDriverMajorVersion, + int *ddxDriverMinorVersion, int *ddxDriverPatchVersion, + char **clientDriverName) { XExtDisplayInfo *info = find_display(dpy); xXF86DRIGetClientDriverNameReply rep; @@ -331,12 +311,8 @@ uniDRIGetClientDriverName(dpy, screen, ddxDriverMajorVersion, } Bool -uniDRICreateContextWithConfig(dpy, screen, configID, context, hHWContext) - Display *dpy; - int screen; - int configID; - XID context; - drm_context_t *hHWContext; +uniDRICreateContextWithConfig(Display *dpy, int screen, int configID, + XID context, drm_context_t *hHWContext) { XExtDisplayInfo *info = find_display(dpy); xXF86DRICreateContextReply rep; @@ -366,12 +342,8 @@ uniDRICreateContextWithConfig(dpy, screen, configID, context, hHWContext) } Bool -uniDRICreateContext(dpy, screen, visual, context, hHWContext) - Display *dpy; - int screen; - Visual *visual; - XID context; - drm_context_t *hHWContext; +uniDRICreateContext(Display *dpy, int screen, Visual *visual, + XID context, drm_context_t *hHWContext) { return uniDRICreateContextWithConfig(dpy, screen, visual->visualid, context, hHWContext); @@ -539,16 +511,9 @@ uniDRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable, } Bool -uniDRIGetDeviceInfo(dpy, screen, hFrameBuffer, - fbOrigin, fbSize, fbStride, devPrivateSize, pDevPrivate) - Display *dpy; - int screen; - drm_handle_t *hFrameBuffer; - int *fbOrigin; - int *fbSize; - int *fbStride; - int *devPrivateSize; - void **pDevPrivate; +uniDRIGetDeviceInfo(Display *dpy, int screen, drm_handle_t *hFrameBuffer, + int *fbOrigin, int *fbSize, int *fbStride, + int *devPrivateSize, void **pDevPrivate) { XExtDisplayInfo *info = find_display(dpy); xXF86DRIGetDeviceInfoReply rep; diff --git a/src/xvmc/xf86dri.h b/src/xvmc/xf86dri.h index 7598bc81..81cfdfdd 100644 --- a/src/xvmc/xf86dri.h +++ b/src/xvmc/xf86dri.h @@ -66,33 +66,33 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef _XF86DRI_SERVER_ _XFUNCPROTOBEGIN - Bool uniDRIQueryExtension(Display * dpy, int *event_base, +extern Bool uniDRIQueryExtension(Display * dpy, int *event_base, int *error_base); -Bool uniDRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion, - int *patchVersion); +extern Bool uniDRIQueryVersion(Display * dpy, int *majorVersion, + int *minorVersion, int *patchVersion); -Bool uniDRIQueryDirectRenderingCapable(Display * dpy, int screen, +extern Bool uniDRIQueryDirectRenderingCapable(Display * dpy, int screen, Bool * isCapable); -Bool uniDRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA, +extern Bool uniDRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA, char **busIDString); -Bool uniDRIAuthConnection(Display * dpy, int screen, drm_magic_t magic); +extern Bool uniDRIAuthConnection(Display * dpy, int screen, drm_magic_t magic); -Bool uniDRICloseConnection(Display * dpy, int screen); +extern Bool uniDRICloseConnection(Display * dpy, int screen); -Bool uniDRIGetClientDriverName(Display * dpy, int screen, +extern Bool uniDRIGetClientDriverName(Display * dpy, int screen, int *ddxDriverMajorVersion, int *ddxDriverMinorVersion, int *ddxDriverPatchVersion, char **clientDriverName); /* XvMC context XID is alloced in _xvmc_create_context, so * don't recreate here */ -Bool uniDRICreateContext(Display * dpy, int screen, Visual * visual, +extern Bool uniDRICreateContext(Display * dpy, int screen, Visual * visual, XID context_id, drm_context_t * hHWContext); -Bool uniDRICreateContextWithConfig(Display * dpy, int screen, int configID, - XID context_id, drm_context_t * hHWContext); +extern Bool uniDRICreateContextWithConfig(Display * dpy, int screen, + int configID, XID context_id, drm_context_t * hHWContext); extern Bool uniDRIDestroyContext(Display * dpy, int screen, XID context_id); @@ -102,10 +102,17 @@ extern Bool uniDRICreateDrawable(Display * dpy, int screen, extern Bool uniDRIDestroyDrawable(Display * dpy, int screen, Drawable drawable); -Bool uniDRIGetDeviceInfo(Display * dpy, int screen, +extern Bool uniDRIGetDeviceInfo(Display * dpy, int screen, drm_handle_t * hFrameBuffer, int *fbOrigin, int *fbSize, int *fbStride, int *devPrivateSize, void **pDevPrivate); +extern Bool uniDRIGetDrawableInfo(Display * dpy, int screen, + Drawable drawable, unsigned int *index, unsigned int *stamp, + int *X, int *Y, int *W, int *H, + int *numClipRects, drm_clip_rect_t ** pClipRects, + int *backX, int *backY, + int *numBackClipRects, drm_clip_rect_t ** pBackClipRects); + _XFUNCPROTOEND #endif /* _XF86DRI_SERVER_ */ #endif /* _XF86DRI_H_ */ -- cgit v1.2.3