From 08f3a7cf7e9133f50adf33f800aa3696c909347f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Wed, 4 May 2011 19:58:33 +0200 Subject: [PATCH] vdpau: make state tracker far less noisy --- src/gallium/state_trackers/vdpau/bitmap.c | 4 +-- src/gallium/state_trackers/vdpau/decode.c | 10 +++---- src/gallium/state_trackers/vdpau/device.c | 12 ++++---- src/gallium/state_trackers/vdpau/mixer.c | 8 +++--- src/gallium/state_trackers/vdpau/output.c | 4 +-- .../state_trackers/vdpau/presentation.c | 6 ++-- src/gallium/state_trackers/vdpau/query.c | 18 ++++++------ src/gallium/state_trackers/vdpau/surface.c | 2 +- .../state_trackers/vdpau/vdpau_private.h | 28 ++++++++++++++++++- 9 files changed, 59 insertions(+), 33 deletions(-) diff --git a/src/gallium/state_trackers/vdpau/bitmap.c b/src/gallium/state_trackers/vdpau/bitmap.c index b570f2752e4..e336568df47 100644 --- a/src/gallium/state_trackers/vdpau/bitmap.c +++ b/src/gallium/state_trackers/vdpau/bitmap.c @@ -26,8 +26,8 @@ **************************************************************************/ #include + #include "vdpau_private.h" -#include VdpStatus vlVdpBitmapSurfaceCreate(VdpDevice device, @@ -36,7 +36,7 @@ vlVdpBitmapSurfaceCreate(VdpDevice device, VdpBool frequently_accessed, VdpBitmapSurface *surface) { - debug_printf("[VDPAU] Creating a bitmap surface\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Creating a bitmap surface\n"); if (!surface) return VDP_STATUS_INVALID_POINTER; diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c index 8e09cb61b11..3a366d35a93 100644 --- a/src/gallium/state_trackers/vdpau/decode.c +++ b/src/gallium/state_trackers/vdpau/decode.c @@ -46,7 +46,7 @@ vlVdpDecoderCreate(VdpDevice device, vlVdpDecoder *vldecoder; VdpStatus ret; - debug_printf("[VDPAU] Creating decoder\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Creating decoder\n"); if (!decoder) return VDP_STATUS_INVALID_POINTER; @@ -95,7 +95,7 @@ vlVdpDecoderCreate(VdpDevice device, goto error_handle; } - debug_printf("[VDPAU] Decoder created succesfully\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Decoder created succesfully\n"); return VDP_STATUS_OK; @@ -115,7 +115,7 @@ vlVdpDecoderDestroy(VdpDecoder decoder) { vlVdpDecoder *vldecoder; - debug_printf("[VDPAU] Destroying decoder\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Destroying decoder\n"); vldecoder = (vlVdpDecoder *)vlGetDataHTAB(decoder); if (!vldecoder) @@ -151,7 +151,7 @@ vlVdpDecoderRenderMpeg2(struct pipe_video_decoder *decoder, unsigned num_ycbcr_blocks[3] = { 0, 0, 0 }; unsigned i; - debug_printf("[VDPAU] Decoding MPEG2\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Decoding MPEG2\n"); /* if surfaces equals VDP_STATUS_INVALID_HANDLE, they are not used */ if (picture_info->forward_reference == VDP_INVALID_HANDLE) @@ -210,7 +210,7 @@ vlVdpDecoderRender(VdpDecoder decoder, vlVdpDecoder *vldecoder; vlVdpSurface *vlsurf; - debug_printf("[VDPAU] Decoding\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Decoding\n"); if (!(picture_info && bitstream_buffers)) return VDP_STATUS_INVALID_POINTER; diff --git a/src/gallium/state_trackers/vdpau/device.c b/src/gallium/state_trackers/vdpau/device.c index c0bf56edc2e..30c6b7aae4b 100644 --- a/src/gallium/state_trackers/vdpau/device.c +++ b/src/gallium/state_trackers/vdpau/device.c @@ -77,7 +77,7 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, } *get_proc_address = &vlVdpGetProcAddress; - debug_printf("[VDPAU] Device created succesfully\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Device created succesfully\n"); return VDP_STATUS_OK; @@ -100,7 +100,7 @@ vlVdpPresentationQueueTargetCreateX11(VdpDevice device, Drawable drawable, vlVdpPresentationQueueTarget *pqt; VdpStatus ret; - debug_printf("[VDPAU] Creating PresentationQueueTarget\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Creating PresentationQueueTarget\n"); if (!drawable) return VDP_STATUS_INVALID_HANDLE; @@ -134,7 +134,7 @@ vlVdpPresentationQueueTargetDestroy(VdpPresentationQueueTarget presentation_queu { vlVdpPresentationQueueTarget *pqt; - debug_printf("[VDPAU] Destroying PresentationQueueTarget\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Destroying PresentationQueueTarget\n"); pqt = vlGetDataHTAB(presentation_queue_target); if (!pqt) @@ -149,7 +149,7 @@ vlVdpPresentationQueueTargetDestroy(VdpPresentationQueueTarget presentation_queu VdpStatus vlVdpDeviceDestroy(VdpDevice device) { - debug_printf("[VDPAU] Destroying destroy\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Destroying destroy\n"); vlVdpDevice *dev = vlGetDataHTAB(device); if (!dev) @@ -158,7 +158,7 @@ vlVdpDeviceDestroy(VdpDevice device) FREE(dev); vlDestroyHTAB(); - debug_printf("[VDPAU] Device destroyed succesfully\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Device destroyed succesfully\n"); return VDP_STATUS_OK; } @@ -176,7 +176,7 @@ vlVdpGetProcAddress(VdpDevice device, VdpFuncId function_id, void **function_poi if (!vlGetFuncFTAB(function_id, function_pointer)) return VDP_STATUS_INVALID_FUNC_ID; - debug_printf("[VDPAU] Got proc adress %p for id %d\n", *function_pointer, function_id); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Got proc adress %p for id %d\n", *function_pointer, function_id); return VDP_STATUS_OK; } diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c index 0c0d200c6d4..85f4e1541ab 100644 --- a/src/gallium/state_trackers/vdpau/mixer.c +++ b/src/gallium/state_trackers/vdpau/mixer.c @@ -48,7 +48,7 @@ vlVdpVideoMixerCreate(VdpDevice device, VdpStatus ret; float csc[16]; - debug_printf("[VDPAU] Creating VideoMixer\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Creating VideoMixer\n"); vlVdpDevice *dev = vlGetDataHTAB(device); if (!dev) @@ -91,7 +91,7 @@ vlVdpVideoMixerDestroy(VdpVideoMixer mixer) { vlVdpVideoMixer *vmixer; - debug_printf("[VDPAU] Destroying VideoMixer\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Destroying VideoMixer\n"); vmixer = vlGetDataHTAB(mixer); if (!vmixer) @@ -110,7 +110,7 @@ vlVdpVideoMixerSetFeatureEnables(VdpVideoMixer mixer, VdpVideoMixerFeature const *features, VdpBool const *feature_enables) { - debug_printf("[VDPAU] Setting VideoMixer features\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Setting VideoMixer features\n"); if (!(features && feature_enables)) return VDP_STATUS_INVALID_POINTER; @@ -228,7 +228,7 @@ vlVdpGenerateCSCMatrix(VdpProcamp *procamp, VdpColorStandard standard, VdpCSCMatrix *csc_matrix) { - debug_printf("[VDPAU] Generating CSCMatrix\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Generating CSCMatrix\n"); if (!(csc_matrix && procamp)) return VDP_STATUS_INVALID_POINTER; diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c index 35b75ab3aa7..0257d38017a 100644 --- a/src/gallium/state_trackers/vdpau/output.c +++ b/src/gallium/state_trackers/vdpau/output.c @@ -46,7 +46,7 @@ vlVdpOutputSurfaceCreate(VdpDevice device, vlVdpOutputSurface *vlsurface = NULL; - debug_printf("[VDPAU] Creating output surface\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Creating output surface\n"); if (!(width && height)) return VDP_STATUS_INVALID_SIZE; @@ -110,7 +110,7 @@ vlVdpOutputSurfaceDestroy(VdpOutputSurface surface) { vlVdpOutputSurface *vlsurface; - debug_printf("[VDPAU] Destroying output surface\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Destroying output surface\n"); vlsurface = vlGetDataHTAB(surface); if (!vlsurface) diff --git a/src/gallium/state_trackers/vdpau/presentation.c b/src/gallium/state_trackers/vdpau/presentation.c index 1e2c78616e9..2f029f07fb1 100644 --- a/src/gallium/state_trackers/vdpau/presentation.c +++ b/src/gallium/state_trackers/vdpau/presentation.c @@ -43,7 +43,7 @@ vlVdpPresentationQueueCreate(VdpDevice device, struct pipe_video_context *context; VdpStatus ret; - _debug_printf("[VDPAU] Creating PresentationQueue\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Creating PresentationQueue\n"); if (!presentation_queue) return VDP_STATUS_INVALID_POINTER; @@ -91,7 +91,7 @@ vlVdpPresentationQueueDestroy(VdpPresentationQueue presentation_queue) { vlVdpPresentationQueue *pq; - _debug_printf("[VDPAU] Destroying PresentationQueue\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Destroying PresentationQueue\n"); pq = vlGetDataHTAB(presentation_queue); if (!pq) @@ -183,7 +183,7 @@ vlVdpPresentationQueueDisplay(VdpPresentationQueue presentation_queue, sprintf(cmd, "xwd -id %d -out vdpau_frame_%08d.xwd", (int)pq->drawable, ++framenum); if (system(cmd) != 0) - _debug_printf("[XvMC] Dumping surface %d failed.\n", surface); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Dumping surface %d failed.\n", surface); } return VDP_STATUS_OK; diff --git a/src/gallium/state_trackers/vdpau/query.c b/src/gallium/state_trackers/vdpau/query.c index 97522057a10..abe5b8f6701 100644 --- a/src/gallium/state_trackers/vdpau/query.c +++ b/src/gallium/state_trackers/vdpau/query.c @@ -62,7 +62,7 @@ vlVdpVideoSurfaceQueryCapabilities(VdpDevice device, VdpChromaType surface_chrom uint32_t max_2d_texture_level; VdpStatus ret; - debug_printf("[VDPAU] Querying video surfaces\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Querying video surfaces\n"); if (!(is_supported && max_width && max_height)) return VDP_STATUS_INVALID_POINTER; @@ -105,7 +105,7 @@ vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities(VdpDevice device, VdpChromaTyp { struct vl_screen *vlscreen; - debug_printf("[VDPAU] Querying get put video surfaces\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Querying get put video surfaces\n"); if (!is_supported) return VDP_STATUS_INVALID_POINTER; @@ -141,7 +141,7 @@ vlVdpDecoderQueryCapabilities(VdpDevice device, VdpDecoderProfile profile, uint32_t max_2d_texture_level; struct vl_screen *vlscreen; - debug_printf("[VDPAU] Querying decoder\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Querying decoder\n"); if (!(is_supported && max_level && max_macroblocks && max_width && max_height)) return VDP_STATUS_INVALID_POINTER; @@ -189,7 +189,7 @@ vlVdpOutputSurfaceQueryCapabilities(VdpDevice device, VdpRGBAFormat surface_rgba if (!(is_supported && max_width && max_height)) return VDP_STATUS_INVALID_POINTER; - debug_printf("[VDPAU] Querying ouput surfaces\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Querying ouput surfaces\n"); return VDP_STATUS_NO_IMPLEMENTATION; } @@ -198,7 +198,7 @@ VdpStatus vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities(VdpDevice device, VdpRGBAFormat surface_rgba_format, VdpBool *is_supported) { - debug_printf("[VDPAU] Querying output surfaces get put native cap\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Querying output surfaces get put native cap\n"); if (!is_supported) return VDP_STATUS_INVALID_POINTER; @@ -213,7 +213,7 @@ vlVdpOutputSurfaceQueryPutBitsIndexedCapabilities(VdpDevice device, VdpColorTableFormat color_table_format, VdpBool *is_supported) { - debug_printf("[VDPAU] Querying output surfaces get put indexed cap\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Querying output surfaces get put indexed cap\n"); if (!is_supported) return VDP_STATUS_INVALID_POINTER; @@ -226,7 +226,7 @@ vlVdpOutputSurfaceQueryPutBitsYCbCrCapabilities(VdpDevice device, VdpRGBAFormat VdpYCbCrFormat bits_ycbcr_format, VdpBool *is_supported) { - debug_printf("[VDPAU] Querying output surfaces put ycrcb cap\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Querying output surfaces put ycrcb cap\n"); if (!is_supported) return VDP_STATUS_INVALID_POINTER; @@ -237,7 +237,7 @@ VdpStatus vlVdpBitmapSurfaceQueryCapabilities(VdpDevice device, VdpRGBAFormat surface_rgba_format, VdpBool *is_supported, uint32_t *max_width, uint32_t *max_height) { - debug_printf("[VDPAU] Querying bitmap surfaces\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Querying bitmap surfaces\n"); if (!(is_supported && max_width && max_height)) return VDP_STATUS_INVALID_POINTER; @@ -248,7 +248,7 @@ VdpStatus vlVdpVideoMixerQueryFeatureSupport(VdpDevice device, VdpVideoMixerFeature feature, VdpBool *is_supported) { - debug_printf("[VDPAU] Querying mixer feature support\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Querying mixer feature support\n"); if (!is_supported) return VDP_STATUS_INVALID_POINTER; diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c index dcbc6e61916..c2945c787da 100644 --- a/src/gallium/state_trackers/vdpau/surface.c +++ b/src/gallium/state_trackers/vdpau/surface.c @@ -44,7 +44,7 @@ vlVdpVideoSurfaceCreate(VdpDevice device, VdpChromaType chroma_type, vlVdpSurface *p_surf; VdpStatus ret; - _debug_printf("[VDPAU] Creating a surface\n"); + VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Creating a surface\n"); if (!(width && height)) { ret = VDP_STATUS_INVALID_SIZE; diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h index 5931a2dda34..cbc51d57e36 100644 --- a/src/gallium/state_trackers/vdpau/vdpau_private.h +++ b/src/gallium/state_trackers/vdpau/vdpau_private.h @@ -28,12 +28,17 @@ #ifndef VDPAU_PRIVATE_H #define VDPAU_PRIVATE_H +#include + #include #include + #include #include + +#include + #include -#include #define INFORMATION G3DVL VDPAU Driver Shared Library version VER_MAJOR.VER_MINOR #define QUOTEME(x) #x @@ -288,4 +293,25 @@ VdpVideoMixerGetAttributeValues vlVdpVideoMixerGetAttributeValues; VdpVideoMixerDestroy vlVdpVideoMixerDestroy; VdpGenerateCSCMatrix vlVdpGenerateCSCMatrix; +#define VDPAU_OUT 0 +#define VDPAU_ERR 1 +#define VDPAU_WARN 2 +#define VDPAU_TRACE 3 + +static inline void VDPAU_MSG(unsigned int level, const char *fmt, ...) +{ + static int debug_level = -1; + + if (debug_level == -1) { + debug_level = MAX2(debug_get_num_option("VDPAU_DEBUG", 0), 0); + } + + if (level <= debug_level) { + va_list ap; + va_start(ap, fmt); + _debug_vprintf(fmt, ap); + va_end(ap); + } +} + #endif // VDPAU_PRIVATE_H -- 2.30.2