diff options
author | Cooper Yuan <cooperyuan@gmail.com> | 2009-05-26 17:55:10 +0800 |
---|---|---|
committer | Cooper Yuan <cooperyuan@gmail.com> | 2009-05-26 17:55:10 +0800 |
commit | 72a79c8ee0991b890bb190004af5b16d26bc45bd (patch) | |
tree | abe92d20e6aa7de0762de214633f6bb2e1083737 | |
parent | 28d9e027ac7ecb160bacacd957cdfe6d2fdc769a (diff) |
xvmc: Add more functions and divide driver to 2 levels
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/radeon_hwmc.c | 25 | ||||
-rw-r--r-- | src/radeon_hwmc.h | 33 | ||||
-rw-r--r-- | src/xvmc/r100_xvmc.c | 87 | ||||
-rw-r--r-- | src/xvmc/r100_xvmc.h | 129 | ||||
-rw-r--r-- | src/xvmc/r500_xvmc.c | 87 | ||||
-rw-r--r-- | src/xvmc/r500_xvmc.h | 129 | ||||
-rw-r--r-- | src/xvmc/radeon_xvmc.c | 479 | ||||
-rw-r--r-- | src/xvmc/radeon_xvmc.h | 3 |
9 files changed, 878 insertions, 96 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 5b4ea45..c8d8c1d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -92,7 +92,7 @@ radeon_drv_la_SOURCES = \ radeon_driver.c radeon_video.c radeon_bios.c radeon_mm_i2c.c \ radeon_vip.c radeon_misc.c radeon_probe.c \ legacy_crtc.c legacy_output.c \ - radeon_hwmc.c xvmc/radeon_xvmc.c \ + xvmc/radeon_xvmc.c xvmc/r500_xvmc.c xvmc/r100_xvmc.c r500_hwmc.c \ radeon_textured_video.c radeon_pm.c \ radeon_crtc.c radeon_output.c radeon_modes.c radeon_tv.c \ $(RADEON_ATOMBIOS_SOURCES) radeon_atombios.c radeon_atomwrapper.c \ diff --git a/src/radeon_hwmc.c b/src/radeon_hwmc.c deleted file mode 100644 index 2c7073b..0000000 --- a/src/radeon_hwmc.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2008 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS 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. - * - * Author: Cooper Yuan <cooper.yuan@amd.com> - * - */
\ No newline at end of file diff --git a/src/radeon_hwmc.h b/src/radeon_hwmc.h deleted file mode 100644 index 52d981b..0000000 --- a/src/radeon_hwmc.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2008 Advanced Micro Devices, Inc. - * - * 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, sublicense, - * 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 NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS 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. - * - * Author: Cooper Yuan <cooper.yuan@amd.com> - * - */ - -#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/r100_xvmc.c b/src/xvmc/r100_xvmc.c new file mode 100644 index 0000000..ff85db5 --- /dev/null +++ b/src/xvmc/r100_xvmc.c @@ -0,0 +1,87 @@ +/* + * Copyright 2008 Advanced Micro Devices, Inc. + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Author: Cooper Yuan <cooper.yuan@amd.com> + * + */ + +#include "radeon_xvmc.h" + +static Status r100_xvmc_create_context(Display *display, XvMCContext *context, + int priv_count, CARD32 *priv_data) +{ +} + +static int r100_xvmc_destroy_context(Display *display, XvMCContext *context) +{ +} + +static Status r100_xvmc_create_surface(Display *display, XvMCContext *context, + XvMCSurface *surface, int priv_count, + CARD32 *priv_data) +{ +} + +static int r100_xvmc_destroy_surface(Display *display, XvMCSurface *surface) +{ +} + +static int r100_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 r100_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 r100_xvmc_get_surface_status(Display *display, + XvMCSurface *surface, int *stat) +{ +} + +struct _radeon_xvmc_driver_rec r100_xvmc_driver = +{ + .type = XVMC_RADEON_MPEG2_MC, + .num_ctx = 0, + .create_context = r100_xvmc_create_context, + .destroy_context = r100_xvmc_destroy_context, + .create_surface = r100_xvmc_create_surface, + .destroy_surface = r100_xvmc_destroy_surface, + .render_surface = r100_xvmc_render_surface, + .put_surface = r100_xvmc_put_surface, + .get_surface_status = r100_xvmc_get_surface_status, +}; + diff --git a/src/xvmc/r100_xvmc.h b/src/xvmc/r100_xvmc.h new file mode 100644 index 0000000..fdeb7a5 --- /dev/null +++ b/src/xvmc/r100_xvmc.h @@ -0,0 +1,129 @@ +/* + * Copyright 2008 Advanced Micro Devices, Inc. + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Author: Cooper Yuan <cooper.yuan@amd.com> + * + */ +#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 diff --git a/src/xvmc/r500_xvmc.c b/src/xvmc/r500_xvmc.c new file mode 100644 index 0000000..0066ff0 --- /dev/null +++ b/src/xvmc/r500_xvmc.c @@ -0,0 +1,87 @@ +/* + * Copyright 2008 Advanced Micro Devices, Inc. + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Author: Cooper Yuan <cooper.yuan@amd.com> + * + */ + +#include "radeon_xvmc.h" + +static Status r500_xvmc_create_context(Display *display, XvMCContext *context, + int priv_count, CARD32 *priv_data) +{ +} + +static int r500_xvmc_destroy_context(Display *display, XvMCContext *context) +{ +} + +static Status r500_xvmc_create_surface(Display *display, XvMCContext *context, + XvMCSurface *surface, int priv_count, + CARD32 *priv_data) +{ +} + +static int r500_xvmc_destroy_surface(Display *display, XvMCSurface *surface) +{ +} + +static int r500_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 r500_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 r500_xvmc_get_surface_status(Display *display, + XvMCSurface *surface, int *stat) +{ +} + +struct _radeon_xvmc_driver_rec r500_xvmc_driver = +{ + .type = XVMC_RADEON_MPEG2_MC, + .num_ctx = 0, + .create_context = r500_xvmc_create_context, + .destroy_context = r500_xvmc_destroy_context, + .create_surface = r500_xvmc_create_surface, + .destroy_surface = r500_xvmc_destroy_surface, + .render_surface = r500_xvmc_render_surface, + .put_surface = r500_xvmc_put_surface, + .get_surface_status = r500_xvmc_get_surface_status, +}; + diff --git a/src/xvmc/r500_xvmc.h b/src/xvmc/r500_xvmc.h new file mode 100644 index 0000000..fdeb7a5 --- /dev/null +++ b/src/xvmc/r500_xvmc.h @@ -0,0 +1,129 @@ +/* + * Copyright 2008 Advanced Micro Devices, Inc. + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Author: Cooper Yuan <cooper.yuan@amd.com> + * + */ +#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 diff --git a/src/xvmc/radeon_xvmc.c b/src/xvmc/radeon_xvmc.c index 452cce1..cac6a35 100644 --- a/src/xvmc/radeon_xvmc.c +++ b/src/xvmc/radeon_xvmc.c @@ -25,64 +25,469 @@ */ #include "radeon_xvmc.h" -#include "radeon_hwmc.h" +#include "r500_hwmc.h" -static Status radeon_xvmc_create_context(Display *display, XvMCContext *context, - int priv_count, CARD32 *priv_data) +/* +* Function: XvMCCreateContext +* Description: Create a XvMC context for the given surface parameters. +* Arguments: +* display - Connection to the X server. +* port - XvPortID to use as avertised by the X connection. +* surface_type_id - Unique identifier for the Surface type. +* width - Width of the surfaces. +* height - Height of the surfaces. +* flags - one or more of the following +* XVMC_DIRECT - A direct rendered context is requested. +* +* Notes: surface_type_id and width/height parameters must match those +* returned by XvMCListSurfaceTypes. +* Returns: Status +*/ +_X_EXPORT Status XvMCCreateContext(Display *display, XvPortID port, + int surface_type_id, int width, int height, + int flags, XvMCContext *context) +{ +} + +/* + * Function: XvMCDestroyContext + * Description: Destorys the specified context. + * + * Arguments: + * display - Specifies the connection to the server. + * context - The context to be destroyed. + * + */ +_X_EXPORT Status XvMCDestroyContext(Display *display, XvMCContext *context) +{ +} + +/* + * Function: XvMCCreateSurface + */ +_X_EXPORT Status XvMCCreateSurface(Display *display, XvMCContext *context, XvMCSurface *surface) +{ +} + +/* + * Function: XvMCDestroySurface + */ +_X_EXPORT Status XvMCDestroySurface(Display *display, XvMCSurface *surface) +{ +} + +/* + * Function: XvMCCreateBlocks + */ +_X_EXPORT Status XvMCCreateBlocks(Display *display, XvMCContext *context, + unsigned int num_blocks, + XvMCBlockArray *block) +{ +} + +/* + * Function: XvMCDestroyBlocks + */ +_X_EXPORT Status XvMCDestroyBlocks(Display *display, XvMCBlockArray *block) +{ +} + +/* + * Function: XvMCCreateMacroBlocks + */ +_X_EXPORT Status XvMCCreateMacroBlocks(Display *display, XvMCContext *context, + unsigned int num_blocks, + XvMCMacroBlockArray *blocks) +{ +} + +/* + * Function: XvMCDestroyMacroBlocks + */ +_X_EXPORT Status XvMCDestroyMacroBlocks(Display *display, XvMCMacroBlockArray *block) +{ +} + +/* + * Function: XvMCRenderSurface + * + * Description: This function does the actual HWMC. Given a list of + * macroblock structures it dispatched the hardware commands to execute + * them. + */ +_X_EXPORT Status XvMCRenderSurface(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) +{ +} + +/* + * Function: XvMCPutSurface + * + * Description: + * Arguments: + * display: Connection to X server + * surface: Surface to be displayed + * draw: X Drawable on which to display the surface + * srcx: X coordinate of the top left corner of the region to be + * displayed within the surface. + * srcy: Y coordinate of the top left corner of the region to be + * displayed within the surface. + * srcw: Width of the region to be displayed. + * srch: Height of the region to be displayed. + * destx: X cordinate of the top left corner of the destination region + * in the drawable coordinates. + * desty: Y cordinate of the top left corner of the destination region + * in the drawable coordinates. + * destw: Width of the destination region. + * desth: Height of the destination region. + * flags: One or more of the following. + * XVMC_TOP_FIELD - Display only the Top field of the surface. + * XVMC_BOTTOM_FIELD - Display only the Bottom Field of the surface. + * XVMC_FRAME_PICTURE - Display both fields or frame. + */ +_X_EXPORT Status XvMCPutSurface(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) +{ +} + +/* + * Function: XvMCSyncSurface + * Arguments: + * display - Connection to the X server + * surface - The surface to synchronize + */ +_X_EXPORT Status XvMCSyncSurface(Display *display, XvMCSurface *surface) +{ +} + +/* + * Function: XvMCFlushSurface + * Description: + * This function commits pending rendering requests to ensure that they + * wll be completed in a finite amount of time. + * Arguments: + * display - Connection to X server + * surface - Surface to flush + * Returns: Status + */ +_X_EXPORT Status XvMCFlushSurface(Display * display, XvMCSurface *surface) +{ +} + +/* + * Function: XvMCGetSurfaceStatus + * Description: + * Arguments: + * display: connection to X server + * surface: The surface to query + * stat: One of the Following + * XVMC_RENDERING - The last XvMCRenderSurface command has not + * completed. + * XVMC_DISPLAYING - The surface is currently being displayed or a + * display is pending. + */ +_X_EXPORT Status XvMCGetSurfaceStatus(Display *display, XvMCSurface *surface, int *stat) +{ +} + +/* + * Function: XvMCHideSurface + * Description: Stops the display of a surface. + * Arguments: + * display - Connection to the X server. + * surface - surface to be hidden. + * + * Returns: Status + */ +_X_EXPORT Status XvMCHideSurface(Display *display, XvMCSurface *surface) { } -static int radeon_xvmc_destroy_context(Display *display, XvMCContext *context) +/* + * Function: XvMCCreateSubpicture + * Description: This creates a subpicture by filling out the XvMCSubpicture + * structure passed to it and returning Success. + * Arguments: + * display - Connection to the X server. + * context - The context to create the subpicture for. + * subpicture - Pre-allocated XvMCSubpicture structure to be filled in. + * width - of subpicture + * height - of subpicture + * xvimage_id - The id describing the XvImage format. + * + * Returns: Status + */ +_X_EXPORT Status XvMCCreateSubpicture(Display *display, XvMCContext *context, + XvMCSubpicture *subpicture, + unsigned short width, unsigned short height, + int xvimage_id) { } -static Status radeon_xvmc_create_surface(Display *display, XvMCContext *context, - XvMCSurface *surface, int priv_count, - CARD32 *priv_data) +/* + * Function: XvMCClearSubpicture + * Description: Clear the area of the given subpicture to "color". + * structure passed to it and returning Success. + * Arguments: + * display - Connection to the X server. + * subpicture - Subpicture to clear. + * x, y, width, height - rectangle in the subpicture to clear. + * color - The data to file the rectangle with. + * + * Returns: Status + */ +_X_EXPORT Status XvMCClearSubpicture(Display *display, XvMCSubpicture *subpicture, + short x, short y, + unsigned short width, unsigned short height, + unsigned int color) { } -static int radeon_xvmc_destroy_surface(Display *display, XvMCSurface *surface) +/* + * Function: XvMCCompositeSubpicture + * Description: Composite the XvImae on the subpicture. This composit uses + * non-premultiplied alpha. Destination alpha is utilized + * except for with indexed subpictures. Indexed subpictures + * use a simple "replace". + * Arguments: + * display - Connection to the X server. + * subpicture - Subpicture to clear. + * image - the XvImage to be used as the source of the composite. + * srcx, srcy, width, height - The rectangle from the image to be used. + * dstx, dsty - location in the subpicture to composite the source. + * + * Returns: Status + */ +_X_EXPORT Status XvMCCompositeSubpicture(Display *display, XvMCSubpicture *subpicture, + XvImage *image, + short srcx, short srcy, + unsigned short width, unsigned short height, + short dstx, short dsty) { } -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) +/* + * Function: XvMCDestroySubpicture + * Description: Destroys the specified subpicture. + * Arguments: + * display - Connection to the X server. + * subpicture - Subpicture to be destroyed. + * + * Returns: Status + */ +_X_EXPORT Status XvMCDestroySubpicture(Display *display, XvMCSubpicture *subpicture) { + return BadValue; } -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) +/* + * Function: XvMCSetSubpicturePalette + * Description: Set the subpictures palette + * Arguments: + * display - Connection to the X server. + * subpicture - Subpiture to set palette for. + * palette - A pointer to an array holding the palette data. The array + * is num_palette_entries * entry_bytes in size. + * Returns: Status + */ +_X_EXPORT Status XvMCSetSubpicturePalette(Display *display, XvMCSubpicture *subpicture, + unsigned char *palette) { + return BadValue; } -static int radeon_xvmc_get_surface_status(Display *display, - XvMCSurface *surface, int *stat) +/* + * Function: XvMCBlendSubpicture + * Description: + * The behavior of this function is different depending on whether + * or not the XVMC_BACKEND_SUBPICTURE flag is set in the XvMCSurfaceInfo. + * i915 only support frontend behavior. + * + * XVMC_BACKEND_SUBPICTURE not set ("frontend" behavior): + * + * XvMCBlendSubpicture is a no-op in this case. + * + * Arguments: + * display - Connection to the X server. + * subpicture - The subpicture to be blended into the video. + * target_surface - The surface to be displayed with the blended subpic. + * source_surface - Source surface prior to blending. + * subx, suby, subw, subh - The rectangle from the subpicture to use. + * surfx, surfy, surfw, surfh - The rectangle in the surface to blend + * blend the subpicture rectangle into. Scaling can ocure if + * XVMC_SUBPICTURE_INDEPENDENT_SCALING is set. + * + * Returns: Status + */ +_X_EXPORT Status XvMCBlendSubpicture(Display *display, XvMCSurface *target_surface, + XvMCSubpicture *subpicture, + short subx, short suby, + unsigned short subw, unsigned short subh, + short surfx, short surfy, + unsigned short surfw, unsigned short surfh) { + return BadValue; } -struct _radeon_xvmc_driver_rec radeon_xvmc_driver = +/* + * Function: XvMCBlendSubpicture2 + * Description: + * The behavior of this function is different depending on whether + * or not the XVMC_BACKEND_SUBPICTURE flag is set in the XvMCSurfaceInfo. + * i915 only supports frontend blending. + * + * XVMC_BACKEND_SUBPICTURE not set ("frontend" behavior): + * + * XvMCBlendSubpicture2 blends the source_surface and subpicture and + * puts it in the target_surface. This does not effect the status of + * the source surface but will cause the target_surface to query + * XVMC_RENDERING until the blend is completed. + * + * Arguments: + * display - Connection to the X server. + * subpicture - The subpicture to be blended into the video. + * target_surface - The surface to be displayed with the blended subpic. + * source_surface - Source surface prior to blending. + * subx, suby, subw, subh - The rectangle from the subpicture to use. + * surfx, surfy, surfw, surfh - The rectangle in the surface to blend + * blend the subpicture rectangle into. Scaling can ocure if + * XVMC_SUBPICTURE_INDEPENDENT_SCALING is set. + * + * Returns: Status + */ +_X_EXPORT Status XvMCBlendSubpicture2(Display *display, + XvMCSurface *source_surface, + XvMCSurface *target_surface, + XvMCSubpicture *subpicture, + short subx, short suby, + unsigned short subw, unsigned short subh, + short surfx, short surfy, + unsigned short surfw, unsigned short surfh) +{ + return BadValue; +} + +/* + * Function: XvMCSyncSubpicture + * Description: This function blocks until all composite/clear requests on + * the subpicture have been complete. + * Arguments: + * display - Connection to the X server. + * subpicture - The subpicture to synchronize + * + * Returns: Status + */ +_X_EXPORT Status XvMCSyncSubpicture(Display *display, XvMCSubpicture *subpicture) { - .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, -}; + return BadValue; +} + +/* + * Function: XvMCFlushSubpicture + * Description: This function commits pending composite/clear requests to + * ensure that they will be completed in a finite amount of + * time. + * Arguments: + * display - Connection to the X server. + * subpicture - The subpicture whos compsiting should be flushed + * + * Returns: Status + */ +_X_EXPORT Status XvMCFlushSubpicture(Display *display, XvMCSubpicture *subpicture) +{ + return BadValue; +} + +/* + * Function: XvMCGetSubpictureStatus + * Description: This function gets the current status of a subpicture + * + * Arguments: + * display - Connection to the X server. + * subpicture - The subpicture whos status is being queried + * stat - The status of the subpicture. It can be any of the following + * OR'd together: + * XVMC_RENDERING - Last composite or clear request not completed + * XVMC_DISPLAYING - Suppicture currently being displayed. + * + * Returns: Status + */ +_X_EXPORT Status XvMCGetSubpictureStatus(Display *display, XvMCSubpicture *subpicture, + int *stat) +{ + return BadValue; +} + +/* + * Function: XvMCQueryAttributes + * Description: An array of XvAttributes of size "number" is returned by + * this function. If there are no attributes, NULL is returned and number + * is set to 0. The array may be freed with xfree(). + * + * Arguments: + * display - Connection to the X server. + * context - The context whos attributes we are querying. + * number - The returned number of recognized atoms + * + * Returns: + * An array of XvAttributes. + */ +_X_EXPORT XvAttribute *XvMCQueryAttributes(Display *display, XvMCContext *context, + int *number) +{ + /* now XvMC has no extra attribs than Xv */ + *number = 0; + return NULL; +} + +/* + * Function: XvMCSetAttribute + * Description: This function sets a context-specific attribute. + * + * Arguments: + * display - Connection to the X server. + * context - The context whos attributes we are querying. + * attribute - The X atom of the attribute to be changed. + * value - The new value for the attribute. + * + * Returns: + * Status + */ +_X_EXPORT Status XvMCSetAttribute(Display *display, XvMCContext *context, + Atom attribute, int value) +{ + return Success; +} + +/* + * Function: XvMCGetAttribute + * Description: This function queries a context-specific attribute and + * returns the value. + * + * Arguments: + * display - Connection to the X server. + * context - The context whos attributes we are querying. + * attribute - The X atom of the attribute to be queried + * value - The returned attribute value + * + * Returns: + * Status + */ +_X_EXPORT Status XvMCGetAttribute(Display *display, XvMCContext *context, + Atom attribute, int *value) +{ + return Success; +} diff --git a/src/xvmc/radeon_xvmc.h b/src/xvmc/radeon_xvmc.h index fdeb7a5..7770ae7 100644 --- a/src/xvmc/radeon_xvmc.h +++ b/src/xvmc/radeon_xvmc.h @@ -50,6 +50,9 @@ #include <X11/extensions/XvMClib.h> #include <drm_sarea.h> +/* hw xvmc support type */ +#define XVMC_RADEON_MPEG2_MC 0x01 + typedef struct _radeon_xvmc_driver_rec { int type; /* hw xvmc type */ |