OSDN Git Service

vdpau: make state tracker far less noisy
authorChristian König <deathsimple@vodafone.de>
Wed, 4 May 2011 17:58:33 +0000 (19:58 +0200)
committerChristian König <deathsimple@vodafone.de>
Wed, 4 May 2011 17:58:33 +0000 (19:58 +0200)
src/gallium/state_trackers/vdpau/bitmap.c
src/gallium/state_trackers/vdpau/decode.c
src/gallium/state_trackers/vdpau/device.c
src/gallium/state_trackers/vdpau/mixer.c
src/gallium/state_trackers/vdpau/output.c
src/gallium/state_trackers/vdpau/presentation.c
src/gallium/state_trackers/vdpau/query.c
src/gallium/state_trackers/vdpau/surface.c
src/gallium/state_trackers/vdpau/vdpau_private.h

index b570f27..e336568 100644 (file)
@@ -26,8 +26,8 @@
  **************************************************************************/
 
 #include <vdpau/vdpau.h>
+
 #include "vdpau_private.h"
-#include <util/u_debug.h>
 
 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;
 
index 8e09cb6..3a366d3 100644 (file)
@@ -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;
index c0bf56e..30c6b7a 100644 (file)
@@ -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;
 }
index 0c0d200..85f4e15 100644 (file)
@@ -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;
 
index 35b75ab..0257d38 100644 (file)
@@ -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)
index 1e2c786..2f029f0 100644 (file)
@@ -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;
index 9752205..abe5b8f 100644 (file)
@@ -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;
 
index dcbc6e6..c2945c7 100644 (file)
@@ -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;
index 5931a2d..cbc51d5 100644 (file)
 #ifndef VDPAU_PRIVATE_H
 #define VDPAU_PRIVATE_H
 
+#include <assert.h>
+
 #include <vdpau/vdpau.h>
 #include <vdpau/vdpau_x11.h>
+
 #include <pipe/p_compiler.h>
 #include <pipe/p_video_context.h>
+
+#include <util/u_debug.h>
+
 #include <vl_winsys.h>
-#include <assert.h>
 
 #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