From 28d9e027ac7ecb160bacacd957cdfe6d2fdc769a Mon Sep 17 00:00:00 2001 From: Cooper Yuan Date: Tue, 26 May 2009 17:12:34 +0800 Subject: xvmc: add xvmc API definitions --- src/radeon_hwmc.h | 10 ++++- src/xvmc/radeon_xvmc.c | 65 +++++++++++++++++++++++++++++- src/xvmc/radeon_xvmc.h | 106 ++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 178 insertions(+), 3 deletions(-) diff --git a/src/radeon_hwmc.h b/src/radeon_hwmc.h index 2c7073b..52d981b 100644 --- a/src/radeon_hwmc.h +++ b/src/radeon_hwmc.h @@ -22,4 +22,12 @@ * * Author: Cooper Yuan * - */ \ No newline at end of file + */ + +#ifndef RADEON_HWMC_H +#define RADEON_HWMC_H + +/* hw xvmc support type */ +#define XVMC_RADEON_MPEG2_MC 0x01 + +#endif \ No newline at end of file diff --git a/src/xvmc/radeon_xvmc.c b/src/xvmc/radeon_xvmc.c index 2c7073b..452cce1 100644 --- a/src/xvmc/radeon_xvmc.c +++ b/src/xvmc/radeon_xvmc.c @@ -22,4 +22,67 @@ * * Author: Cooper Yuan * - */ \ No newline at end of file + */ + +#include "radeon_xvmc.h" +#include "radeon_hwmc.h" + +static Status radeon_xvmc_create_context(Display *display, XvMCContext *context, + int priv_count, CARD32 *priv_data) +{ +} + +static int radeon_xvmc_destroy_context(Display *display, XvMCContext *context) +{ +} + +static Status radeon_xvmc_create_surface(Display *display, XvMCContext *context, + XvMCSurface *surface, int priv_count, + CARD32 *priv_data) +{ +} + +static int radeon_xvmc_destroy_surface(Display *display, XvMCSurface *surface) +{ +} + +static int radeon_xvmc_render_surface(Display *display, XvMCContext *context, + unsigned int picture_structure, + XvMCSurface *target_surface, + XvMCSurface *past_surface, + XvMCSurface *future_surface, + unsigned int flags, + unsigned int num_macroblocks, + unsigned int first_macroblock, + XvMCMacroBlockArray *macroblock_array, + XvMCBlockArray *blocks) +{ +} + +static int radeon_xvmc_put_surface(Display *display,XvMCSurface *surface, + Drawable draw, short srcx, short srcy, + unsigned short srcw, unsigned short srch, + short destx, short desty, + unsigned short destw, unsigned short desth, + int flags, struct intel_xvmc_command *data) +{ +} + +static int radeon_xvmc_get_surface_status(Display *display, + XvMCSurface *surface, int *stat) +{ +} + +struct _radeon_xvmc_driver_rec radeon_xvmc_driver = +{ + .type = XVMC_RADEON_MPEG2_MC, + .num_ctx = 0, + .create_context = radeon_xvmc_create_context, + .destroy_context = radeon_xvmc_destroy_context, + .create_surface = radeon_xvmc_create_surface, + .destroy_surface = radeon_xvmc_destroy_surface, + .render_surface = radeon_xvmc_render_surface, + .put_surface = radeon_xvmc_put_surface, + .get_surface_status = radeon_xvmc_get_surface_status, +}; + diff --git a/src/xvmc/radeon_xvmc.h b/src/xvmc/radeon_xvmc.h index 2c7073b..fdeb7a5 100644 --- a/src/xvmc/radeon_xvmc.h +++ b/src/xvmc/radeon_xvmc.h @@ -22,4 +22,108 @@ * * Author: Cooper Yuan * - */ \ No newline at end of file + */ +#ifndef RADEON_XVMC_H +#define RADEON_XVMC_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef struct _radeon_xvmc_driver_rec +{ + int type; /* hw xvmc type */ + int screen; /* current screen num*/ + + int fd; /* drm file handler */ + drm_handle_t hsarea; /* DRI open connect */ + char busID[32]; + + unsigned int sarea_size; + drmAddress sarea_address; + + struct + { + unsigned int start_offset; + unsigned int size; + unsigned int space; + unsigned char *ptr; + } batch; + + struct + { + void *ptr; + unsigned int size; + unsigned int offset; + unsigned int active_buf; + unsigned int irq_emitted; + } alloc; + +// radeon_xvmc_drm_map_t batchbuffer; + unsigned int last_render; + + sigset_t sa_mask; + pthread_mutex_t ctxmutex; + int lock; + int locked; + drmLock *driHwLock; + + int num_ctx; + int num_surf; + + void *private; + + /* driver specific xvmc callbacks */ + Status (*create_context)(Display* display, XvMCContext *context, + int priv_count, CARD32 *priv_data); + + Status (*destroy_context)(Display* display, XvMCContext *context); + + Status (*create_surface)(Display* display, XvMCContext *context, + XvMCSurface *surface, int priv_count, CARD32 *priv_data); + + Status (*destroy_surface)(Display* display, XvMCSurface *surface); + + Status (*render_surface)(Display *display, XvMCContext *context, + unsigned int picture_structure, + XvMCSurface *target_surface, + XvMCSurface *past_surface, + XvMCSurface *future_surface, + unsigned int flags, + unsigned int num_macroblocks, + unsigned int first_macroblock, + XvMCMacroBlockArray *macroblock_array, + XvMCBlockArray *blocks); + + Status (*put_surface)(Display *display, XvMCSurface *surface, + Drawable draw, short srcx, short srcy, + unsigned short srcw, unsigned short srch, + short destx, short desty, + unsigned short destw, unsigned short desth, + int flags, struct intel_xvmc_command *data); + + Status (*get_surface_status)(Display *display, XvMCSurface *surface, + int *stat); +}; + +#endif \ No newline at end of file -- cgit v1.2.3