Commit c13efdd3 authored by Paulo Cesar Pereira de Andrade's avatar Paulo Cesar Pereira de Andrade Committed by Zhenyu Wang

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.
parent 8cdbd55f
......@@ -391,6 +391,7 @@ i830_crt_destroy (xf86OutputPtr output)
xfree (output->driver_private);
}
#ifdef RANDR_GET_CRTC_INTERFACE
static xf86CrtcPtr
i830_crt_get_crtc(xf86OutputPtr output)
{
......@@ -400,6 +401,7 @@ i830_crt_get_crtc(xf86OutputPtr output)
return i830_pipe_to_crtc(pScrn, pipe);
}
#endif
static const xf86OutputFuncsRec i830_crt_output_funcs = {
.dpms = i830_crt_dpms,
......
......@@ -330,6 +330,7 @@ i830_dvo_destroy (xf86OutputPtr output)
}
}
#ifdef RANDR_GET_CRTC_INTERFACE
static xf86CrtcPtr
i830_dvo_get_crtc(xf86OutputPtr output)
{
......@@ -341,6 +342,7 @@ i830_dvo_get_crtc(xf86OutputPtr output)
return i830_pipe_to_crtc(pScrn, pipe);
}
#endif
static const xf86OutputFuncsRec i830_dvo_output_funcs = {
.dpms = i830_dvo_dpms,
......
......@@ -879,6 +879,7 @@ i830_lvds_get_property(xf86OutputPtr output, Atom property)
}
#endif /* RANDR_13_INTERFACE */
#ifdef RANDR_GET_CRTC_INTERFACE
static xf86CrtcPtr
i830_lvds_get_crtc(xf86OutputPtr output)
{
......@@ -888,6 +889,7 @@ i830_lvds_get_crtc(xf86OutputPtr output)
return i830_pipe_to_crtc(pScrn, pipe);
}
#endif
static const xf86OutputFuncsRec i830_lvds_output_funcs = {
.create_resources = i830_lvds_create_resources,
......
......@@ -1146,6 +1146,7 @@ i830_sdvo_destroy (xf86OutputPtr output)
}
}
#ifdef RANDR_GET_CRTC_INTERFACE
static xf86CrtcPtr
i830_sdvo_get_crtc(xf86OutputPtr output)
{
......@@ -1157,6 +1158,7 @@ i830_sdvo_get_crtc(xf86OutputPtr output)
return i830_pipe_to_crtc(pScrn, pipe);
}
#endif
static const xf86OutputFuncsRec i830_sdvo_output_funcs = {
.dpms = i830_sdvo_dpms,
......
......@@ -1640,6 +1640,7 @@ i830_tv_set_property(xf86OutputPtr output, Atom property,
}
#endif /* RANDR_12_INTERFACE */
#ifdef RANDR_GET_CRTC_INTERFACE
static xf86CrtcPtr
i830_tv_get_crtc(xf86OutputPtr output)
{
......@@ -1649,6 +1650,7 @@ i830_tv_get_crtc(xf86OutputPtr output)
return i830_pipe_to_crtc(pScrn, pipe);
}
#endif
static const xf86OutputFuncsRec i830_tv_output_funcs = {
.create_resources = i830_tv_create_resources,
......
......@@ -565,6 +565,9 @@ I830InitVideo(ScreenPtr pScreen)
XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL;
XF86VideoAdaptorPtr overlayAdaptor = NULL, texturedAdaptor = NULL;
int num_adaptors;
#ifdef INTEL_XVMC
Bool xvmc_status = FALSE;
#endif
#if 0
{
......@@ -627,10 +630,9 @@ I830InitVideo(ScreenPtr pScreen)
I830InitOffscreenImages(pScreen);
}
#ifdef INTEL_XVMC
Bool ret = FALSE;
if (intel_xvmc_probe(pScrn)) {
if (texturedAdaptor)
ret = intel_xvmc_driver_init(pScreen, texturedAdaptor);
xvmc_status = intel_xvmc_driver_init(pScreen, texturedAdaptor);
}
#endif
......@@ -638,7 +640,7 @@ I830InitVideo(ScreenPtr pScreen)
xf86XVScreenInit(pScreen, adaptors, num_adaptors);
#ifdef INTEL_XVMC
if (ret)
if (xvmc_status)
intel_xvmc_screen_init(pScreen);
#endif
xfree(adaptors);
......
......@@ -97,6 +97,7 @@ typedef struct _I915XvMC
#define ARRARY_SIZE(a) (sizeof(a) / sizeof(a[0]))
/*
static int yv12_subpicture_index_list[2] =
{
FOURCC_IA44,
......@@ -108,6 +109,7 @@ static XF86MCImageIDList yv12_subpicture_list =
ARRARY_SIZE(yv12_subpicture_index_list),
yv12_subpicture_index_list
};
*/
static XF86MCSurfaceInfoRec i915_YV12_mpg2_surface =
{
......@@ -147,6 +149,7 @@ static XF86MCSurfaceInfoPtr ppSI[2] =
(XF86MCSurfaceInfoPtr)&i915_YV12_mpg1_surface
};
#if 0
/* List of subpicture types that we support */
static XF86ImageRec ia44_subpicture = XVIMAGE_IA44;
static XF86ImageRec ai44_subpicture = XVIMAGE_AI44;
......@@ -156,7 +159,7 @@ static XF86ImagePtr i915_subpicture_list[2] =
(XF86ImagePtr)&ia44_subpicture,
(XF86ImagePtr)&ai44_subpicture
};
#endif
/*
* Init and clean up the screen private parts of XvMC.
......
......@@ -25,7 +25,6 @@
*
*/
#include <pthread.h>
#include <sys/ioctl.h>
#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(&macroblock_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(&macroblock_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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -27,6 +27,7 @@
#ifndef INTEL_XVMC_H
#define INTEL_XVMC_H
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
......
......@@ -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;
......
......@@ -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_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment