summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCooper Yuan <cooperyuan@gmail.com>2009-05-26 17:12:34 +0800
committerCooper Yuan <cooperyuan@gmail.com>2009-05-26 17:12:34 +0800
commit28d9e027ac7ecb160bacacd957cdfe6d2fdc769a (patch)
treeaab27e0692745ec0d9a6d9be294842296ad4d221
parentf6c84f08bdd0e76fb81efc4f30f5eea7221e41a4 (diff)
xvmc: add xvmc API definitions
-rw-r--r--src/radeon_hwmc.h10
-rw-r--r--src/xvmc/radeon_xvmc.c65
-rw-r--r--src/xvmc/radeon_xvmc.h106
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 <cooper.yuan@amd.com>
*
- */ \ 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 <cooper.yuan@amd.com>
*
- */ \ 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 <cooper.yuan@amd.com>
*
- */ \ No newline at end of file
+ */
+#ifndef RADEON_XVMC_H
+#define RADEON_XVMC_H
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <string.h>
+#include <assert.h>
+#include <signal.h>
+#include <stdint.h>
+
+#include <xf86drm.h>
+#include <X11/X.h>
+#include <X11/Xlibint.h>
+#include <X11/Xutil.h>
+#include <fourcc.h>
+#include <X11/extensions/Xv.h>
+#include <X11/extensions/Xvlib.h>
+#include <X11/extensions/XvMC.h>
+#include <X11/extensions/XvMClib.h>
+#include <drm_sarea.h>
+
+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