**************************************************************************/
#include <vdpau/vdpau.h>
+
#include "vdpau_private.h"
-#include <util/u_debug.h>
VdpStatus
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;
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;
goto error_handle;
}
- debug_printf("[VDPAU] Decoder created succesfully\n");
+ VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Decoder created succesfully\n");
return VDP_STATUS_OK;
{
vlVdpDecoder *vldecoder;
- debug_printf("[VDPAU] Destroying decoder\n");
+ VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Destroying decoder\n");
vldecoder = (vlVdpDecoder *)vlGetDataHTAB(decoder);
if (!vldecoder)
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)
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;
}
*get_proc_address = &vlVdpGetProcAddress;
- debug_printf("[VDPAU] Device created succesfully\n");
+ VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Device created succesfully\n");
return VDP_STATUS_OK;
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;
{
vlVdpPresentationQueueTarget *pqt;
- debug_printf("[VDPAU] Destroying PresentationQueueTarget\n");
+ VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Destroying PresentationQueueTarget\n");
pqt = vlGetDataHTAB(presentation_queue_target);
if (!pqt)
VdpStatus
vlVdpDeviceDestroy(VdpDevice device)
{
- debug_printf("[VDPAU] Destroying destroy\n");
+ VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Destroying destroy\n");
vlVdpDevice *dev = vlGetDataHTAB(device);
if (!dev)
FREE(dev);
vlDestroyHTAB();
- debug_printf("[VDPAU] Device destroyed succesfully\n");
+ VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Device destroyed succesfully\n");
return VDP_STATUS_OK;
}
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;
}
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)
{
vlVdpVideoMixer *vmixer;
- debug_printf("[VDPAU] Destroying VideoMixer\n");
+ VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Destroying VideoMixer\n");
vmixer = vlGetDataHTAB(mixer);
if (!vmixer)
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;
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;
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;
{
vlVdpOutputSurface *vlsurface;
- debug_printf("[VDPAU] Destroying output surface\n");
+ VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Destroying output surface\n");
vlsurface = vlGetDataHTAB(surface);
if (!vlsurface)
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;
{
vlVdpPresentationQueue *pq;
- _debug_printf("[VDPAU] Destroying PresentationQueue\n");
+ VDPAU_MSG(VDPAU_TRACE, "[VDPAU] Destroying PresentationQueue\n");
pq = vlGetDataHTAB(presentation_queue);
if (!pq)
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;
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;
{
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;
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;
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;
}
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;
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;
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;
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;
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;
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;
#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
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