vl: implemented a few functions and made stubs to get mplayer running

This commit is contained in:
Thomas Balling Sørensen
2010-10-06 23:30:08 +02:00
parent d0e203f1f0
commit 65fe0866ae
14 changed files with 387 additions and 44 deletions

View File

@@ -31,6 +31,7 @@
#include <util/u_inlines.h>
#include <util/u_memory.h>
#include <util/u_keymap.h>
#include <util/u_draw.h>
#include <util/u_sampler.h>
#include <tgsi/tgsi_ureg.h>
#include "vl_csc.h"

View File

@@ -34,6 +34,7 @@
#include <util/u_memory.h>
#include <util/u_keymap.h>
#include <util/u_sampler.h>
#include <util/u_draw.h>
#include <tgsi/tgsi_ureg.h>
#define DEFAULT_BUF_ALIGNMENT 1

View File

@@ -20,7 +20,9 @@ C_SOURCES = htab.c \
presentation.c \
bitmap.c \
mpeg2_bitstream_parser.c \
output.c
output.c \
preemption.c \
mixer.c
include ../../Makefile.template

View File

@@ -98,6 +98,7 @@ VdpStatus
vlVdpDecoderDestroy (VdpDecoder decoder
)
{
debug_printf("[VDPAU] Destroying decoder\n");
vlVdpDecoder *vldecoder;
vldecoder = (vlVdpDecoder *)vlGetDataHTAB(decoder);
@@ -105,8 +106,11 @@ vlVdpDecoderDestroy (VdpDecoder decoder
return VDP_STATUS_INVALID_HANDLE;
}
if (vldecoder->vctx->vscreen)
vl_screen_destroy(vldecoder->vctx->vscreen);
if (vldecoder->vctx)
{
if (vldecoder->vctx->vscreen)
vl_screen_destroy(vldecoder->vctx->vscreen);
}
if (vldecoder->vctx)
vl_video_destroy(vldecoder->vctx);
@@ -124,6 +128,8 @@ vlVdpCreateSurfaceTarget (vlVdpDecoder *vldecoder,
struct pipe_resource tmplt;
struct pipe_resource *surf_tex;
struct pipe_video_context *vpipe;
debug_printf("[VDPAU] Creating surface\n");
if(!(vldecoder && vlsurf))
return VDP_STATUS_INVALID_POINTER;
@@ -185,6 +191,7 @@ vlVdpDecoderRenderMpeg2 (vlVdpDecoder *vldecoder,
struct pipe_mpeg12_macroblock *pipe_macroblocks;
VdpStatus ret;
debug_printf("[VDPAU] Decoding MPEG2\n");
vpipe = vldecoder->vctx->vpipe;
t_vdp_surf = vlsurf;
@@ -221,7 +228,7 @@ vlVdpDecoderRenderMpeg2 (vlVdpDecoder *vldecoder,
}
vpipe->set_decode_target(vpipe,t_surf);
vpipe->decode_macroblocks(vpipe, p_surf, f_surf, num_macroblocks, (struct pipe_macroblock *)pipe_macroblocks, NULL);
//vpipe->decode_macroblocks(vpipe, p_surf, f_surf, num_macroblocks, (struct pipe_macroblock *)pipe_macroblocks, NULL);
skip_frame:
return ret;
@@ -283,3 +290,16 @@ vlVdpDecoderRender (VdpDecoder decoder,
return ret;
}
VdpStatus
vlVdpGenerateCSCMatrix(
VdpProcamp *procamp,
VdpColorStandard standard,
VdpCSCMatrix *csc_matrix)
{
debug_printf("[VDPAU] Generating CSCMatrix\n");
if (!(csc_matrix && procamp))
return VDP_STATUS_INVALID_POINTER;
return VDP_STATUS_OK;
}

View File

@@ -1,6 +1,6 @@
/**************************************************************************
*
* Copyright 2010 Younes Manton.
* Copyright 2010 Younes Manton og Thomas Balling Sørensen.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -25,21 +25,18 @@
*
**************************************************************************/
#include <vdpau/vdpau_x11.h>
#include <pipe/p_compiler.h>
#include <vl_winsys.h>
#include <util/u_memory.h>
#include <util/u_debug.h>
#include "vdpau_private.h"
VdpDeviceCreateX11 vdp_imp_device_create_x11;
PUBLIC VdpStatus
vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, VdpGetProcAddress **get_proc_address)
{
VdpStatus ret;
vlVdpDevice *dev = NULL;
struct vl_screen *vlscreen = NULL;
if (!(display && device && get_proc_address))
return VDP_STATUS_INVALID_POINTER;
@@ -62,9 +59,8 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, VdpGe
ret = VDP_STATUS_ERROR;
goto no_handle;
}
*get_proc_address = &vlVdpGetProcAddress;
debug_printf("[VDPAU] Device created succesfully\n");
return VDP_STATUS_OK;
@@ -77,9 +73,46 @@ no_htab:
return ret;
}
PUBLIC VdpStatus
vlVdpPresentationQueueTargetCreateX11(VdpDevice device, Drawable drawable,VdpPresentationQueueTarget *target)
{
VdpStatus ret;
vlVdpPresentationQueueTarget *pqt = NULL;
debug_printf("[VDPAU] Creating PresentationQueueTarget\n");
if (!drawable)
return VDP_STATUS_INVALID_HANDLE;
vlVdpDevice *dev = vlGetDataHTAB(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
pqt = CALLOC(1, sizeof(vlVdpPresentationQueue));
if (!pqt)
return VDP_STATUS_RESOURCES;
pqt->device = dev;
pqt->drawable = drawable;
*target = vlAddDataHTAB(pqt);
if (*target == 0) {
ret = VDP_STATUS_ERROR;
goto no_handle;
}
return VDP_STATUS_OK;
no_handle:
FREE(dev);
return ret;
}
VdpStatus
vlVdpDeviceDestroy(VdpDevice device)
{
debug_printf("[VDPAU] Destroying destroy\n");
vlVdpDevice *dev = vlGetDataHTAB(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;

View File

@@ -1,6 +1,6 @@
/**************************************************************************
*
* Copyright 2010 Younes Manton.
* Copyright 2010 Younes Manton & Thomas Balling Sørensen.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -33,10 +33,10 @@ static void* ftab[67] =
&vlVdpGetErrorString, /* VDP_FUNC_ID_GET_ERROR_STRING */
&vlVdpGetProcAddress, /* VDP_FUNC_ID_GET_PROC_ADDRESS */
&vlVdpGetApiVersion, /* VDP_FUNC_ID_GET_API_VERSION */
0,
0x555, /* DUMMY */
&vlVdpGetInformationString, /* VDP_FUNC_ID_GET_INFORMATION_STRING */
&vlVdpDeviceDestroy, /* VDP_FUNC_ID_DEVICE_DESTROY */
0, /* VDP_FUNC_ID_GENERATE_CSC_MATRIX */
&vlVdpGenerateCSCMatrix, /* VDP_FUNC_ID_GENERATE_CSC_MATRIX */
&vlVdpVideoSurfaceQueryCapabilities, /* VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES */
&vlVdpVideoSurfaceQueryGetPutBitsYCbCrCapabilities, /* VDP_FUNC_ID_VIDEO_SURFACE_QUERY_GET_PUT_BITS_Y_CB_CR_CAPABILITIES */
&vlVdpVideoSurfaceCreate, /* VDP_FUNC_ID_VIDEO_SURFACE_CREATE */
@@ -46,62 +46,62 @@ static void* ftab[67] =
&vlVdpVideoSurfacePutBitsYCbCr, /* VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR */
&vlVdpOutputSurfaceQueryCapabilities, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_CAPABILITIES */
&vlVdpOutputSurfaceQueryGetPutBitsNativeCapabilities, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_GET_PUT_BITS_NATIVE_CAPABILITIES */
0, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_INDEXED_CAPABILITIES */
0x2, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_INDEXED_CAPABILITIES */
&vlVdpOutputSurfaceQueryPutBitsYCbCrCapabilities, /* VDP_FUNC_ID_OUTPUT_SURFACE_QUERY_PUT_BITS_Y_CB_CR_CAPABILITIES */
&vlVdpOutputSurfaceCreate, /* VDP_FUNC_ID_OUTPUT_SURFACE_CREATE */
0, /* VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY */
0, /* VDP_FUNC_ID_OUTPUT_SURFACE_GET_PARAMETERS */
0, /* VDP_FUNC_ID_OUTPUT_SURFACE_GET_BITS_NATIVE */
0, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE */
0, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED */
0, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_Y_CB_CR */
0x3, /* VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY */
0x4, /* VDP_FUNC_ID_OUTPUT_SURFACE_GET_PARAMETERS */
0x5, /* VDP_FUNC_ID_OUTPUT_SURFACE_GET_BITS_NATIVE */
0x6, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE */
0x7, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED */
0x8, /* VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_Y_CB_CR */
&vlVdpBitmapSurfaceQueryCapabilities, /* VDP_FUNC_ID_BITMAP_SURFACE_QUERY_CAPABILITIES */
&vlVdpBitmapSurfaceCreate, /* VDP_FUNC_ID_BITMAP_SURFACE_CREATE */
&vlVdpBitmapSurfaceDestroy, /* VDP_FUNC_ID_BITMAP_SURFACE_DESTROY */
&vlVdpBitmapSurfaceGetParameters, /* VDP_FUNC_ID_BITMAP_SURFACE_GET_PARAMETERS */
&vlVdpBitmapSurfacePutBitsNative, /* VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE */
0,
0,
0,
0, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE */
0, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE */
0, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_VIDEO_SURFACE_LUMA */
0x55, /* DUMMY */
0x55, /* DUMMY */
0x55, /* DUMMY */
0x9, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE */
0x10, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE */
0x11, /* VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_VIDEO_SURFACE_LUMA */
&vlVdpDecoderQueryCapabilities, /* VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES */
&vlVdpDecoderCreate, /* VDP_FUNC_ID_DECODER_CREATE */
&vlVdpDecoderDestroy, /* VDP_FUNC_ID_DECODER_DESTROY */
0, /* VDP_FUNC_ID_DECODER_GET_PARAMETERS */
0x12, /* VDP_FUNC_ID_DECODER_GET_PARAMETERS */
&vlVdpDecoderRender, /* VDP_FUNC_ID_DECODER_RENDER */
&vlVdpVideoMixerQueryFeatureSupport, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_FEATURE_SUPPORT */
&vlVdpVideoMixerQueryParameterSupport, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_SUPPORT */
&vlVdpVideoMixerQueryAttributeSupport, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_SUPPORT */
&vlVdpVideoMixerQueryParameterValueRange, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_PARAMETER_VALUE_RANGE */
&vlVdpVideoMixerQueryAttributeValueRange, /* VDP_FUNC_ID_VIDEO_MIXER_QUERY_ATTRIBUTE_VALUE_RANGE */
0, /* VDP_FUNC_ID_VIDEO_MIXER_CREATE */
0, /* VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES */
0, /* VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES */
0, /* VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_SUPPORT */
0, /* VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_ENABLES */
0, /* VDP_FUNC_ID_VIDEO_MIXER_GET_PARAMETER_VALUES */
0, /* VDP_FUNC_ID_VIDEO_MIXER_GET_ATTRIBUTE_VALUES */
0, /* VDP_FUNC_ID_VIDEO_MIXER_DESTROY */
0, /* VDP_FUNC_ID_VIDEO_MIXER_RENDER */
&vlVdpVideoMixerCreate, /* VDP_FUNC_ID_VIDEO_MIXER_CREATE */
&vlVdpVideoMixerSetFeatureEnables, /* VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES */
&vlVdpVideoMixerSetAttributeValues, /* VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES */
0x16, /* VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_SUPPORT */
0x17, /* VDP_FUNC_ID_VIDEO_MIXER_GET_FEATURE_ENABLES */
0x18, /* VDP_FUNC_ID_VIDEO_MIXER_GET_PARAMETER_VALUES */
0x19, /* VDP_FUNC_ID_VIDEO_MIXER_GET_ATTRIBUTE_VALUES */
0x20, /* VDP_FUNC_ID_VIDEO_MIXER_DESTROY */
&vlVdpVideoMixerRender, /* VDP_FUNC_ID_VIDEO_MIXER_RENDER */
&vlVdpPresentationQueueTargetDestroy, /* VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY */
&vlVdpPresentationQueueCreate, /* VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE */
&vlVdpPresentationQueueDestroy, /* VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY */
&vlVdpPresentationQueueSetBackgroundColor, /* VDP_FUNC_ID_PRESENTATION_QUEUE_SET_BACKGROUND_COLOR */
&vlVdpPresentationQueueGetBackgroundColor, /* VDP_FUNC_ID_PRESENTATION_QUEUE_GET_BACKGROUND_COLOR */
0,
0,
0x55, /* DUMMY */
0x55, /* DUMMY */
&vlVdpPresentationQueueGetTime, /* VDP_FUNC_ID_PRESENTATION_QUEUE_GET_TIME */
&vlVdpPresentationQueueDisplay, /* VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY */
&vlVdpPresentationQueueBlockUntilSurfaceIdle, /* VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE */
&vlVdpPresentationQueueQuerySurfaceStatus, /* VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS */
0 /* VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER */
&vlVdpPreemptionCallbackRegister /* VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER */
};
static void* ftab_winsys[1] =
{
0 /* VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11 */
&vlVdpPresentationQueueTargetCreateX11 /* VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11 */
};
boolean vlGetFuncFTAB(VdpFuncId function_id, void **func)

View File

@@ -0,0 +1,135 @@
/**************************************************************************
*
* Copyright 2010 Thomas Balling Sørensen.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include <vdpau/vdpau.h>
#include <util/u_memory.h>
#include <util/u_debug.h>
#include "vdpau_private.h"
VdpStatus
vlVdpVideoMixerCreate (VdpDevice device,
uint32_t feature_count,
VdpVideoMixerFeature const *features,
uint32_t parameter_count,
VdpVideoMixerParameter const *parameters,
void const *const *parameter_values,
VdpVideoMixer *mixer)
{
VdpStatus ret;
vlVdpVideoMixer *vmixer = NULL;
debug_printf("[VDPAU] Creating VideoMixer\n");
vlVdpDevice *dev = vlGetDataHTAB(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
vmixer = CALLOC(1, sizeof(vlVdpVideoMixer));
if (!vmixer)
return VDP_STATUS_RESOURCES;
vmixer->device = dev;
/*
* TODO: Handle features and parameters
* */
*mixer = vlAddDataHTAB(vmixer);
if (*mixer == 0) {
ret = VDP_STATUS_ERROR;
goto no_handle;
}
return VDP_STATUS_OK;
no_handle:
return ret;
}
VdpStatus
vlVdpVideoMixerSetFeatureEnables (
VdpVideoMixer mixer,
uint32_t feature_count,
VdpVideoMixerFeature const *features,
VdpBool const *feature_enables)
{
debug_printf("[VDPAU] Setting VideoMixer features\n");
if (!(features && feature_enables))
return VDP_STATUS_INVALID_POINTER;
vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer);
if (!vmixer)
return VDP_STATUS_INVALID_HANDLE;
/*
* TODO: Set features
* */
return VDP_STATUS_OK;
}
VdpStatus vlVdpVideoMixerRender (
VdpVideoMixer mixer,
VdpOutputSurface background_surface,
VdpRect const *background_source_rect,
VdpVideoMixerPictureStructure current_picture_structure,
uint32_t video_surface_past_count,
VdpVideoSurface const *video_surface_past,
VdpVideoSurface video_surface_current,
uint32_t video_surface_future_count,
VdpVideoSurface const *video_surface_future,
VdpRect const *video_source_rect,
VdpOutputSurface destination_surface,
VdpRect const *destination_rect,
VdpRect const *destination_video_rect,
uint32_t layer_count,
VdpLayer const *layers)
{
if (!(background_source_rect && video_surface_past && video_surface_future && video_source_rect && destination_rect && destination_video_rect && layers))
return VDP_STATUS_INVALID_POINTER;
return VDP_STATUS_NO_IMPLEMENTATION;
}
VdpStatus
vlVdpVideoMixerSetAttributeValues (
VdpVideoMixer mixer,
uint32_t attribute_count,
VdpVideoMixerAttribute const *attributes,
void const *const *attribute_values)
{
if (!(attributes && attribute_values))
return VDP_STATUS_INVALID_POINTER;
vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer);
if (!vmixer)
return VDP_STATUS_INVALID_HANDLE;
return VDP_STATUS_OK;
}

View File

@@ -73,6 +73,8 @@ vlVdpMPEG2BitstreamToMacroblock (
bool b_header_done = false;
struct vdpMPEG2BitstreamParser parser;
debug_printf("[VDPAU] Starting decoding MPEG2 stream");
num_macroblocks[0] = 0;
memset(&parser,0,sizeof(parser));

View File

@@ -28,6 +28,7 @@
#include "vdpau_private.h"
#include <vdpau/vdpau.h>
#include <util/u_debug.h>
#include <util/u_memory.h>
VdpStatus
vlVdpOutputSurfaceCreate ( VdpDevice device,
@@ -35,9 +36,29 @@ vlVdpOutputSurfaceCreate ( VdpDevice device,
uint32_t width, uint32_t height,
VdpOutputSurface *surface)
{
vlVdpOutputSurface *vlsurface = NULL;
debug_printf("[VDPAU] Creating output surface\n");
if (!(width && height))
return VDP_STATUS_INVALID_SIZE;
vlVdpDevice *dev = vlGetDataHTAB(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
vlsurface = CALLOC(1, sizeof(vlVdpOutputSurface));
if (!vlsurface)
return VDP_STATUS_RESOURCES;
vlsurface->width = width;
vlsurface->height = height;
vlsurface->format = FormatRGBAToPipe(rgba_format);
*surface = vlAddDataHTAB(vlsurface);
if (*surface == 0) {
FREE(dev);
return VDP_STATUS_ERROR;
}
return VDP_STATUS_NO_IMPLEMENTATION;
return VDP_STATUS_OK;
}

View File

@@ -0,0 +1,39 @@
/**************************************************************************
*
* Copyright 2010 Thomas Balling Sørensen.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#include <vdpau/vdpau.h>
void vlVdpPreemptionCallback (VdpDevice device, void *context)
{
/* TODO: Implement preemption */
}
VdpStatus vlVdpPreemptionCallbackRegister (VdpDevice device, VdpPreemptionCallback callback, void *context)
{
return VDP_STATUS_OK;
}

View File

@@ -28,6 +28,7 @@
#include "vdpau_private.h"
#include <vdpau/vdpau.h>
#include <util/u_debug.h>
#include <util/u_memory.h>
VdpStatus
vlVdpPresentationQueueTargetDestroy (VdpPresentationQueueTarget presentation_queue_target)
@@ -41,12 +42,39 @@ vlVdpPresentationQueueCreate ( VdpDevice device,
VdpPresentationQueueTarget presentation_queue_target,
VdpPresentationQueue *presentation_queue)
{
debug_printf("[VDPAU] Creating presentation queue\n");
debug_printf("[VDPAU] Creating PresentationQueue\n");
VdpStatus ret;
vlVdpPresentationQueue *pq = NULL;
if (!presentation_queue)
return VDP_STATUS_INVALID_POINTER;
return VDP_STATUS_NO_IMPLEMENTATION;
vlVdpDevice *dev = vlGetDataHTAB(device);
if (!dev)
return VDP_STATUS_INVALID_HANDLE;
vlVdpPresentationQueueTarget *pqt = vlGetDataHTAB(presentation_queue_target);
if (!pqt)
return VDP_STATUS_INVALID_HANDLE;
if (dev != pqt->device)
return VDP_STATUS_HANDLE_DEVICE_MISMATCH;
pq = CALLOC(1, sizeof(vlVdpPresentationQueue));
if (!pq)
return VDP_STATUS_RESOURCES;
*presentation_queue = vlAddDataHTAB(pq);
if (*presentation_queue == 0) {
ret = VDP_STATUS_ERROR;
goto no_handle;
}
return VDP_STATUS_OK;
no_handle:
FREE(pq);
return ret;
}
VdpStatus

View File

@@ -30,6 +30,7 @@
#include <vdpau/vdpau.h>
#include <vdpau/vdpau_x11.h>
#include <pipe/p_compiler.h>
#include <pipe/p_video_context.h>
#include <vl_winsys.h>
@@ -73,6 +74,7 @@ static VdpChromaType PipeToType(enum pipe_video_chroma_format pipe_type)
return -1;
}
static enum pipe_format FormatToPipe(VdpYCbCrFormat vdpau_format)
{
switch (vdpau_format) {
@@ -95,6 +97,26 @@ static enum pipe_format FormatToPipe(VdpYCbCrFormat vdpau_format)
return -1;
}
static enum pipe_format FormatRGBAToPipe(VdpRGBAFormat vdpau_format)
{
switch (vdpau_format) {
case VDP_RGBA_FORMAT_A8:
return PIPE_FORMAT_A8_UNORM;
case VDP_RGBA_FORMAT_B10G10R10A2:
return PIPE_FORMAT_B10G10R10A2_UNORM;
case VDP_RGBA_FORMAT_B8G8R8A8:
return PIPE_FORMAT_B8G8R8A8_UNORM;
case VDP_RGBA_FORMAT_R10G10B10A2:
return PIPE_FORMAT_R10G10B10A2_UNORM;
case VDP_RGBA_FORMAT_R8G8B8A8:
return PIPE_FORMAT_R8G8B8A8_UNORM;
default:
assert(0);
}
return -1;
}
static VdpYCbCrFormat PipeToFormat(enum pipe_format p_format)
{
switch (p_format) {
@@ -145,6 +167,23 @@ typedef struct
int screen;
} vlVdpDevice;
typedef struct
{
vlVdpDevice *device;
Drawable drawable;
} vlVdpPresentationQueueTarget;
typedef struct
{
vlVdpDevice *device;
Drawable drawable;
} vlVdpPresentationQueue;
typedef struct
{
vlVdpDevice *device;
} vlVdpVideoMixer;
typedef struct
{
vlVdpDevice *device;
@@ -157,6 +196,14 @@ typedef struct
uint8_t *data;
} vlVdpSurface;
typedef struct
{
vlVdpDevice *device;
uint32_t width;
uint32_t height;
enum pipe_format format;
} vlVdpOutputSurface;
typedef struct
{
vlVdpDevice *device;
@@ -174,6 +221,11 @@ vlHandle vlAddDataHTAB(void *data);
void* vlGetDataHTAB(vlHandle handle);
boolean vlGetFuncFTAB(VdpFuncId function_id, void **func);
/* Public functions */
VdpDeviceCreateX11 vdp_imp_device_create_x11;
VdpPresentationQueueTargetCreateX11 vlVdpPresentationQueueTargetCreateX11;
/* Internal function pointers */
VdpGetErrorString vlVdpGetErrorString;
VdpDeviceDestroy vlVdpDeviceDestroy;
VdpGetProcAddress vlVdpGetProcAddress;
@@ -213,4 +265,13 @@ VdpPresentationQueueGetTime vlVdpPresentationQueueGetTime;
VdpPresentationQueueDisplay vlVdpPresentationQueueDisplay;
VdpPresentationQueueBlockUntilSurfaceIdle vlVdpPresentationQueueBlockUntilSurfaceIdle;
VdpPresentationQueueQuerySurfaceStatus vlVdpPresentationQueueQuerySurfaceStatus;
VdpPreemptionCallback vlVdpPreemptionCallback;
VdpPreemptionCallbackRegister vlVdpPreemptionCallbackRegister;
VdpVideoMixerSetFeatureEnables vlVdpVideoMixerSetFeatureEnables;
VdpVideoMixerCreate vlVdpVideoMixerCreate;
VdpVideoMixerRender vlVdpVideoMixerRender;
VdpVideoMixerSetAttributeValues vlVdpVideoMixerSetAttributeValues;
VdpGenerateCSCMatrix vlVdpGenerateCSCMatrix;
#endif // VDPAU_PRIVATE_H