mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-23 10:14:13 +08:00
remove xvmc
These seem abandoned and they make interfaces changes less easy. Acked-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18705>
This commit is contained in:
parent
0b81ff0193
commit
8cc766d8f7
@ -171,7 +171,6 @@ debian-build-testing:
|
||||
-D dri3=enabled
|
||||
-D gallium-extra-hud=true
|
||||
-D gallium-vdpau=enabled
|
||||
-D gallium-xvmc=enabled
|
||||
-D gallium-omx=bellagio
|
||||
-D gallium-va=enabled
|
||||
-D gallium-xa=enabled
|
||||
@ -183,7 +182,7 @@ debian-build-testing:
|
||||
EXTRA_OPTION: >
|
||||
-D spirv-to-dxil=true
|
||||
-D osmesa=true
|
||||
-D tools=drm-shim,etnaviv,freedreno,glsl,intel,intel-ui,nir,nouveau,xvmc,lima,panfrost,asahi
|
||||
-D tools=drm-shim,etnaviv,freedreno,glsl,intel,intel-ui,nir,nouveau,lima,panfrost,asahi
|
||||
script:
|
||||
- .gitlab-ci/lava/lava-pytest.sh
|
||||
- .gitlab-ci/run-shellcheck.sh
|
||||
@ -206,7 +205,6 @@ debian-release:
|
||||
-D dri3=enabled
|
||||
-D gallium-extra-hud=true
|
||||
-D gallium-vdpau=enabled
|
||||
-D gallium-xvmc=disabled
|
||||
-D gallium-omx=disabled
|
||||
-D gallium-va=enabled
|
||||
-D gallium-xa=enabled
|
||||
@ -257,7 +255,6 @@ fedora-release:
|
||||
-D dri3=enabled
|
||||
-D gallium-extra-hud=true
|
||||
-D gallium-vdpau=enabled
|
||||
-D gallium-xvmc=disabled
|
||||
-D gallium-omx=disabled
|
||||
-D gallium-va=enabled
|
||||
-D gallium-xa=enabled
|
||||
@ -304,7 +301,6 @@ debian-android:
|
||||
GALLIUM_ST: >
|
||||
-D dri3=disabled
|
||||
-D gallium-vdpau=disabled
|
||||
-D gallium-xvmc=disabled
|
||||
-D gallium-omx=disabled
|
||||
-D gallium-va=disabled
|
||||
-D gallium-xa=disabled
|
||||
@ -337,7 +333,6 @@ debian-android:
|
||||
GALLIUM_ST: >
|
||||
-D dri3=enabled
|
||||
-D gallium-vdpau=disabled
|
||||
-D gallium-xvmc=disabled
|
||||
-D gallium-omx=disabled
|
||||
-D gallium-va=disabled
|
||||
-D gallium-xa=disabled
|
||||
@ -438,7 +433,6 @@ debian-clang:
|
||||
-D dri3=enabled
|
||||
-D gallium-extra-hud=true
|
||||
-D gallium-vdpau=enabled
|
||||
-D gallium-xvmc=enabled
|
||||
-D gallium-omx=bellagio
|
||||
-D gallium-va=enabled
|
||||
-D gallium-xa=enabled
|
||||
@ -456,7 +450,7 @@ debian-clang:
|
||||
-D spirv-to-dxil=true
|
||||
-D osmesa=true
|
||||
-D imagination-srv=true
|
||||
-D tools=drm-shim,etnaviv,freedreno,glsl,intel,intel-ui,nir,nouveau,xvmc,lima,panfrost,asahi,imagination
|
||||
-D tools=drm-shim,etnaviv,freedreno,glsl,intel,intel-ui,nir,nouveau,lima,panfrost,asahi,imagination
|
||||
-D vulkan-layers=device-select,overlay
|
||||
-D build-aco-tests=true
|
||||
-D intel-clc=enabled
|
||||
@ -501,7 +495,6 @@ debian-clover:
|
||||
GALLIUM_ST: >
|
||||
-D dri3=disabled
|
||||
-D gallium-vdpau=disabled
|
||||
-D gallium-xvmc=disabled
|
||||
-D gallium-omx=disabled
|
||||
-D gallium-va=disabled
|
||||
-D gallium-xa=disabled
|
||||
@ -516,7 +509,6 @@ debian-rusticl:
|
||||
GALLIUM_ST: >
|
||||
-D dri3=disabled
|
||||
-D gallium-vdpau=disabled
|
||||
-D gallium-xvmc=disabled
|
||||
-D gallium-omx=disabled
|
||||
-D gallium-va=disabled
|
||||
-D gallium-xa=disabled
|
||||
@ -538,7 +530,6 @@ debian-vulkan:
|
||||
GALLIUM_ST: >
|
||||
-D dri3=enabled
|
||||
-D gallium-vdpau=disabled
|
||||
-D gallium-xvmc=disabled
|
||||
-D gallium-omx=disabled
|
||||
-D gallium-va=disabled
|
||||
-D gallium-xa=disabled
|
||||
|
48
meson.build
48
meson.build
@ -83,7 +83,6 @@ if with_tools.contains('all')
|
||||
'lima',
|
||||
'nir',
|
||||
'nouveau',
|
||||
'xvmc',
|
||||
'asahi',
|
||||
'imagination',
|
||||
]
|
||||
@ -695,47 +694,7 @@ if with_vulkan_overlay_layer or with_aco_tests or with_amd_vk
|
||||
endif
|
||||
endif
|
||||
|
||||
_xvmc = get_option('gallium-xvmc')
|
||||
if _xvmc == 'true'
|
||||
_xvmc = 'enabled'
|
||||
warning('gallium-xvmc option "true" deprecated, please use "enabled" instead.')
|
||||
elif _xvmc == 'false'
|
||||
_xvmc = 'disabled'
|
||||
warning('gallium-xvmc option "false" deprecated, please use "disabled" instead.')
|
||||
endif
|
||||
if not system_has_kms_drm
|
||||
if _xvmc == 'enabled'
|
||||
error('XVMC state tracker can only be build on unix-like OSes.')
|
||||
else
|
||||
_xvmc = 'disabled'
|
||||
endif
|
||||
elif not with_platform_x11
|
||||
if _xvmc == 'enabled'
|
||||
error('XVMC state tracker requires X11 support.')
|
||||
else
|
||||
_xvmc = 'disabled'
|
||||
endif
|
||||
elif not (with_gallium_r600 or with_gallium_nouveau)
|
||||
if _xvmc == 'enabled'
|
||||
error('XVMC state tracker requires at least one of the following gallium drivers: r600, nouveau.')
|
||||
else
|
||||
_xvmc = 'disabled'
|
||||
endif
|
||||
endif
|
||||
dep_xvmc = null_dep
|
||||
dep_xv = null_dep
|
||||
with_gallium_xvmc = false
|
||||
if _xvmc != 'disabled'
|
||||
dep_xvmc = dependency('xvmc', version : '>= 1.0.6', required : _xvmc == 'enabled')
|
||||
dep_xv = dependency('xv', required : _xvmc == 'enabled')
|
||||
with_gallium_xvmc = dep_xvmc.found() and dep_xv.found()
|
||||
endif
|
||||
|
||||
xvmc_drivers_path = get_option('xvmc-libs-path')
|
||||
if xvmc_drivers_path == ''
|
||||
xvmc_drivers_path = get_option('libdir')
|
||||
endif
|
||||
|
||||
_omx = get_option('gallium-omx')
|
||||
if not system_has_kms_drm
|
||||
if ['auto', 'disabled'].contains(_omx)
|
||||
@ -2152,7 +2111,7 @@ if with_platform_x11
|
||||
dep_xcb_shm = dependency('xcb-shm')
|
||||
endif
|
||||
if (with_any_vk or with_glx == 'dri' or with_egl or
|
||||
(with_gallium_vdpau or with_gallium_xvmc or with_gallium_va or
|
||||
(with_gallium_vdpau or with_gallium_va or
|
||||
with_gallium_omx != 'disabled'))
|
||||
dep_xcb = dependency('xcb')
|
||||
dep_x11_xcb = dependency('x11-xcb')
|
||||
@ -2189,7 +2148,7 @@ if with_platform_x11
|
||||
endif
|
||||
if (with_egl or
|
||||
with_dri3 or (
|
||||
with_gallium_vdpau or with_gallium_xvmc or with_gallium_xa or
|
||||
with_gallium_vdpau or with_gallium_xa or
|
||||
with_gallium_omx != 'disabled'))
|
||||
dep_xcb_xfixes = dependency('xcb-xfixes')
|
||||
endif
|
||||
@ -2408,9 +2367,6 @@ if with_gallium
|
||||
if with_gallium_xa
|
||||
gallium_st += 'xa'
|
||||
endif
|
||||
if with_gallium_xvmc
|
||||
gallium_st += 'xvmc'
|
||||
endif
|
||||
if with_gallium_vdpau
|
||||
gallium_st += 'vdpau'
|
||||
endif
|
||||
|
@ -98,19 +98,6 @@ option(
|
||||
value : '',
|
||||
description : 'path to put vdpau libraries. defaults to $libdir/vdpau.'
|
||||
)
|
||||
option(
|
||||
'gallium-xvmc',
|
||||
type : 'combo',
|
||||
value : 'auto',
|
||||
choices : ['auto', 'true', 'false', 'enabled', 'disabled'],
|
||||
description : 'enable gallium xvmc frontend.',
|
||||
)
|
||||
option(
|
||||
'xvmc-libs-path',
|
||||
type : 'string',
|
||||
value : '',
|
||||
description : 'path to put xvmc libraries. defaults to $libdir.'
|
||||
)
|
||||
option(
|
||||
'gallium-omx',
|
||||
type : 'combo',
|
||||
@ -448,7 +435,7 @@ option(
|
||||
'tools',
|
||||
type : 'array',
|
||||
value : [],
|
||||
choices : ['drm-shim', 'etnaviv', 'freedreno', 'glsl', 'intel', 'intel-ui', 'nir', 'nouveau', 'xvmc', 'lima', 'panfrost', 'asahi', 'imagination', 'all', 'dlclose-skip'],
|
||||
choices : ['drm-shim', 'etnaviv', 'freedreno', 'glsl', 'intel', 'intel-ui', 'nir', 'nouveau', 'lima', 'panfrost', 'asahi', 'imagination', 'all', 'dlclose-skip'],
|
||||
description : 'List of tools to build. (Note: `intel-ui` selects `intel`)',
|
||||
)
|
||||
option(
|
||||
|
@ -1,153 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 Younes Manton.
|
||||
* 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 VMWARE 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 <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/Xvlib.h>
|
||||
#include <X11/extensions/XvMClib.h>
|
||||
|
||||
#include "vl/vl_compositor.h"
|
||||
|
||||
#include "xvmc_private.h"
|
||||
|
||||
#define XV_BRIGHTNESS "XV_BRIGHTNESS"
|
||||
#define XV_CONTRAST "XV_CONTRAST"
|
||||
#define XV_SATURATION "XV_SATURATION"
|
||||
#define XV_HUE "XV_HUE"
|
||||
#define XV_COLORSPACE "XV_COLORSPACE"
|
||||
|
||||
static const XvAttribute attributes[] = {
|
||||
{ XvGettable | XvSettable, -1000, 1000, XV_BRIGHTNESS },
|
||||
{ XvGettable | XvSettable, -1000, 1000, XV_CONTRAST },
|
||||
{ XvGettable | XvSettable, -1000, 1000, XV_SATURATION },
|
||||
{ XvGettable | XvSettable, -1000, 1000, XV_HUE },
|
||||
{ XvGettable | XvSettable, 0, 1, XV_COLORSPACE }
|
||||
};
|
||||
|
||||
PUBLIC
|
||||
XvAttribute* XvMCQueryAttributes(Display *dpy, XvMCContext *context, int *number)
|
||||
{
|
||||
XvAttribute *result;
|
||||
|
||||
assert(dpy && number);
|
||||
|
||||
if (!context || !context->privData)
|
||||
return NULL;
|
||||
|
||||
result = malloc(sizeof(attributes));
|
||||
if (!result)
|
||||
return NULL;
|
||||
|
||||
memcpy(result, attributes, sizeof(attributes));
|
||||
*number = sizeof(attributes) / sizeof(XvAttribute);
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Returning %d attributes for context %p.\n", *number, context);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCSetAttribute(Display *dpy, XvMCContext *context, Atom attribute, int value)
|
||||
{
|
||||
XvMCContextPrivate *context_priv;
|
||||
const char *attr;
|
||||
vl_csc_matrix csc;
|
||||
|
||||
assert(dpy);
|
||||
|
||||
if (!context || !context->privData)
|
||||
return XvMCBadContext;
|
||||
|
||||
context_priv = context->privData;
|
||||
|
||||
attr = XGetAtomName(dpy, attribute);
|
||||
if (!attr)
|
||||
return XvMCBadContext;
|
||||
|
||||
if (strcmp(attr, XV_BRIGHTNESS) == 0)
|
||||
context_priv->procamp.brightness = value / 1000.0f;
|
||||
else if (strcmp(attr, XV_CONTRAST) == 0)
|
||||
context_priv->procamp.contrast = value / 1000.0f + 1.0f;
|
||||
else if (strcmp(attr, XV_SATURATION) == 0)
|
||||
context_priv->procamp.saturation = value / 1000.0f + 1.0f;
|
||||
else if (strcmp(attr, XV_HUE) == 0)
|
||||
context_priv->procamp.hue = value / 1000.0f;
|
||||
else if (strcmp(attr, XV_COLORSPACE) == 0)
|
||||
context_priv->color_standard = value ?
|
||||
VL_CSC_COLOR_STANDARD_BT_601 :
|
||||
VL_CSC_COLOR_STANDARD_BT_709;
|
||||
else
|
||||
return BadName;
|
||||
|
||||
vl_csc_get_matrix
|
||||
(
|
||||
context_priv->color_standard,
|
||||
&context_priv->procamp, true, &csc
|
||||
);
|
||||
vl_compositor_set_csc_matrix(&context_priv->cstate, (const vl_csc_matrix *)&csc, 1.0f, 0.0f);
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Set attribute %s to value %d.\n", attr, value);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCGetAttribute(Display *dpy, XvMCContext *context, Atom attribute, int *value)
|
||||
{
|
||||
XvMCContextPrivate *context_priv;
|
||||
const char *attr;
|
||||
|
||||
assert(dpy);
|
||||
|
||||
if (!context || !context->privData)
|
||||
return XvMCBadContext;
|
||||
|
||||
context_priv = context->privData;
|
||||
|
||||
attr = XGetAtomName(dpy, attribute);
|
||||
if (!attr)
|
||||
return XvMCBadContext;
|
||||
|
||||
if (strcmp(attr, XV_BRIGHTNESS) == 0)
|
||||
*value = context_priv->procamp.brightness * 1000;
|
||||
else if (strcmp(attr, XV_CONTRAST) == 0)
|
||||
*value = context_priv->procamp.contrast * 1000 - 1000;
|
||||
else if (strcmp(attr, XV_SATURATION) == 0)
|
||||
*value = context_priv->procamp.saturation * 1000 + 1000;
|
||||
else if (strcmp(attr, XV_HUE) == 0)
|
||||
*value = context_priv->procamp.hue * 1000;
|
||||
else if (strcmp(attr, XV_COLORSPACE) == 0)
|
||||
*value = context_priv->color_standard == VL_CSC_COLOR_STANDARD_BT_709;
|
||||
else
|
||||
return BadName;
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Got value %d for attribute %s.\n", *value, attr);
|
||||
|
||||
return Success;
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 Younes Manton.
|
||||
* 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 VMWARE 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 <assert.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/XvMClib.h>
|
||||
|
||||
#include "util/u_memory.h"
|
||||
|
||||
#include "xvmc_private.h"
|
||||
|
||||
PUBLIC
|
||||
Status XvMCCreateBlocks(Display *dpy, XvMCContext *context, unsigned int num_blocks, XvMCBlockArray *blocks)
|
||||
{
|
||||
assert(dpy);
|
||||
|
||||
if (!context)
|
||||
return XvMCBadContext;
|
||||
if (num_blocks == 0)
|
||||
return BadValue;
|
||||
|
||||
assert(blocks);
|
||||
|
||||
blocks->context_id = context->context_id;
|
||||
blocks->num_blocks = num_blocks;
|
||||
blocks->blocks = MALLOC(BLOCK_SIZE_BYTES * num_blocks);
|
||||
blocks->privData = NULL;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCDestroyBlocks(Display *dpy, XvMCBlockArray *blocks)
|
||||
{
|
||||
assert(dpy);
|
||||
assert(blocks);
|
||||
FREE(blocks->blocks);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCCreateMacroBlocks(Display *dpy, XvMCContext *context, unsigned int num_blocks, XvMCMacroBlockArray *blocks)
|
||||
{
|
||||
assert(dpy);
|
||||
|
||||
if (!context)
|
||||
return XvMCBadContext;
|
||||
if (num_blocks == 0)
|
||||
return BadValue;
|
||||
|
||||
assert(blocks);
|
||||
|
||||
blocks->context_id = context->context_id;
|
||||
blocks->num_blocks = num_blocks;
|
||||
blocks->macro_blocks = MALLOC(sizeof(XvMCMacroBlock) * num_blocks);
|
||||
blocks->privData = NULL;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCDestroyMacroBlocks(Display *dpy, XvMCMacroBlockArray *blocks)
|
||||
{
|
||||
assert(dpy);
|
||||
assert(blocks);
|
||||
FREE(blocks->macro_blocks);
|
||||
|
||||
return Success;
|
||||
}
|
@ -1,344 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 Younes Manton.
|
||||
* 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 VMWARE 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 <assert.h>
|
||||
|
||||
#include <X11/Xlibint.h>
|
||||
#include <X11/extensions/XvMClib.h>
|
||||
|
||||
#include "pipe/p_screen.h"
|
||||
#include "pipe/p_video_codec.h"
|
||||
#include "pipe/p_video_state.h"
|
||||
#include "pipe/p_state.h"
|
||||
|
||||
#include "util/u_memory.h"
|
||||
|
||||
#include "vl/vl_csc.h"
|
||||
#include "vl/vl_winsys.h"
|
||||
|
||||
#include "xvmc_private.h"
|
||||
|
||||
static Status Validate(Display *dpy, XvPortID port, int surface_type_id,
|
||||
unsigned int width, unsigned int height, int flags,
|
||||
bool *found_port, int *screen, int *chroma_format,
|
||||
int *mc_type, int *surface_flags,
|
||||
unsigned short *subpic_max_w,
|
||||
unsigned short *subpic_max_h)
|
||||
{
|
||||
bool found_surface = false;
|
||||
XvAdaptorInfo *adaptor_info;
|
||||
unsigned int num_adaptors;
|
||||
int num_types;
|
||||
unsigned int max_width = 0, max_height = 0;
|
||||
Status ret;
|
||||
|
||||
assert(dpy);
|
||||
assert(found_port);
|
||||
assert(screen);
|
||||
assert(chroma_format);
|
||||
assert(mc_type);
|
||||
assert(surface_flags);
|
||||
assert(subpic_max_w);
|
||||
assert(subpic_max_h);
|
||||
|
||||
*found_port = false;
|
||||
|
||||
for (int i = 0; i < XScreenCount(dpy); ++i) {
|
||||
ret = XvQueryAdaptors(dpy, XRootWindow(dpy, i), &num_adaptors, &adaptor_info);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
|
||||
for (unsigned int j = 0; j < num_adaptors && !*found_port; ++j) {
|
||||
for (unsigned int k = 0; k < adaptor_info[j].num_ports && !*found_port; ++k) {
|
||||
XvMCSurfaceInfo *surface_info;
|
||||
|
||||
if (adaptor_info[j].base_id + k != port)
|
||||
continue;
|
||||
|
||||
*found_port = true;
|
||||
|
||||
surface_info = XvMCListSurfaceTypes(dpy, adaptor_info[j].base_id, &num_types);
|
||||
if (!surface_info) {
|
||||
XvFreeAdaptorInfo(adaptor_info);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
for (int l = 0; l < num_types && !found_surface; ++l) {
|
||||
if (surface_info[l].surface_type_id != surface_type_id)
|
||||
continue;
|
||||
|
||||
found_surface = true;
|
||||
max_width = surface_info[l].max_width;
|
||||
max_height = surface_info[l].max_height;
|
||||
*chroma_format = surface_info[l].chroma_format;
|
||||
*mc_type = surface_info[l].mc_type;
|
||||
*surface_flags = surface_info[l].flags;
|
||||
*subpic_max_w = surface_info[l].subpicture_max_width;
|
||||
*subpic_max_h = surface_info[l].subpicture_max_height;
|
||||
*screen = i;
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Found requested context surface format.\n" \
|
||||
"[XvMC] screen=%u, port=%u\n" \
|
||||
"[XvMC] id=0x%08X\n" \
|
||||
"[XvMC] max width=%u, max height=%u\n" \
|
||||
"[XvMC] chroma format=0x%08X\n" \
|
||||
"[XvMC] acceleration level=0x%08X\n" \
|
||||
"[XvMC] flags=0x%08X\n" \
|
||||
"[XvMC] subpicture max width=%u, max height=%u\n",
|
||||
i, port, surface_type_id, max_width, max_height, *chroma_format,
|
||||
*mc_type, *surface_flags, *subpic_max_w, *subpic_max_h);
|
||||
}
|
||||
|
||||
free(surface_info);
|
||||
}
|
||||
}
|
||||
|
||||
XvFreeAdaptorInfo(adaptor_info);
|
||||
}
|
||||
|
||||
if (!*found_port) {
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Could not find a suitable port.\n");
|
||||
return XvBadPort;
|
||||
}
|
||||
if (!found_surface) {
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Could not find a suitable surface.\n");
|
||||
return BadMatch;
|
||||
}
|
||||
if (width > max_width || height > max_height) {
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Requested context dimensions (w=%u,h=%u) too large (max w=%u,h=%u).\n",
|
||||
width, height, max_width, max_height);
|
||||
return BadValue;
|
||||
}
|
||||
if (flags != XVMC_DIRECT && flags != 0) {
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Invalid context flags 0x%08X.\n", flags);
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static enum pipe_video_profile ProfileToPipe(int xvmc_profile)
|
||||
{
|
||||
if (xvmc_profile & XVMC_MPEG_1)
|
||||
assert(0);
|
||||
if (xvmc_profile & XVMC_MPEG_2)
|
||||
return PIPE_VIDEO_PROFILE_MPEG2_MAIN;
|
||||
if (xvmc_profile & XVMC_H263)
|
||||
assert(0);
|
||||
if (xvmc_profile & XVMC_MPEG_4)
|
||||
assert(0);
|
||||
|
||||
assert(0);
|
||||
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized profile 0x%08X.\n", xvmc_profile);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static enum pipe_video_chroma_format FormatToPipe(int xvmc_format)
|
||||
{
|
||||
switch (xvmc_format) {
|
||||
case XVMC_CHROMA_FORMAT_420:
|
||||
return PIPE_VIDEO_CHROMA_FORMAT_420;
|
||||
case XVMC_CHROMA_FORMAT_422:
|
||||
return PIPE_VIDEO_CHROMA_FORMAT_422;
|
||||
case XVMC_CHROMA_FORMAT_444:
|
||||
return PIPE_VIDEO_CHROMA_FORMAT_444;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized format 0x%08X.\n", xvmc_format);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
|
||||
int width, int height, int flags, XvMCContext *context)
|
||||
{
|
||||
bool found_port;
|
||||
int scrn = 0;
|
||||
int chroma_format = 0;
|
||||
int mc_type = 0;
|
||||
int surface_flags = 0;
|
||||
unsigned short subpic_max_w = 0;
|
||||
unsigned short subpic_max_h = 0;
|
||||
Status ret;
|
||||
struct vl_screen *vscreen;
|
||||
struct pipe_context *pipe;
|
||||
struct pipe_video_codec templat = {0};
|
||||
XvMCContextPrivate *context_priv;
|
||||
vl_csc_matrix csc;
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Creating context %p.\n", context);
|
||||
|
||||
assert(dpy);
|
||||
|
||||
if (!context)
|
||||
return XvMCBadContext;
|
||||
|
||||
ret = Validate(dpy, port, surface_type_id, width, height, flags,
|
||||
&found_port, &scrn, &chroma_format, &mc_type, &surface_flags,
|
||||
&subpic_max_w, &subpic_max_h);
|
||||
|
||||
/* Success and XvBadPort have the same value */
|
||||
if (ret != Success || !found_port)
|
||||
return ret;
|
||||
|
||||
/* XXX: Current limits */
|
||||
if (chroma_format != XVMC_CHROMA_FORMAT_420) {
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Cannot decode requested surface type. Unsupported chroma format.\n");
|
||||
return BadImplementation;
|
||||
}
|
||||
if ((mc_type & ~XVMC_IDCT) != (XVMC_MOCOMP | XVMC_MPEG_2)) {
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Cannot decode requested surface type. Non-MPEG2/Mocomp/iDCT acceleration unsupported.\n");
|
||||
return BadImplementation;
|
||||
}
|
||||
if (surface_flags & XVMC_INTRA_UNSIGNED) {
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Cannot decode requested surface type. Unsigned intra unsupported.\n");
|
||||
return BadImplementation;
|
||||
}
|
||||
|
||||
context_priv = CALLOC(1, sizeof(XvMCContextPrivate));
|
||||
if (!context_priv)
|
||||
return BadAlloc;
|
||||
|
||||
/* TODO: Reuse screen if process creates another context */
|
||||
vscreen = vl_dri3_screen_create(dpy, scrn);
|
||||
if (!vscreen)
|
||||
vscreen = vl_dri2_screen_create(dpy, scrn);
|
||||
|
||||
if (!vscreen) {
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL screen.\n");
|
||||
FREE(context_priv);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
pipe = vscreen->pscreen->context_create(vscreen->pscreen, NULL, 0);
|
||||
if (!pipe) {
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL context.\n");
|
||||
vscreen->destroy(vscreen);
|
||||
FREE(context_priv);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
templat.profile = ProfileToPipe(mc_type);
|
||||
templat.entrypoint = (mc_type & XVMC_IDCT) ? PIPE_VIDEO_ENTRYPOINT_IDCT : PIPE_VIDEO_ENTRYPOINT_MC;
|
||||
templat.chroma_format = FormatToPipe(chroma_format);
|
||||
templat.width = width;
|
||||
templat.height = height;
|
||||
templat.max_references = 2;
|
||||
templat.expect_chunked_decode = true;
|
||||
|
||||
context_priv->decoder = pipe->create_video_codec(pipe, &templat);
|
||||
|
||||
if (!context_priv->decoder) {
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL decoder.\n");
|
||||
pipe->destroy(pipe);
|
||||
vscreen->destroy(vscreen);
|
||||
FREE(context_priv);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
if (!vl_compositor_init(&context_priv->compositor, pipe)) {
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL compositor.\n");
|
||||
context_priv->decoder->destroy(context_priv->decoder);
|
||||
pipe->destroy(pipe);
|
||||
vscreen->destroy(vscreen);
|
||||
FREE(context_priv);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
if (!vl_compositor_init_state(&context_priv->cstate, pipe)) {
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL compositor state.\n");
|
||||
vl_compositor_cleanup(&context_priv->compositor);
|
||||
context_priv->decoder->destroy(context_priv->decoder);
|
||||
pipe->destroy(pipe);
|
||||
vscreen->destroy(vscreen);
|
||||
FREE(context_priv);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
|
||||
context_priv->color_standard =
|
||||
debug_get_bool_option("G3DVL_NO_CSC", FALSE) ?
|
||||
VL_CSC_COLOR_STANDARD_IDENTITY : VL_CSC_COLOR_STANDARD_BT_601;
|
||||
context_priv->procamp = vl_default_procamp;
|
||||
|
||||
vl_csc_get_matrix
|
||||
(
|
||||
context_priv->color_standard,
|
||||
&context_priv->procamp, true, &csc
|
||||
);
|
||||
vl_compositor_set_csc_matrix(&context_priv->cstate, (const vl_csc_matrix *)&csc, 1.0f, 0.0f);
|
||||
|
||||
context_priv->vscreen = vscreen;
|
||||
context_priv->pipe = pipe;
|
||||
context_priv->subpicture_max_width = subpic_max_w;
|
||||
context_priv->subpicture_max_height = subpic_max_h;
|
||||
|
||||
context->context_id = XAllocID(dpy);
|
||||
context->surface_type_id = surface_type_id;
|
||||
context->width = width;
|
||||
context->height = height;
|
||||
context->flags = flags;
|
||||
context->port = port;
|
||||
context->privData = context_priv;
|
||||
|
||||
SyncHandle();
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Context %p created.\n", context);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCDestroyContext(Display *dpy, XvMCContext *context)
|
||||
{
|
||||
XvMCContextPrivate *context_priv;
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Destroying context %p.\n", context);
|
||||
|
||||
assert(dpy);
|
||||
|
||||
if (!context || !context->privData)
|
||||
return XvMCBadContext;
|
||||
|
||||
context_priv = context->privData;
|
||||
context_priv->decoder->destroy(context_priv->decoder);
|
||||
vl_compositor_cleanup_state(&context_priv->cstate);
|
||||
vl_compositor_cleanup(&context_priv->compositor);
|
||||
context_priv->pipe->destroy(context_priv->pipe);
|
||||
context_priv->vscreen->destroy(context_priv->vscreen);
|
||||
FREE(context_priv);
|
||||
context->privData = NULL;
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Context %p destroyed.\n", context);
|
||||
|
||||
return Success;
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
# Copyright © 2017, 2019 Intel Corporation
|
||||
|
||||
# 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 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.
|
||||
|
||||
XVMC_MAJOR = 1
|
||||
XVMC_MINOR = 0
|
||||
|
||||
libxvmc_st = static_library(
|
||||
'xvmc_st',
|
||||
files('attributes.c', 'block.c', 'context.c', 'surface.c', 'subpicture.c'),
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
|
||||
dependencies : [
|
||||
dep_xvmc, dep_x11_xcb, dep_xcb, dep_xcb_dri2, dep_xcb_dri3, dep_xv,
|
||||
dep_libdrm, idep_mesautil,
|
||||
],
|
||||
)
|
||||
|
||||
# These tests will not work without a working xvmc configuration.
|
||||
if with_tools.contains('xvmc')
|
||||
# pkg-config was added in 1.0.12, so allow fallback
|
||||
dep_xvmcw = dependency('xvmc-wrapper', required : false)
|
||||
if not dep_xvmcw.found()
|
||||
dep_xvmcw = cc.find_library('XvMCW')
|
||||
endif
|
||||
dep_real_xvmc = dependency('xvmc')
|
||||
|
||||
foreach x : ['context', 'surface', 'subpicture', 'blocks', 'rendering']
|
||||
_name = 'xvmc_@0@'.format(x)
|
||||
executable(
|
||||
_name,
|
||||
files('tests/test_@0@.c'.format(x), 'tests/testlib.c'),
|
||||
dependencies : [
|
||||
dep_real_xvmc, dep_x11_xcb, dep_xcb, dep_xcb_dri2, dep_xcb_dri3,
|
||||
dep_xvmcw, dep_xv,
|
||||
],
|
||||
install: true,
|
||||
)
|
||||
endforeach
|
||||
|
||||
executable(
|
||||
'xvmc_bench',
|
||||
files('tests/xvmc_bench.c', 'tests/testlib.c'),
|
||||
dependencies : [
|
||||
dep_real_xvmc, dep_x11_xcb, dep_xcb, dep_xcb_dri2, dep_xcb_dri3,
|
||||
dep_xvmcw, dep_xv,
|
||||
],
|
||||
install: true,
|
||||
)
|
||||
endif
|
@ -1,602 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 Younes Manton.
|
||||
* 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 VMWARE 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 <assert.h>
|
||||
|
||||
#include <X11/Xlibint.h>
|
||||
#include <X11/extensions/XvMClib.h>
|
||||
|
||||
#include "pipe/p_screen.h"
|
||||
#include "pipe/p_video_codec.h"
|
||||
#include "pipe/p_state.h"
|
||||
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_math.h"
|
||||
#include "util/format/u_format.h"
|
||||
#include "util/u_sampler.h"
|
||||
#include "util/u_surface.h"
|
||||
#include "util/u_rect.h"
|
||||
#include "vl/vl_winsys.h"
|
||||
|
||||
#include "xvmc_private.h"
|
||||
|
||||
#define FOURCC_RGB 0x0000003
|
||||
#define FOURCC_AI44 0x34344941
|
||||
#define FOURCC_IA44 0x34344149
|
||||
|
||||
static enum pipe_format XvIDToPipe(struct pipe_screen *screen,
|
||||
int xvimage_id)
|
||||
{
|
||||
enum pipe_format ret;
|
||||
assert(screen);
|
||||
|
||||
switch (xvimage_id) {
|
||||
case FOURCC_RGB:
|
||||
ret = PIPE_FORMAT_B8G8R8X8_UNORM;
|
||||
break;
|
||||
|
||||
case FOURCC_AI44:
|
||||
ret = PIPE_FORMAT_R4A4_UNORM;
|
||||
if (!screen->is_format_supported(
|
||||
screen, ret, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW))
|
||||
ret = PIPE_FORMAT_B4G4R4A4_UNORM;
|
||||
break;
|
||||
|
||||
case FOURCC_IA44:
|
||||
ret = PIPE_FORMAT_A4R4_UNORM;
|
||||
if (!screen->is_format_supported(
|
||||
screen, ret, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW))
|
||||
ret = PIPE_FORMAT_B4G4R4A4_UNORM;
|
||||
break;
|
||||
|
||||
default:
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized Xv image ID 0x%08X.\n", xvimage_id);
|
||||
return PIPE_FORMAT_NONE;
|
||||
}
|
||||
|
||||
if (!screen->is_format_supported(
|
||||
screen, ret, PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW)) {
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Unsupported 2D format %s for Xv image ID 0x%08X.\n", util_format_name(ret), xvimage_id);
|
||||
ret = PIPE_FORMAT_NONE;
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
static unsigned NumPaletteEntries4XvID(int xvimage_id)
|
||||
{
|
||||
switch (xvimage_id) {
|
||||
case FOURCC_RGB:
|
||||
return 0;
|
||||
|
||||
case FOURCC_AI44:
|
||||
case FOURCC_IA44:
|
||||
return 16;
|
||||
|
||||
default:
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized Xv image ID 0x%08X.\n", xvimage_id);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int PipeToComponentOrder(struct pipe_screen *screen,
|
||||
enum pipe_format format,
|
||||
enum pipe_format *palette_format,
|
||||
char *component_order)
|
||||
{
|
||||
assert(screen);
|
||||
assert(component_order);
|
||||
assert(palette_format);
|
||||
|
||||
switch (format) {
|
||||
case PIPE_FORMAT_B8G8R8X8_UNORM:
|
||||
return 0;
|
||||
|
||||
case PIPE_FORMAT_A4R4_UNORM:
|
||||
case PIPE_FORMAT_R4A4_UNORM:
|
||||
case PIPE_FORMAT_B4G4R4A4_UNORM:
|
||||
*palette_format = PIPE_FORMAT_R8G8B8X8_UNORM;
|
||||
component_order[0] = 'Y';
|
||||
component_order[1] = 'U';
|
||||
component_order[2] = 'V';
|
||||
component_order[3] = 'A';
|
||||
if (!screen->is_format_supported(
|
||||
screen, *palette_format, PIPE_TEXTURE_1D, 0, 0,
|
||||
PIPE_BIND_SAMPLER_VIEW)) {
|
||||
/* One of these formats better be supported... */
|
||||
*palette_format = PIPE_FORMAT_B8G8R8X8_UNORM;
|
||||
component_order[0] = 'V';
|
||||
component_order[2] = 'Y';
|
||||
}
|
||||
return 4;
|
||||
|
||||
default:
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized PIPE_FORMAT 0x%08X.\n", format);
|
||||
component_order[0] = 0;
|
||||
component_order[1] = 0;
|
||||
component_order[2] = 0;
|
||||
component_order[3] = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static Status Validate(Display *dpy, XvPortID port, int surface_type_id, int xvimage_id)
|
||||
{
|
||||
XvImageFormatValues *subpictures;
|
||||
int num_subpics;
|
||||
int i;
|
||||
|
||||
subpictures = XvMCListSubpictureTypes(dpy, port, surface_type_id, &num_subpics);
|
||||
if (num_subpics < 1) {
|
||||
free(subpictures);
|
||||
return BadMatch;
|
||||
}
|
||||
if (!subpictures)
|
||||
return BadAlloc;
|
||||
|
||||
for (i = 0; i < num_subpics; ++i) {
|
||||
if (subpictures[i].id == xvimage_id) {
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Found requested subpicture format.\n" \
|
||||
"[XvMC] port=%u\n" \
|
||||
"[XvMC] surface id=0x%08X\n" \
|
||||
"[XvMC] image id=0x%08X\n" \
|
||||
"[XvMC] type=%08X\n" \
|
||||
"[XvMC] byte order=%08X\n" \
|
||||
"[XvMC] bits per pixel=%u\n" \
|
||||
"[XvMC] format=%08X\n" \
|
||||
"[XvMC] num planes=%d\n",
|
||||
port, surface_type_id, xvimage_id, subpictures[i].type, subpictures[i].byte_order,
|
||||
subpictures[i].bits_per_pixel, subpictures[i].format, subpictures[i].num_planes);
|
||||
if (subpictures[i].type == XvRGB) {
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] depth=%d\n" \
|
||||
"[XvMC] red mask=0x%08X\n" \
|
||||
"[XvMC] green mask=0x%08X\n" \
|
||||
"[XvMC] blue mask=0x%08X\n",
|
||||
subpictures[i].depth, subpictures[i].red_mask,
|
||||
subpictures[i].green_mask, subpictures[i].blue_mask);
|
||||
}
|
||||
else if (subpictures[i].type == XvYUV) {
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] y sample bits=0x%08X\n" \
|
||||
"[XvMC] u sample bits=0x%08X\n" \
|
||||
"[XvMC] v sample bits=0x%08X\n" \
|
||||
"[XvMC] horz y period=%u\n" \
|
||||
"[XvMC] horz u period=%u\n" \
|
||||
"[XvMC] horz v period=%u\n" \
|
||||
"[XvMC] vert y period=%u\n" \
|
||||
"[XvMC] vert u period=%u\n" \
|
||||
"[XvMC] vert v period=%u\n",
|
||||
subpictures[i].y_sample_bits, subpictures[i].u_sample_bits, subpictures[i].v_sample_bits,
|
||||
subpictures[i].horz_y_period, subpictures[i].horz_u_period, subpictures[i].horz_v_period,
|
||||
subpictures[i].vert_y_period, subpictures[i].vert_u_period, subpictures[i].vert_v_period);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free(subpictures);
|
||||
|
||||
return i < num_subpics ? Success : BadMatch;
|
||||
}
|
||||
|
||||
static void
|
||||
upload_sampler(struct pipe_context *pipe, struct pipe_sampler_view *dst,
|
||||
const struct pipe_box *dst_box, const void *src, unsigned src_stride,
|
||||
unsigned src_x, unsigned src_y)
|
||||
{
|
||||
struct pipe_transfer *transfer;
|
||||
void *map;
|
||||
|
||||
map = pipe->texture_map(pipe, dst->texture, 0, PIPE_MAP_WRITE,
|
||||
dst_box, &transfer);
|
||||
if (!map)
|
||||
return;
|
||||
|
||||
util_copy_rect(map, dst->texture->format, transfer->stride, 0, 0,
|
||||
dst_box->width, dst_box->height,
|
||||
src, src_stride, src_x, src_y);
|
||||
|
||||
pipe->texture_unmap(pipe, transfer);
|
||||
}
|
||||
|
||||
static void
|
||||
upload_sampler_convert(struct pipe_context *pipe, struct pipe_sampler_view *dst,
|
||||
const struct pipe_box *dst_box, const XvImage *image,
|
||||
unsigned src_x, unsigned src_y)
|
||||
{
|
||||
struct pipe_transfer *transfer;
|
||||
int i, j;
|
||||
char *map, *src;
|
||||
|
||||
map = pipe->texture_map(pipe, dst->texture, 0, PIPE_MAP_WRITE,
|
||||
dst_box, &transfer);
|
||||
if (!map)
|
||||
return;
|
||||
|
||||
src = image->data;
|
||||
src += src_y * image->width + src_x;
|
||||
if (image->id == FOURCC_AI44) {
|
||||
/* The format matches what we want, we just have to insert dummy
|
||||
* bytes. So just copy the same value in twice.
|
||||
*/
|
||||
for (i = 0; i < dst_box->height; i++, map += transfer->stride, src += image->width)
|
||||
for (j = 0; j < dst_box->width; j++)
|
||||
map[j * 2 + 0] = map[j * 2 + 1] = src[j];
|
||||
} else {
|
||||
assert(image->id == FOURCC_IA44);
|
||||
/* Same idea as above, but we have to swap the low and high nibbles.
|
||||
*/
|
||||
for (i = 0; i < dst_box->height; i++, map += transfer->stride, src += image->width)
|
||||
for (j = 0; j < dst_box->width; j++)
|
||||
map[j * 2 + 0] = map[j * 2 + 1] = (src[j] >> 4) | (src[j] << 4);
|
||||
}
|
||||
|
||||
pipe->texture_unmap(pipe, transfer);
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture *subpicture,
|
||||
unsigned short width, unsigned short height, int xvimage_id)
|
||||
{
|
||||
XvMCContextPrivate *context_priv;
|
||||
XvMCSubpicturePrivate *subpicture_priv;
|
||||
struct pipe_context *pipe;
|
||||
struct pipe_resource tex_templ, *tex;
|
||||
struct pipe_sampler_view sampler_templ;
|
||||
enum pipe_format palette_format;
|
||||
Status ret;
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Creating subpicture %p.\n", subpicture);
|
||||
|
||||
assert(dpy);
|
||||
|
||||
if (!context)
|
||||
return XvMCBadContext;
|
||||
|
||||
context_priv = context->privData;
|
||||
pipe = context_priv->pipe;
|
||||
|
||||
if (!subpicture)
|
||||
return XvMCBadSubpicture;
|
||||
|
||||
if (width > context_priv->subpicture_max_width ||
|
||||
height > context_priv->subpicture_max_height)
|
||||
return BadValue;
|
||||
|
||||
ret = Validate(dpy, context->port, context->surface_type_id, xvimage_id);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
|
||||
subpicture_priv = CALLOC(1, sizeof(XvMCSubpicturePrivate));
|
||||
if (!subpicture_priv)
|
||||
return BadAlloc;
|
||||
|
||||
memset(&tex_templ, 0, sizeof(tex_templ));
|
||||
tex_templ.target = PIPE_TEXTURE_2D;
|
||||
tex_templ.format = XvIDToPipe(pipe->screen, xvimage_id);
|
||||
tex_templ.last_level = 0;
|
||||
if (pipe->screen->get_video_param(pipe->screen,
|
||||
PIPE_VIDEO_PROFILE_UNKNOWN,
|
||||
PIPE_VIDEO_ENTRYPOINT_UNKNOWN,
|
||||
PIPE_VIDEO_CAP_NPOT_TEXTURES)) {
|
||||
tex_templ.width0 = width;
|
||||
tex_templ.height0 = height;
|
||||
}
|
||||
else {
|
||||
tex_templ.width0 = util_next_power_of_two(width);
|
||||
tex_templ.height0 = util_next_power_of_two(height);
|
||||
}
|
||||
tex_templ.depth0 = 1;
|
||||
tex_templ.array_size = 1;
|
||||
tex_templ.usage = PIPE_USAGE_DYNAMIC;
|
||||
tex_templ.bind = PIPE_BIND_SAMPLER_VIEW;
|
||||
tex_templ.flags = 0;
|
||||
|
||||
tex = pipe->screen->resource_create(pipe->screen, &tex_templ);
|
||||
|
||||
memset(&sampler_templ, 0, sizeof(sampler_templ));
|
||||
u_sampler_view_default_template(&sampler_templ, tex, tex->format);
|
||||
|
||||
subpicture_priv->sampler = pipe->create_sampler_view(pipe, tex, &sampler_templ);
|
||||
pipe_resource_reference(&tex, NULL);
|
||||
if (!subpicture_priv->sampler) {
|
||||
FREE(subpicture_priv);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
subpicture_priv->context = context;
|
||||
subpicture->subpicture_id = XAllocID(dpy);
|
||||
subpicture->context_id = context->context_id;
|
||||
subpicture->xvimage_id = xvimage_id;
|
||||
subpicture->width = width;
|
||||
subpicture->height = height;
|
||||
subpicture->num_palette_entries = NumPaletteEntries4XvID(xvimage_id);
|
||||
subpicture->entry_bytes = PipeToComponentOrder(
|
||||
pipe->screen, tex_templ.format, &palette_format,
|
||||
subpicture->component_order);
|
||||
subpicture->privData = subpicture_priv;
|
||||
|
||||
if (subpicture->num_palette_entries > 0) {
|
||||
tex_templ.target = PIPE_TEXTURE_1D;
|
||||
tex_templ.format = palette_format;
|
||||
tex_templ.width0 = subpicture->num_palette_entries;
|
||||
tex_templ.height0 = 1;
|
||||
tex_templ.usage = PIPE_USAGE_DEFAULT;
|
||||
|
||||
tex = pipe->screen->resource_create(pipe->screen, &tex_templ);
|
||||
|
||||
memset(&sampler_templ, 0, sizeof(sampler_templ));
|
||||
u_sampler_view_default_template(&sampler_templ, tex, tex->format);
|
||||
sampler_templ.swizzle_a = PIPE_SWIZZLE_1;
|
||||
subpicture_priv->palette = pipe->create_sampler_view(pipe, tex, &sampler_templ);
|
||||
pipe_resource_reference(&tex, NULL);
|
||||
if (!subpicture_priv->sampler) {
|
||||
FREE(subpicture_priv);
|
||||
return BadAlloc;
|
||||
}
|
||||
}
|
||||
|
||||
SyncHandle();
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Subpicture %p created.\n", subpicture);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCClearSubpicture(Display *dpy, XvMCSubpicture *subpicture, short x, short y,
|
||||
unsigned short width, unsigned short height, unsigned int color)
|
||||
{
|
||||
XvMCSubpicturePrivate *subpicture_priv;
|
||||
XvMCContextPrivate *context_priv;
|
||||
struct pipe_context *pipe;
|
||||
struct pipe_sampler_view *dst;
|
||||
struct pipe_box dst_box = {x, y, 0, width, height, 1};
|
||||
struct pipe_transfer *transfer;
|
||||
union util_color uc;
|
||||
void *map;
|
||||
|
||||
assert(dpy);
|
||||
|
||||
if (!subpicture)
|
||||
return XvMCBadSubpicture;
|
||||
|
||||
/* Convert color to float */
|
||||
util_format_unpack_rgba(PIPE_FORMAT_B8G8R8A8_UNORM, uc.f, &color, 1);
|
||||
|
||||
subpicture_priv = subpicture->privData;
|
||||
context_priv = subpicture_priv->context->privData;
|
||||
pipe = context_priv->pipe;
|
||||
dst = subpicture_priv->sampler;
|
||||
|
||||
/* TODO: Assert clear rect is within bounds? Or clip? */
|
||||
map = pipe->texture_map(pipe, dst->texture, 0, PIPE_MAP_WRITE,
|
||||
&dst_box, &transfer);
|
||||
if (!map)
|
||||
return XvMCBadSubpicture;
|
||||
|
||||
util_fill_rect(map, dst->texture->format, transfer->stride, 0, 0,
|
||||
dst_box.width, dst_box.height, &uc);
|
||||
|
||||
pipe->texture_unmap(pipe, transfer);
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCCompositeSubpicture(Display *dpy, XvMCSubpicture *subpicture, XvImage *image,
|
||||
short srcx, short srcy, unsigned short width, unsigned short height,
|
||||
short dstx, short dsty)
|
||||
{
|
||||
XvMCSubpicturePrivate *subpicture_priv;
|
||||
XvMCContextPrivate *context_priv;
|
||||
struct pipe_context *pipe;
|
||||
struct pipe_box dst_box = {dstx, dsty, 0, width, height, 1};
|
||||
unsigned src_stride;
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Compositing subpicture %p.\n", subpicture);
|
||||
|
||||
assert(dpy);
|
||||
|
||||
if (!subpicture)
|
||||
return XvMCBadSubpicture;
|
||||
|
||||
assert(image);
|
||||
|
||||
if (subpicture->xvimage_id != image->id)
|
||||
return BadMatch;
|
||||
|
||||
/* No planar support for now */
|
||||
if (image->num_planes != 1)
|
||||
return BadMatch;
|
||||
|
||||
subpicture_priv = subpicture->privData;
|
||||
context_priv = subpicture_priv->context->privData;
|
||||
pipe = context_priv->pipe;
|
||||
|
||||
/* clipping should be done by upload_sampler and regardles what the documentation
|
||||
says image->pitches[0] doesn't seems to be in bytes, so don't use it */
|
||||
if ((image->id == FOURCC_IA44 || image->id == FOURCC_AI44) &&
|
||||
subpicture_priv->sampler->texture->format == PIPE_FORMAT_B4G4R4A4_UNORM) {
|
||||
upload_sampler_convert(pipe, subpicture_priv->sampler, &dst_box, image, srcx, srcy);
|
||||
} else {
|
||||
src_stride = image->width * util_format_get_blocksize(subpicture_priv->sampler->texture->format);
|
||||
upload_sampler(pipe, subpicture_priv->sampler, &dst_box, image->data, src_stride, srcx, srcy);
|
||||
}
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Subpicture %p composited.\n", subpicture);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCDestroySubpicture(Display *dpy, XvMCSubpicture *subpicture)
|
||||
{
|
||||
XvMCSubpicturePrivate *subpicture_priv;
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Destroying subpicture %p.\n", subpicture);
|
||||
|
||||
assert(dpy);
|
||||
|
||||
if (!subpicture)
|
||||
return XvMCBadSubpicture;
|
||||
|
||||
subpicture_priv = subpicture->privData;
|
||||
pipe_sampler_view_reference(&subpicture_priv->sampler, NULL);
|
||||
pipe_sampler_view_reference(&subpicture_priv->palette, NULL);
|
||||
FREE(subpicture_priv);
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Subpicture %p destroyed.\n", subpicture);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCSetSubpicturePalette(Display *dpy, XvMCSubpicture *subpicture, unsigned char *palette)
|
||||
{
|
||||
XvMCSubpicturePrivate *subpicture_priv;
|
||||
XvMCContextPrivate *context_priv;
|
||||
struct pipe_context *pipe;
|
||||
struct pipe_box dst_box = {0, 0, 0, 0, 1, 1};
|
||||
|
||||
assert(dpy);
|
||||
assert(palette);
|
||||
|
||||
if (!subpicture)
|
||||
return XvMCBadSubpicture;
|
||||
|
||||
subpicture_priv = subpicture->privData;
|
||||
context_priv = subpicture_priv->context->privData;
|
||||
pipe = context_priv->pipe;
|
||||
|
||||
dst_box.width = subpicture->num_palette_entries;
|
||||
|
||||
upload_sampler(pipe, subpicture_priv->palette, &dst_box, palette, 0, 0, 0);
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Palette of Subpicture %p set.\n", subpicture);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCBlendSubpicture(Display *dpy, 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)
|
||||
{
|
||||
struct u_rect src_rect = {subx, subx + subw, suby, suby + subh};
|
||||
struct u_rect dst_rect = {surfx, surfx + surfw, surfy, surfy + surfh};
|
||||
|
||||
XvMCSurfacePrivate *surface_priv;
|
||||
XvMCSubpicturePrivate *subpicture_priv;
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Associating subpicture %p with surface %p.\n", subpicture, target_surface);
|
||||
|
||||
assert(dpy);
|
||||
|
||||
if (!target_surface)
|
||||
return XvMCBadSurface;
|
||||
|
||||
if (!subpicture)
|
||||
return XvMCBadSubpicture;
|
||||
|
||||
if (target_surface->context_id != subpicture->context_id)
|
||||
return BadMatch;
|
||||
|
||||
/* TODO: Verify against subpicture independent scaling */
|
||||
|
||||
surface_priv = target_surface->privData;
|
||||
subpicture_priv = subpicture->privData;
|
||||
|
||||
/* TODO: Assert rects are within bounds? Or clip? */
|
||||
subpicture_priv->src_rect = src_rect;
|
||||
subpicture_priv->dst_rect = dst_rect;
|
||||
|
||||
surface_priv->subpicture = subpicture;
|
||||
subpicture_priv->surface = target_surface;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCBlendSubpicture2(Display *dpy, 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)
|
||||
{
|
||||
assert(dpy);
|
||||
|
||||
if (!source_surface || !target_surface)
|
||||
return XvMCBadSurface;
|
||||
|
||||
if (!subpicture)
|
||||
return XvMCBadSubpicture;
|
||||
|
||||
if (source_surface->context_id != subpicture->context_id)
|
||||
return BadMatch;
|
||||
|
||||
if (source_surface->context_id != subpicture->context_id)
|
||||
return BadMatch;
|
||||
|
||||
/* TODO: Assert rects are within bounds? Or clip? */
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCSyncSubpicture(Display *dpy, XvMCSubpicture *subpicture)
|
||||
{
|
||||
assert(dpy);
|
||||
|
||||
if (!subpicture)
|
||||
return XvMCBadSubpicture;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCFlushSubpicture(Display *dpy, XvMCSubpicture *subpicture)
|
||||
{
|
||||
assert(dpy);
|
||||
|
||||
if (!subpicture)
|
||||
return XvMCBadSubpicture;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCGetSubpictureStatus(Display *dpy, XvMCSubpicture *subpicture, int *status)
|
||||
{
|
||||
assert(dpy);
|
||||
|
||||
if (!subpicture)
|
||||
return XvMCBadSubpicture;
|
||||
|
||||
assert(status);
|
||||
|
||||
/* TODO */
|
||||
*status = 0;
|
||||
|
||||
return Success;
|
||||
}
|
@ -1,539 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 Younes Manton.
|
||||
* 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 VMWARE 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 <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <X11/Xlibint.h>
|
||||
|
||||
#include "pipe/p_video_codec.h"
|
||||
#include "pipe/p_video_state.h"
|
||||
#include "pipe/p_state.h"
|
||||
|
||||
#include "util/macros.h"
|
||||
#include "util/u_inlines.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_math.h"
|
||||
#include "vl/vl_winsys.h"
|
||||
|
||||
#include "xvmc_private.h"
|
||||
|
||||
static void
|
||||
MacroBlocksToPipe(XvMCContextPrivate *context,
|
||||
XvMCSurfacePrivate *surface,
|
||||
unsigned int xvmc_picture_structure,
|
||||
const XvMCMacroBlock *xvmc_mb,
|
||||
const XvMCBlockArray *xvmc_blocks,
|
||||
struct pipe_mpeg12_macroblock *mb,
|
||||
unsigned int num_macroblocks)
|
||||
{
|
||||
unsigned int i, j, k;
|
||||
|
||||
assert(xvmc_mb);
|
||||
assert(xvmc_blocks);
|
||||
assert(num_macroblocks);
|
||||
|
||||
for (; num_macroblocks > 0; --num_macroblocks) {
|
||||
mb->base.codec = PIPE_VIDEO_FORMAT_MPEG12;
|
||||
mb->x = xvmc_mb->x;
|
||||
mb->y = xvmc_mb->y;
|
||||
mb->macroblock_type = xvmc_mb->macroblock_type;
|
||||
|
||||
switch (xvmc_picture_structure) {
|
||||
case XVMC_FRAME_PICTURE:
|
||||
mb->macroblock_modes.bits.frame_motion_type = xvmc_mb->motion_type;
|
||||
mb->macroblock_modes.bits.field_motion_type = 0;
|
||||
break;
|
||||
|
||||
case XVMC_TOP_FIELD:
|
||||
case XVMC_BOTTOM_FIELD:
|
||||
mb->macroblock_modes.bits.frame_motion_type = 0;
|
||||
mb->macroblock_modes.bits.field_motion_type = xvmc_mb->motion_type;
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
mb->macroblock_modes.bits.dct_type = xvmc_mb->dct_type;
|
||||
mb->motion_vertical_field_select = xvmc_mb->motion_vertical_field_select;
|
||||
|
||||
for (i = 0; i < 2; ++i)
|
||||
for (j = 0; j < 2; ++j)
|
||||
for (k = 0; k < 2; ++k)
|
||||
mb->PMV[i][j][k] = xvmc_mb->PMV[i][j][k];
|
||||
|
||||
mb->coded_block_pattern = xvmc_mb->coded_block_pattern;
|
||||
mb->blocks = xvmc_blocks->blocks + xvmc_mb->index * BLOCK_SIZE_SAMPLES;
|
||||
mb->num_skipped_macroblocks = 0;
|
||||
|
||||
++xvmc_mb;
|
||||
++mb;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
GetPictureDescription(XvMCSurfacePrivate *surface, struct pipe_mpeg12_picture_desc *desc)
|
||||
{
|
||||
unsigned i, num_refs = 0;
|
||||
|
||||
assert(surface && desc);
|
||||
|
||||
memset(desc, 0, sizeof(*desc));
|
||||
desc->base.profile = PIPE_VIDEO_PROFILE_MPEG1;
|
||||
desc->picture_structure = surface->picture_structure;
|
||||
for (i = 0; i < 2; ++i) {
|
||||
if (surface->ref[i]) {
|
||||
XvMCSurfacePrivate *ref = surface->ref[i]->privData;
|
||||
|
||||
if (ref)
|
||||
desc->ref[num_refs++] = ref->video_buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
RecursiveEndFrame(XvMCSurfacePrivate *surface)
|
||||
{
|
||||
XvMCContextPrivate *context_priv;
|
||||
unsigned i;
|
||||
|
||||
assert(surface);
|
||||
|
||||
context_priv = surface->context->privData;
|
||||
|
||||
for ( i = 0; i < 2; ++i ) {
|
||||
if (surface->ref[i]) {
|
||||
XvMCSurface *ref = surface->ref[i];
|
||||
|
||||
assert(ref);
|
||||
|
||||
surface->ref[i] = NULL;
|
||||
RecursiveEndFrame(ref->privData);
|
||||
surface->ref[i] = ref;
|
||||
}
|
||||
}
|
||||
|
||||
if (surface->picture_structure) {
|
||||
struct pipe_mpeg12_picture_desc desc;
|
||||
GetPictureDescription(surface, &desc);
|
||||
surface->picture_structure = 0;
|
||||
|
||||
for (i = 0; i < 2; ++i)
|
||||
surface->ref[i] = NULL;
|
||||
|
||||
context_priv->decoder->end_frame(context_priv->decoder, surface->video_buffer, &desc.base);
|
||||
}
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surface)
|
||||
{
|
||||
XvMCContextPrivate *context_priv;
|
||||
struct pipe_context *pipe;
|
||||
XvMCSurfacePrivate *surface_priv;
|
||||
struct pipe_video_buffer tmpl;
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Creating surface %p.\n", surface);
|
||||
|
||||
assert(dpy);
|
||||
|
||||
if (!context)
|
||||
return XvMCBadContext;
|
||||
if (!surface)
|
||||
return XvMCBadSurface;
|
||||
|
||||
context_priv = context->privData;
|
||||
pipe = context_priv->pipe;
|
||||
|
||||
surface_priv = CALLOC(1, sizeof(XvMCSurfacePrivate));
|
||||
if (!surface_priv)
|
||||
return BadAlloc;
|
||||
|
||||
memset(&tmpl, 0, sizeof(tmpl));
|
||||
tmpl.buffer_format = pipe->screen->get_video_param
|
||||
(
|
||||
pipe->screen,
|
||||
context_priv->decoder->profile,
|
||||
context_priv->decoder->entrypoint,
|
||||
PIPE_VIDEO_CAP_PREFERED_FORMAT
|
||||
);
|
||||
assert(pipe_format_to_chroma_format(tmpl.buffer_format) == context_priv->decoder->chroma_format);
|
||||
tmpl.width = context_priv->decoder->width;
|
||||
tmpl.height = context_priv->decoder->height;
|
||||
tmpl.interlaced = pipe->screen->get_video_param
|
||||
(
|
||||
pipe->screen,
|
||||
context_priv->decoder->profile,
|
||||
context_priv->decoder->entrypoint,
|
||||
PIPE_VIDEO_CAP_PREFERS_INTERLACED
|
||||
);
|
||||
|
||||
surface_priv->video_buffer = pipe->create_video_buffer(pipe, &tmpl);
|
||||
if (!surface_priv->video_buffer) {
|
||||
FREE(surface_priv);
|
||||
return BadAlloc;
|
||||
}
|
||||
surface_priv->context = context;
|
||||
|
||||
surface->surface_id = XAllocID(dpy);
|
||||
surface->context_id = context->context_id;
|
||||
surface->surface_type_id = context->surface_type_id;
|
||||
surface->width = context->width;
|
||||
surface->height = context->height;
|
||||
surface->privData = surface_priv;
|
||||
|
||||
SyncHandle();
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Surface %p created.\n", surface);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCRenderSurface(Display *dpy, 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 *macroblocks, XvMCBlockArray *blocks
|
||||
)
|
||||
{
|
||||
struct pipe_mpeg12_macroblock mb[num_macroblocks];
|
||||
struct pipe_video_codec *decoder;
|
||||
struct pipe_mpeg12_picture_desc desc;
|
||||
|
||||
XvMCContextPrivate *context_priv;
|
||||
XvMCSurfacePrivate *target_surface_priv;
|
||||
ASSERTED XvMCSurfacePrivate *past_surface_priv;
|
||||
ASSERTED XvMCSurfacePrivate *future_surface_priv;
|
||||
XvMCMacroBlock *xvmc_mb;
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Rendering to surface %p, with past %p and future %p\n",
|
||||
target_surface, past_surface, future_surface);
|
||||
|
||||
assert(dpy);
|
||||
|
||||
if (!context || !context->privData)
|
||||
return XvMCBadContext;
|
||||
if (!target_surface || !target_surface->privData)
|
||||
return XvMCBadSurface;
|
||||
|
||||
if (picture_structure != XVMC_TOP_FIELD &&
|
||||
picture_structure != XVMC_BOTTOM_FIELD &&
|
||||
picture_structure != XVMC_FRAME_PICTURE)
|
||||
return BadValue;
|
||||
/* Bkwd pred equivalent to fwd (past && !future) */
|
||||
if (future_surface && !past_surface)
|
||||
return BadMatch;
|
||||
|
||||
assert(context->context_id == target_surface->context_id);
|
||||
assert(!past_surface || context->context_id == past_surface->context_id);
|
||||
assert(!future_surface || context->context_id == future_surface->context_id);
|
||||
|
||||
assert(macroblocks);
|
||||
assert(blocks);
|
||||
|
||||
assert(macroblocks->context_id == context->context_id);
|
||||
assert(blocks->context_id == context->context_id);
|
||||
|
||||
assert(flags == 0 || flags == XVMC_SECOND_FIELD);
|
||||
|
||||
context_priv = context->privData;
|
||||
decoder = context_priv->decoder;
|
||||
|
||||
target_surface_priv = target_surface->privData;
|
||||
past_surface_priv = past_surface ? past_surface->privData : NULL;
|
||||
future_surface_priv = future_surface ? future_surface->privData : NULL;
|
||||
|
||||
assert(target_surface_priv->context == context);
|
||||
assert(!past_surface || past_surface_priv->context == context);
|
||||
assert(!future_surface || future_surface_priv->context == context);
|
||||
|
||||
// call end frame on all referenced frames
|
||||
if (past_surface)
|
||||
RecursiveEndFrame(past_surface->privData);
|
||||
|
||||
if (future_surface)
|
||||
RecursiveEndFrame(future_surface->privData);
|
||||
|
||||
xvmc_mb = macroblocks->macro_blocks + first_macroblock;
|
||||
|
||||
/* If the surface we're rendering hasn't changed the ref frames shouldn't change. */
|
||||
if (target_surface_priv->picture_structure > 0 && (
|
||||
target_surface_priv->picture_structure != picture_structure ||
|
||||
target_surface_priv->ref[0] != past_surface ||
|
||||
target_surface_priv->ref[1] != future_surface ||
|
||||
(xvmc_mb->x == 0 && xvmc_mb->y == 0))) {
|
||||
|
||||
// If they change anyway we must assume that the current frame is ended
|
||||
RecursiveEndFrame(target_surface_priv);
|
||||
}
|
||||
|
||||
target_surface_priv->ref[0] = past_surface;
|
||||
target_surface_priv->ref[1] = future_surface;
|
||||
|
||||
if (target_surface_priv->picture_structure)
|
||||
GetPictureDescription(target_surface_priv, &desc);
|
||||
else {
|
||||
target_surface_priv->picture_structure = picture_structure;
|
||||
GetPictureDescription(target_surface_priv, &desc);
|
||||
decoder->begin_frame(decoder, target_surface_priv->video_buffer, &desc.base);
|
||||
}
|
||||
|
||||
MacroBlocksToPipe(context_priv, target_surface_priv, picture_structure,
|
||||
xvmc_mb, blocks, mb, num_macroblocks);
|
||||
|
||||
context_priv->decoder->decode_macroblock(context_priv->decoder,
|
||||
target_surface_priv->video_buffer,
|
||||
&desc.base,
|
||||
&mb[0].base, num_macroblocks);
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for rendering.\n", target_surface);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCFlushSurface(Display *dpy, XvMCSurface *surface)
|
||||
{
|
||||
assert(dpy);
|
||||
|
||||
if (!surface)
|
||||
return XvMCBadSurface;
|
||||
|
||||
// don't call flush here, because this is usually
|
||||
// called once for every slice instead of every frame
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Flushing surface %p\n", surface);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCSyncSurface(Display *dpy, XvMCSurface *surface)
|
||||
{
|
||||
assert(dpy);
|
||||
|
||||
if (!surface)
|
||||
return XvMCBadSurface;
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Syncing surface %p\n", surface);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
|
||||
short srcx, short srcy, unsigned short srcw, unsigned short srch,
|
||||
short destx, short desty, unsigned short destw, unsigned short desth,
|
||||
int flags)
|
||||
{
|
||||
static int dump_window = -1;
|
||||
|
||||
struct pipe_context *pipe;
|
||||
struct vl_compositor *compositor;
|
||||
struct vl_compositor_state *cstate;
|
||||
struct vl_screen *vscreen;
|
||||
|
||||
XvMCSurfacePrivate *surface_priv;
|
||||
XvMCContextPrivate *context_priv;
|
||||
XvMCSubpicturePrivate *subpicture_priv;
|
||||
XvMCContext *context;
|
||||
struct u_rect src_rect = {srcx, srcx + srcw, srcy, srcy + srch};
|
||||
struct u_rect dst_rect = {destx, destx + destw, desty, desty + desth};
|
||||
|
||||
struct pipe_resource *tex;
|
||||
struct pipe_surface surf_templ, *surf;
|
||||
struct u_rect *dirty_area;
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Displaying surface %p.\n", surface);
|
||||
|
||||
assert(dpy);
|
||||
|
||||
if (!surface || !surface->privData)
|
||||
return XvMCBadSurface;
|
||||
|
||||
surface_priv = surface->privData;
|
||||
context = surface_priv->context;
|
||||
context_priv = context->privData;
|
||||
|
||||
assert(flags == XVMC_TOP_FIELD || flags == XVMC_BOTTOM_FIELD || flags == XVMC_FRAME_PICTURE);
|
||||
assert(srcx + srcw - 1 < surface->width);
|
||||
assert(srcy + srch - 1 < surface->height);
|
||||
|
||||
subpicture_priv = surface_priv->subpicture ? surface_priv->subpicture->privData : NULL;
|
||||
pipe = context_priv->pipe;
|
||||
compositor = &context_priv->compositor;
|
||||
cstate = &context_priv->cstate;
|
||||
vscreen = context_priv->vscreen;
|
||||
|
||||
tex = vscreen->texture_from_drawable(vscreen, (void *)drawable);
|
||||
dirty_area = vscreen->get_dirty_area(vscreen);
|
||||
|
||||
memset(&surf_templ, 0, sizeof(surf_templ));
|
||||
surf_templ.format = tex->format;
|
||||
surf = pipe->create_surface(pipe, tex, &surf_templ);
|
||||
|
||||
if (!surf)
|
||||
return BadDrawable;
|
||||
|
||||
/*
|
||||
* Some apps (mplayer) hit these asserts because they call
|
||||
* this function after the window has been resized by the WM
|
||||
* but before they've handled the corresponding XEvent and
|
||||
* know about the new dimensions. The output should be clipped
|
||||
* until the app updates destw and desth.
|
||||
*/
|
||||
/*
|
||||
assert(destx + destw - 1 < drawable_surface->width);
|
||||
assert(desty + desth - 1 < drawable_surface->height);
|
||||
*/
|
||||
|
||||
RecursiveEndFrame(surface_priv);
|
||||
|
||||
context_priv->decoder->flush(context_priv->decoder);
|
||||
|
||||
vl_compositor_clear_layers(cstate);
|
||||
vl_compositor_set_buffer_layer(cstate, compositor, 0, surface_priv->video_buffer,
|
||||
&src_rect, NULL, VL_COMPOSITOR_WEAVE);
|
||||
|
||||
if (subpicture_priv) {
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Surface %p has subpicture %p.\n", surface, surface_priv->subpicture);
|
||||
|
||||
assert(subpicture_priv->surface == surface);
|
||||
|
||||
if (subpicture_priv->palette)
|
||||
vl_compositor_set_palette_layer(cstate, compositor, 1, subpicture_priv->sampler, subpicture_priv->palette,
|
||||
&subpicture_priv->src_rect, &subpicture_priv->dst_rect, true);
|
||||
else
|
||||
vl_compositor_set_rgba_layer(cstate, compositor, 1, subpicture_priv->sampler,
|
||||
&subpicture_priv->src_rect, &subpicture_priv->dst_rect, NULL);
|
||||
|
||||
surface_priv->subpicture = NULL;
|
||||
subpicture_priv->surface = NULL;
|
||||
}
|
||||
|
||||
// Workaround for r600g, there seems to be a bug in the fence refcounting code
|
||||
pipe->screen->fence_reference(pipe->screen, &surface_priv->fence, NULL);
|
||||
|
||||
vl_compositor_set_layer_dst_area(cstate, 0, &dst_rect);
|
||||
vl_compositor_set_layer_dst_area(cstate, 1, &dst_rect);
|
||||
vl_compositor_render(cstate, compositor, surf, dirty_area, true);
|
||||
|
||||
pipe->flush(pipe, &surface_priv->fence, 0);
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for display. Pushing to front buffer.\n", surface);
|
||||
|
||||
pipe->screen->flush_frontbuffer(pipe->screen, pipe, tex, 0, 0,
|
||||
vscreen->get_private(vscreen), NULL);
|
||||
|
||||
if(dump_window == -1) {
|
||||
dump_window = debug_get_num_option("XVMC_DUMP", 0);
|
||||
}
|
||||
|
||||
if(dump_window) {
|
||||
static unsigned int framenum = 0;
|
||||
char cmd[256];
|
||||
|
||||
sprintf(cmd, "xwd -id %d -out xvmc_frame_%08d.xwd", (int)drawable, ++framenum);
|
||||
if (system(cmd) != 0)
|
||||
XVMC_MSG(XVMC_ERR, "[XvMC] Dumping surface %p failed.\n", surface);
|
||||
}
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Pushed surface %p to front buffer.\n", surface);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCGetSurfaceStatus(Display *dpy, XvMCSurface *surface, int *status)
|
||||
{
|
||||
struct pipe_context *pipe;
|
||||
XvMCSurfacePrivate *surface_priv;
|
||||
XvMCContextPrivate *context_priv;
|
||||
|
||||
assert(dpy);
|
||||
|
||||
if (!surface)
|
||||
return XvMCBadSurface;
|
||||
|
||||
assert(status);
|
||||
|
||||
surface_priv = surface->privData;
|
||||
context_priv = surface_priv->context->privData;
|
||||
pipe = context_priv->pipe;
|
||||
|
||||
*status = 0;
|
||||
|
||||
if (surface_priv->fence)
|
||||
if (!pipe->screen->fence_finish(pipe->screen, NULL, surface_priv->fence, 0))
|
||||
*status |= XVMC_RENDERING;
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCDestroySurface(Display *dpy, XvMCSurface *surface)
|
||||
{
|
||||
XvMCSurfacePrivate *surface_priv;
|
||||
XvMCContextPrivate *context_priv;
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Destroying surface %p.\n", surface);
|
||||
|
||||
assert(dpy);
|
||||
|
||||
if (!surface || !surface->privData)
|
||||
return XvMCBadSurface;
|
||||
|
||||
surface_priv = surface->privData;
|
||||
context_priv = surface_priv->context->privData;
|
||||
|
||||
if (surface_priv->picture_structure) {
|
||||
struct pipe_mpeg12_picture_desc desc;
|
||||
GetPictureDescription(surface_priv, &desc);
|
||||
context_priv->decoder->end_frame(context_priv->decoder, surface_priv->video_buffer, &desc.base);
|
||||
}
|
||||
surface_priv->video_buffer->destroy(surface_priv->video_buffer);
|
||||
FREE(surface_priv);
|
||||
surface->privData = NULL;
|
||||
|
||||
XVMC_MSG(XVMC_TRACE, "[XvMC] Surface %p destroyed.\n", surface);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PUBLIC
|
||||
Status XvMCHideSurface(Display *dpy, XvMCSurface *surface)
|
||||
{
|
||||
assert(dpy);
|
||||
|
||||
if (!surface || !surface->privData)
|
||||
return XvMCBadSurface;
|
||||
|
||||
/* No op, only for overlaid rendering */
|
||||
|
||||
return Success;
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 Younes Manton.
|
||||
* 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 VMWARE 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* Force assertions, even on release builds. */
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "testlib.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const unsigned int width = 16, height = 16;
|
||||
const unsigned int min_required_blocks = 1, min_required_macroblocks = 1;
|
||||
const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2};
|
||||
|
||||
Display *display;
|
||||
XvPortID port_num;
|
||||
int surface_type_id;
|
||||
unsigned int is_overlay, intra_unsigned;
|
||||
int colorkey;
|
||||
XvMCContext context;
|
||||
XvMCSurface surface;
|
||||
XvMCBlockArray blocks = {0};
|
||||
XvMCMacroBlockArray macroblocks = {0};
|
||||
|
||||
display = XOpenDisplay(NULL);
|
||||
|
||||
if (!GetPort
|
||||
(
|
||||
display,
|
||||
width,
|
||||
height,
|
||||
XVMC_CHROMA_FORMAT_420,
|
||||
mc_types,
|
||||
2,
|
||||
&port_num,
|
||||
&surface_type_id,
|
||||
&is_overlay,
|
||||
&intra_unsigned
|
||||
))
|
||||
{
|
||||
XCloseDisplay(display);
|
||||
fprintf(stderr, "Error, unable to find a good port.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (is_overlay)
|
||||
{
|
||||
Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0);
|
||||
XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey);
|
||||
}
|
||||
|
||||
assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, &context) == Success);
|
||||
assert(XvMCCreateSurface(display, &context, &surface) == Success);
|
||||
|
||||
/* Test NULL context */
|
||||
assert(XvMCCreateBlocks(display, NULL, 1, &blocks) == XvMCBadContext);
|
||||
/* Test 0 blocks */
|
||||
assert(XvMCCreateBlocks(display, &context, 0, &blocks) == BadValue);
|
||||
/* Test valid params */
|
||||
assert(XvMCCreateBlocks(display, &context, min_required_blocks, &blocks) == Success);
|
||||
/* Test context id assigned and correct */
|
||||
assert(blocks.context_id == context.context_id);
|
||||
/* Test number of blocks assigned and correct */
|
||||
assert(blocks.num_blocks == min_required_blocks);
|
||||
/* Test block pointer valid */
|
||||
assert(blocks.blocks != NULL);
|
||||
/* Test NULL context */
|
||||
assert(XvMCCreateMacroBlocks(display, NULL, 1, ¯oblocks) == XvMCBadContext);
|
||||
/* Test 0 macroblocks */
|
||||
assert(XvMCCreateMacroBlocks(display, &context, 0, ¯oblocks) == BadValue);
|
||||
/* Test valid params */
|
||||
assert(XvMCCreateMacroBlocks(display, &context, min_required_macroblocks, ¯oblocks) == Success);
|
||||
/* Test context id assigned and correct */
|
||||
assert(macroblocks.context_id == context.context_id);
|
||||
/* Test macroblock pointer valid */
|
||||
assert(macroblocks.macro_blocks != NULL);
|
||||
/* Test valid params */
|
||||
assert(XvMCDestroyMacroBlocks(display, ¯oblocks) == Success);
|
||||
/* Test valid params */
|
||||
assert(XvMCDestroyBlocks(display, &blocks) == Success);
|
||||
|
||||
assert(XvMCDestroySurface(display, &surface) == Success);
|
||||
assert(XvMCDestroyContext(display, &context) == Success);
|
||||
|
||||
XvUngrabPort(display, port_num, CurrentTime);
|
||||
XCloseDisplay(display);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 Younes Manton.
|
||||
* 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 VMWARE 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* Force assertions, even on release builds. */
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "testlib.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const unsigned int width = 16, height = 16;
|
||||
const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2};
|
||||
|
||||
Display *display;
|
||||
XvPortID port_num;
|
||||
int surface_type_id;
|
||||
unsigned int is_overlay, intra_unsigned;
|
||||
int colorkey;
|
||||
XvMCContext context = {0};
|
||||
|
||||
display = XOpenDisplay(NULL);
|
||||
|
||||
if (!GetPort
|
||||
(
|
||||
display,
|
||||
width,
|
||||
height,
|
||||
XVMC_CHROMA_FORMAT_420,
|
||||
mc_types,
|
||||
2,
|
||||
&port_num,
|
||||
&surface_type_id,
|
||||
&is_overlay,
|
||||
&intra_unsigned
|
||||
))
|
||||
{
|
||||
XCloseDisplay(display);
|
||||
fprintf(stderr, "Error, unable to find a good port.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (is_overlay)
|
||||
{
|
||||
Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0);
|
||||
XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey);
|
||||
}
|
||||
|
||||
/* Test NULL context */
|
||||
/* XXX: XvMCBadContext not a valid return for XvMCCreateContext in the XvMC API, but openChrome driver returns it */
|
||||
assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, NULL) == XvMCBadContext);
|
||||
/* Test invalid port */
|
||||
/* XXX: Success and XvBadPort have the same value, if this call actually gets passed the validation step as of now we'll crash later */
|
||||
assert(XvMCCreateContext(display, -1, surface_type_id, width, height, XVMC_DIRECT, &context) == XvBadPort);
|
||||
/* Test invalid surface */
|
||||
assert(XvMCCreateContext(display, port_num, -1, width, height, XVMC_DIRECT, &context) == BadMatch);
|
||||
/* Test invalid flags */
|
||||
assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, -1, &context) == BadValue);
|
||||
/* Test huge width */
|
||||
assert(XvMCCreateContext(display, port_num, surface_type_id, 16384, height, XVMC_DIRECT, &context) == BadValue);
|
||||
/* Test huge height */
|
||||
assert(XvMCCreateContext(display, port_num, surface_type_id, width, 16384, XVMC_DIRECT, &context) == BadValue);
|
||||
/* Test huge width & height */
|
||||
assert(XvMCCreateContext(display, port_num, surface_type_id, 16384, 16384, XVMC_DIRECT, &context) == BadValue);
|
||||
/* Test valid params */
|
||||
assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, &context) == Success);
|
||||
/* Test context id assigned */
|
||||
assert(context.context_id != 0);
|
||||
/* Test surface type id assigned and correct */
|
||||
assert(context.surface_type_id == surface_type_id);
|
||||
/* Test width & height assigned and correct */
|
||||
assert(context.width == width && context.height == height);
|
||||
/* Test port assigned and correct */
|
||||
assert(context.port == port_num);
|
||||
/* Test flags assigned and correct */
|
||||
assert(context.flags == XVMC_DIRECT);
|
||||
/* Test NULL context */
|
||||
assert(XvMCDestroyContext(display, NULL) == XvMCBadContext);
|
||||
/* Test valid params */
|
||||
assert(XvMCDestroyContext(display, &context) == Success);
|
||||
/* Test awkward but valid width */
|
||||
assert(XvMCCreateContext(display, port_num, surface_type_id, width + 1, height, XVMC_DIRECT, &context) == Success);
|
||||
assert(context.width >= width + 1);
|
||||
assert(XvMCDestroyContext(display, &context) == Success);
|
||||
/* Test awkward but valid height */
|
||||
assert(XvMCCreateContext(display, port_num, surface_type_id, width, height + 1, XVMC_DIRECT, &context) == Success);
|
||||
assert(context.height >= height + 1);
|
||||
assert(XvMCDestroyContext(display, &context) == Success);
|
||||
/* Test awkward but valid width & height */
|
||||
assert(XvMCCreateContext(display, port_num, surface_type_id, width + 1, height + 1, XVMC_DIRECT, &context) == Success);
|
||||
assert(context.width >= width + 1 && context.height >= height + 1);
|
||||
assert(XvMCDestroyContext(display, &context) == Success);
|
||||
|
||||
XvUngrabPort(display, port_num, CurrentTime);
|
||||
XCloseDisplay(display);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,330 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 Younes Manton.
|
||||
* 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 VMWARE 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* Force assertions, even on release builds. */
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "testlib.h"
|
||||
|
||||
#define BLOCK_WIDTH 8
|
||||
#define BLOCK_HEIGHT 8
|
||||
#define BLOCK_SIZE (BLOCK_WIDTH * BLOCK_HEIGHT)
|
||||
#define MACROBLOCK_WIDTH 16
|
||||
#define MACROBLOCK_HEIGHT 16
|
||||
#define MACROBLOCK_WIDTH_IN_BLOCKS (MACROBLOCK_WIDTH / BLOCK_WIDTH)
|
||||
#define MACROBLOCK_HEIGHT_IN_BLOCKS (MACROBLOCK_HEIGHT / BLOCK_HEIGHT)
|
||||
#define BLOCKS_PER_MACROBLOCK 6
|
||||
|
||||
#define INPUT_WIDTH 64
|
||||
#define INPUT_HEIGHT 64
|
||||
#define INPUT_WIDTH_IN_MACROBLOCKS (INPUT_WIDTH / MACROBLOCK_WIDTH)
|
||||
#define INPUT_HEIGHT_IN_MACROBLOCKS (INPUT_HEIGHT / MACROBLOCK_HEIGHT)
|
||||
#define NUM_MACROBLOCKS (INPUT_WIDTH_IN_MACROBLOCKS * INPUT_HEIGHT_IN_MACROBLOCKS)
|
||||
|
||||
#define DEFAULT_OUTPUT_WIDTH INPUT_WIDTH
|
||||
#define DEFAULT_OUTPUT_HEIGHT INPUT_HEIGHT
|
||||
#define DEFAULT_ACCEPTABLE_ERR 0.01
|
||||
|
||||
static void ParseArgs(int argc, char **argv, unsigned int *output_width, unsigned int *output_height, double *acceptable_error, int *prompt)
|
||||
{
|
||||
int fail = 0;
|
||||
int i;
|
||||
|
||||
*output_width = DEFAULT_OUTPUT_WIDTH;
|
||||
*output_height = DEFAULT_OUTPUT_HEIGHT;
|
||||
*acceptable_error = DEFAULT_ACCEPTABLE_ERR;
|
||||
*prompt = 0;
|
||||
|
||||
for (i = 1; i < argc && !fail; ++i)
|
||||
{
|
||||
if (!strcmp(argv[i], "-w"))
|
||||
{
|
||||
if (sscanf(argv[++i], "%u", output_width) != 1)
|
||||
fail = 1;
|
||||
}
|
||||
else if (!strcmp(argv[i], "-h"))
|
||||
{
|
||||
if (sscanf(argv[++i], "%u", output_height) != 1)
|
||||
fail = 1;
|
||||
}
|
||||
else if (!strcmp(argv[i], "-e"))
|
||||
{
|
||||
if (sscanf(argv[++i], "%lf", acceptable_error) != 1)
|
||||
fail = 1;
|
||||
}
|
||||
else if (!strcmp(argv[i], "-p"))
|
||||
*prompt = 1;
|
||||
else
|
||||
fail = 1;
|
||||
}
|
||||
|
||||
if (fail)
|
||||
{
|
||||
fprintf(
|
||||
stderr,
|
||||
"Bad argument.\n"
|
||||
"\n"
|
||||
"Usage: %s [options]\n"
|
||||
"\t-w <width>\tOutput width\n"
|
||||
"\t-h <height>\tOutput height\n"
|
||||
"\t-e <error>\tAcceptable margin of error per pixel, from 0 to 1\n"
|
||||
"\t-p\tPrompt for quit\n",
|
||||
argv[0]
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static void Gradient(short *block, unsigned int start, unsigned int stop, int horizontal, unsigned int intra_unsigned)
|
||||
{
|
||||
unsigned int x, y;
|
||||
unsigned int range = stop - start;
|
||||
|
||||
if (horizontal)
|
||||
{
|
||||
for (y = 0; y < BLOCK_HEIGHT; ++y)
|
||||
for (x = 0; x < BLOCK_WIDTH; ++x) {
|
||||
*block = (short)(start + range * (x / (float)(BLOCK_WIDTH - 1)));
|
||||
if (intra_unsigned)
|
||||
*block += 1 << 10;
|
||||
block++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (y = 0; y < BLOCK_HEIGHT; ++y)
|
||||
for (x = 0; x < BLOCK_WIDTH; ++x) {
|
||||
*block = (short)(start + range * (y / (float)(BLOCK_WIDTH - 1)));
|
||||
if (intra_unsigned)
|
||||
*block += 1 << 10;
|
||||
block++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
unsigned int output_width;
|
||||
unsigned int output_height;
|
||||
double acceptable_error;
|
||||
int prompt;
|
||||
Display *display;
|
||||
Window root, window;
|
||||
const unsigned int mc_types[] = {XVMC_MOCOMP | XVMC_MPEG_2};
|
||||
XvPortID port_num;
|
||||
int surface_type_id;
|
||||
unsigned int is_overlay, intra_unsigned;
|
||||
int colorkey;
|
||||
XvMCContext context;
|
||||
XvMCSurface surface;
|
||||
XvMCBlockArray block_array;
|
||||
XvMCMacroBlockArray mb_array;
|
||||
int mbx, mby, bx, by;
|
||||
XvMCMacroBlock *mb;
|
||||
short *blocks;
|
||||
int quit = 0;
|
||||
|
||||
ParseArgs(argc, argv, &output_width, &output_height, &acceptable_error, &prompt);
|
||||
|
||||
display = XOpenDisplay(NULL);
|
||||
|
||||
if (!GetPort
|
||||
(
|
||||
display,
|
||||
INPUT_WIDTH,
|
||||
INPUT_HEIGHT,
|
||||
XVMC_CHROMA_FORMAT_420,
|
||||
mc_types,
|
||||
sizeof(mc_types)/sizeof(*mc_types),
|
||||
&port_num,
|
||||
&surface_type_id,
|
||||
&is_overlay,
|
||||
&intra_unsigned
|
||||
))
|
||||
{
|
||||
XCloseDisplay(display);
|
||||
fprintf(stderr, "Error, unable to find a good port.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (is_overlay)
|
||||
{
|
||||
Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0);
|
||||
XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey);
|
||||
}
|
||||
|
||||
root = XDefaultRootWindow(display);
|
||||
window = XCreateSimpleWindow(display, root, 0, 0, output_width, output_height, 0, 0, colorkey);
|
||||
|
||||
assert(XvMCCreateContext(display, port_num, surface_type_id, INPUT_WIDTH, INPUT_HEIGHT, XVMC_DIRECT, &context) == Success);
|
||||
assert(XvMCCreateSurface(display, &context, &surface) == Success);
|
||||
assert(XvMCCreateBlocks(display, &context, NUM_MACROBLOCKS * BLOCKS_PER_MACROBLOCK, &block_array) == Success);
|
||||
assert(XvMCCreateMacroBlocks(display, &context, NUM_MACROBLOCKS, &mb_array) == Success);
|
||||
|
||||
mb = mb_array.macro_blocks;
|
||||
blocks = block_array.blocks;
|
||||
|
||||
for (mby = 0; mby < INPUT_HEIGHT_IN_MACROBLOCKS; ++mby)
|
||||
for (mbx = 0; mbx < INPUT_WIDTH_IN_MACROBLOCKS; ++mbx)
|
||||
{
|
||||
mb->x = mbx;
|
||||
mb->y = mby;
|
||||
mb->macroblock_type = XVMC_MB_TYPE_INTRA;
|
||||
/*mb->motion_type = ;*/
|
||||
/*mb->motion_vertical_field_select = ;*/
|
||||
mb->dct_type = XVMC_DCT_TYPE_FRAME;
|
||||
/*mb->PMV[0][0][0] = ;
|
||||
mb->PMV[0][0][1] = ;
|
||||
mb->PMV[0][1][0] = ;
|
||||
mb->PMV[0][1][1] = ;
|
||||
mb->PMV[1][0][0] = ;
|
||||
mb->PMV[1][0][1] = ;
|
||||
mb->PMV[1][1][0] = ;
|
||||
mb->PMV[1][1][1] = ;*/
|
||||
mb->index = (mby * INPUT_WIDTH_IN_MACROBLOCKS + mbx) * BLOCKS_PER_MACROBLOCK;
|
||||
mb->coded_block_pattern = 0x3F;
|
||||
|
||||
mb++;
|
||||
|
||||
for (by = 0; by < MACROBLOCK_HEIGHT_IN_BLOCKS; ++by)
|
||||
for (bx = 0; bx < MACROBLOCK_WIDTH_IN_BLOCKS; ++bx)
|
||||
{
|
||||
const int start = 16, stop = 235, range = stop - start;
|
||||
|
||||
Gradient
|
||||
(
|
||||
blocks,
|
||||
(short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH) / (float)(INPUT_WIDTH - 1))),
|
||||
(short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH + BLOCK_WIDTH - 1) / (float)(INPUT_WIDTH - 1))),
|
||||
1,
|
||||
intra_unsigned
|
||||
);
|
||||
|
||||
blocks += BLOCK_SIZE;
|
||||
}
|
||||
|
||||
for (by = 0; by < MACROBLOCK_HEIGHT_IN_BLOCKS / 2; ++by)
|
||||
for (bx = 0; bx < MACROBLOCK_WIDTH_IN_BLOCKS / 2; ++bx)
|
||||
{
|
||||
const int start = 16, stop = 240, range = stop - start;
|
||||
|
||||
Gradient
|
||||
(
|
||||
blocks,
|
||||
(short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH) / (float)(INPUT_WIDTH - 1))),
|
||||
(short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH + BLOCK_WIDTH - 1) / (float)(INPUT_WIDTH - 1))),
|
||||
1,
|
||||
intra_unsigned
|
||||
);
|
||||
|
||||
blocks += BLOCK_SIZE;
|
||||
|
||||
Gradient
|
||||
(
|
||||
blocks,
|
||||
(short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH) / (float)(INPUT_WIDTH - 1))),
|
||||
(short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH + BLOCK_WIDTH - 1) / (float)(INPUT_WIDTH - 1))),
|
||||
1,
|
||||
intra_unsigned
|
||||
);
|
||||
|
||||
blocks += BLOCK_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
XSelectInput(display, window, ExposureMask | KeyPressMask);
|
||||
XMapWindow(display, window);
|
||||
XSync(display, 0);
|
||||
|
||||
/* Test NULL context */
|
||||
assert(XvMCRenderSurface(display, NULL, XVMC_FRAME_PICTURE, &surface, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == XvMCBadContext);
|
||||
/* Test NULL surface */
|
||||
assert(XvMCRenderSurface(display, &context, XVMC_FRAME_PICTURE, NULL, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == XvMCBadSurface);
|
||||
/* Test bad picture structure */
|
||||
assert(XvMCRenderSurface(display, &context, 0, &surface, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == BadValue);
|
||||
/* Test valid params */
|
||||
assert(XvMCRenderSurface(display, &context, XVMC_FRAME_PICTURE, &surface, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == Success);
|
||||
|
||||
/* Test NULL surface */
|
||||
assert(XvMCPutSurface(display, NULL, window, 0, 0, INPUT_WIDTH, INPUT_HEIGHT, 0, 0, output_width, output_height, XVMC_FRAME_PICTURE) == XvMCBadSurface);
|
||||
/* Test bad window */
|
||||
/* XXX: X halts with a bad drawable for some reason, doesn't return BadDrawable as expected */
|
||||
/*assert(XvMCPutSurface(display, &surface, 0, 0, 0, width, height, 0, 0, width, height, XVMC_FRAME_PICTURE) == BadDrawable);*/
|
||||
|
||||
if (prompt)
|
||||
{
|
||||
puts("Press any button to quit...");
|
||||
|
||||
while (!quit)
|
||||
{
|
||||
if (XPending(display) > 0)
|
||||
{
|
||||
XEvent event;
|
||||
|
||||
XNextEvent(display, &event);
|
||||
|
||||
switch (event.type)
|
||||
{
|
||||
case Expose:
|
||||
{
|
||||
/* Test valid params */
|
||||
assert
|
||||
(
|
||||
XvMCPutSurface
|
||||
(
|
||||
display, &surface, window,
|
||||
0, 0, INPUT_WIDTH, INPUT_HEIGHT,
|
||||
0, 0, output_width, output_height,
|
||||
XVMC_FRAME_PICTURE
|
||||
) == Success
|
||||
);
|
||||
break;
|
||||
}
|
||||
case KeyPress:
|
||||
{
|
||||
quit = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert(XvMCDestroyBlocks(display, &block_array) == Success);
|
||||
assert(XvMCDestroyMacroBlocks(display, &mb_array) == Success);
|
||||
assert(XvMCDestroySurface(display, &surface) == Success);
|
||||
assert(XvMCDestroyContext(display, &context) == Success);
|
||||
|
||||
XvUngrabPort(display, port_num, CurrentTime);
|
||||
XDestroyWindow(display, window);
|
||||
XCloseDisplay(display);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,189 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 Younes Manton.
|
||||
* 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 VMWARE 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* Force assertions, even on release builds. */
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "testlib.h"
|
||||
|
||||
static void PrintGUID(const char *guid)
|
||||
{
|
||||
int i;
|
||||
printf("\tguid: ");
|
||||
for (i = 0; i < 4; ++i)
|
||||
printf("%c,", guid[i] == 0 ? '0' : guid[i]);
|
||||
for (; i < 15; ++i)
|
||||
printf("%x,", (unsigned char)guid[i]);
|
||||
printf("%x\n", (unsigned int)guid[15]);
|
||||
}
|
||||
|
||||
static void PrintComponentOrder(const char *co)
|
||||
{
|
||||
int i;
|
||||
printf("\tcomponent_order:\n\t ");
|
||||
for (i = 0; i < 4; ++i)
|
||||
printf("%c,", co[i] == 0 ? '0' : co[i]);
|
||||
for (; i < 31; ++i)
|
||||
printf("%x,", (unsigned int)co[i]);
|
||||
printf("%x\n", (unsigned int)co[31]);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const unsigned int width = 16, height = 16;
|
||||
const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2};
|
||||
const unsigned int subpic_width = 16, subpic_height = 16;
|
||||
|
||||
Display *display;
|
||||
XvPortID port_num;
|
||||
int surface_type_id;
|
||||
unsigned int is_overlay, intra_unsigned;
|
||||
int colorkey;
|
||||
XvMCContext context;
|
||||
XvImageFormatValues *subpics;
|
||||
int num_subpics;
|
||||
XvMCSubpicture subpicture = {0};
|
||||
int i;
|
||||
|
||||
display = XOpenDisplay(NULL);
|
||||
|
||||
if (!GetPort
|
||||
(
|
||||
display,
|
||||
width,
|
||||
height,
|
||||
XVMC_CHROMA_FORMAT_420,
|
||||
mc_types,
|
||||
2,
|
||||
&port_num,
|
||||
&surface_type_id,
|
||||
&is_overlay,
|
||||
&intra_unsigned
|
||||
))
|
||||
{
|
||||
XCloseDisplay(display);
|
||||
fprintf(stderr, "Error, unable to find a good port.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (is_overlay)
|
||||
{
|
||||
Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0);
|
||||
XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey);
|
||||
}
|
||||
|
||||
assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, &context) == Success);
|
||||
|
||||
subpics = XvMCListSubpictureTypes(display, port_num, surface_type_id, &num_subpics);
|
||||
assert((subpics && num_subpics) > 0 || (!subpics && num_subpics == 0));
|
||||
|
||||
for (i = 0; i < num_subpics; ++i)
|
||||
{
|
||||
printf("Subpicture %d:\n", i);
|
||||
printf("\tid: 0x%08x\n", subpics[i].id);
|
||||
printf("\ttype: %s\n", subpics[i].type == XvRGB ? "XvRGB" : (subpics[i].type == XvYUV ? "XvYUV" : "Unknown"));
|
||||
printf("\tbyte_order: %s\n", subpics[i].byte_order == LSBFirst ? "LSB First" : (subpics[i].byte_order == MSBFirst ? "MSB First" : "Unknown"));
|
||||
PrintGUID(subpics[i].guid);
|
||||
printf("\tbpp: %u\n", subpics[i].bits_per_pixel);
|
||||
printf("\tformat: %s\n", subpics[i].format == XvPacked ? "XvPacked" : (subpics[i].format == XvPlanar ? "XvPlanar" : "Unknown"));
|
||||
printf("\tnum_planes: %u\n", subpics[i].num_planes);
|
||||
|
||||
if (subpics[i].type == XvRGB)
|
||||
{
|
||||
printf("\tdepth: %u\n", subpics[i].depth);
|
||||
printf("\tred_mask: 0x%08x\n", subpics[i].red_mask);
|
||||
printf("\tgreen_mask: 0x%08x\n", subpics[i].green_mask);
|
||||
printf("\tblue_mask: 0x%08x\n", subpics[i].blue_mask);
|
||||
}
|
||||
else if (subpics[i].type == XvYUV)
|
||||
{
|
||||
printf("\ty_sample_bits: %u\n", subpics[i].y_sample_bits);
|
||||
printf("\tu_sample_bits: %u\n", subpics[i].u_sample_bits);
|
||||
printf("\tv_sample_bits: %u\n", subpics[i].v_sample_bits);
|
||||
printf("\thorz_y_period: %u\n", subpics[i].horz_y_period);
|
||||
printf("\thorz_u_period: %u\n", subpics[i].horz_u_period);
|
||||
printf("\thorz_v_period: %u\n", subpics[i].horz_v_period);
|
||||
printf("\tvert_y_period: %u\n", subpics[i].vert_y_period);
|
||||
printf("\tvert_u_period: %u\n", subpics[i].vert_u_period);
|
||||
printf("\tvert_v_period: %u\n", subpics[i].vert_v_period);
|
||||
}
|
||||
PrintComponentOrder(subpics[i].component_order);
|
||||
printf("\tscanline_order: %s\n", subpics[i].scanline_order == XvTopToBottom ? "XvTopToBottom" : (subpics[i].scanline_order == XvBottomToTop ? "XvBottomToTop" : "Unknown"));
|
||||
}
|
||||
|
||||
if (num_subpics == 0)
|
||||
{
|
||||
printf("Subpictures not supported, nothing to test.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Test NULL context */
|
||||
assert(XvMCCreateSubpicture(display, NULL, &subpicture, subpic_width, subpic_height, subpics[0].id) == XvMCBadContext);
|
||||
/* Test NULL subpicture */
|
||||
assert(XvMCCreateSubpicture(display, &context, NULL, subpic_width, subpic_height, subpics[0].id) == XvMCBadSubpicture);
|
||||
/* Test invalid subpicture */
|
||||
assert(XvMCCreateSubpicture(display, &context, &subpicture, subpic_width, subpic_height, -1) == BadMatch);
|
||||
/* Test huge width */
|
||||
assert(XvMCCreateSubpicture(display, &context, &subpicture, 16384, subpic_height, subpics[0].id) == BadValue);
|
||||
/* Test huge height */
|
||||
assert(XvMCCreateSubpicture(display, &context, &subpicture, subpic_width, 16384, subpics[0].id) == BadValue);
|
||||
/* Test huge width & height */
|
||||
assert(XvMCCreateSubpicture(display, &context, &subpicture, 16384, 16384, subpics[0].id) == BadValue);
|
||||
for (i = 0; i < num_subpics; ++i)
|
||||
{
|
||||
/* Test valid params */
|
||||
assert(XvMCCreateSubpicture(display, &context, &subpicture, subpic_width, subpic_height, subpics[i].id) == Success);
|
||||
/* Test subpicture id assigned */
|
||||
assert(subpicture.subpicture_id != 0);
|
||||
/* Test context id assigned and correct */
|
||||
assert(subpicture.context_id == context.context_id);
|
||||
/* Test subpicture type id assigned and correct */
|
||||
assert(subpicture.xvimage_id == subpics[i].id);
|
||||
/* Test width & height assigned and correct */
|
||||
assert(subpicture.width == width && subpicture.height == height);
|
||||
if (subpics[i].type == XvRGB)
|
||||
/* Test no palette support */
|
||||
assert(subpicture.num_palette_entries == 0 && subpicture.entry_bytes == 0);
|
||||
else
|
||||
/* Test palette support */
|
||||
assert(subpicture.num_palette_entries == 16 && subpicture.entry_bytes == 4);
|
||||
/* Test valid params */
|
||||
assert(XvMCDestroySubpicture(display, &subpicture) == Success);
|
||||
}
|
||||
/* Test NULL surface */
|
||||
assert(XvMCDestroySubpicture(display, NULL) == XvMCBadSubpicture);
|
||||
|
||||
assert(XvMCDestroyContext(display, &context) == Success);
|
||||
|
||||
free(subpics);
|
||||
XvUngrabPort(display, port_num, CurrentTime);
|
||||
XCloseDisplay(display);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 Younes Manton.
|
||||
* 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 VMWARE 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* Force assertions, even on release builds. */
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "testlib.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const unsigned int width = 16, height = 16;
|
||||
const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2};
|
||||
|
||||
Display *display;
|
||||
XvPortID port_num;
|
||||
int surface_type_id;
|
||||
unsigned int is_overlay, intra_unsigned;
|
||||
int colorkey;
|
||||
XvMCContext context;
|
||||
XvMCSurface surface = {0};
|
||||
|
||||
display = XOpenDisplay(NULL);
|
||||
|
||||
if (!GetPort
|
||||
(
|
||||
display,
|
||||
width,
|
||||
height,
|
||||
XVMC_CHROMA_FORMAT_420,
|
||||
mc_types,
|
||||
2,
|
||||
&port_num,
|
||||
&surface_type_id,
|
||||
&is_overlay,
|
||||
&intra_unsigned
|
||||
))
|
||||
{
|
||||
XCloseDisplay(display);
|
||||
fprintf(stderr, "Error, unable to find a good port.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (is_overlay)
|
||||
{
|
||||
Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0);
|
||||
XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey);
|
||||
}
|
||||
|
||||
assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, &context) == Success);
|
||||
|
||||
/* Test NULL context */
|
||||
assert(XvMCCreateSurface(display, NULL, &surface) == XvMCBadContext);
|
||||
/* Test NULL surface */
|
||||
assert(XvMCCreateSurface(display, &context, NULL) == XvMCBadSurface);
|
||||
/* Test valid params */
|
||||
assert(XvMCCreateSurface(display, &context, &surface) == Success);
|
||||
/* Test surface id assigned */
|
||||
assert(surface.surface_id != 0);
|
||||
/* Test context id assigned and correct */
|
||||
assert(surface.context_id == context.context_id);
|
||||
/* Test surface type id assigned and correct */
|
||||
assert(surface.surface_type_id == surface_type_id);
|
||||
/* Test width & height assigned and correct */
|
||||
assert(surface.width == width && surface.height == height);
|
||||
/* Test valid params */
|
||||
assert(XvMCDestroySurface(display, &surface) == Success);
|
||||
/* Test NULL surface */
|
||||
assert(XvMCDestroySurface(display, NULL) == XvMCBadSurface);
|
||||
|
||||
assert(XvMCDestroyContext(display, &context) == Success);
|
||||
|
||||
XvUngrabPort(display, port_num, CurrentTime);
|
||||
XCloseDisplay(display);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,147 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 Younes Manton.
|
||||
* 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 VMWARE 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 "testlib.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
void test(int pred, const char *pred_string, const char *doc_string, const char *file, unsigned int line)
|
||||
{
|
||||
fputs(doc_string, stderr);
|
||||
if (!pred)
|
||||
fprintf(stderr, " FAIL!\n\t\"%s\" at %s:%u\n", pred_string, file, line);
|
||||
else
|
||||
fputs(" PASS!\n", stderr);
|
||||
}
|
||||
*/
|
||||
|
||||
int GetPort
|
||||
(
|
||||
Display *display,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
unsigned int chroma_format,
|
||||
const unsigned int *mc_types,
|
||||
unsigned int num_mc_types,
|
||||
XvPortID *port_id,
|
||||
int *surface_type_id,
|
||||
unsigned int *is_overlay,
|
||||
unsigned int *intra_unsigned
|
||||
)
|
||||
{
|
||||
unsigned int found_port = 0;
|
||||
XvAdaptorInfo *adaptor_info;
|
||||
unsigned int num_adaptors;
|
||||
int num_types;
|
||||
int ev_base, err_base;
|
||||
unsigned int i, j, k, l;
|
||||
|
||||
if (!XvMCQueryExtension(display, &ev_base, &err_base))
|
||||
return 0;
|
||||
if (XvQueryAdaptors(display, XDefaultRootWindow(display), &num_adaptors, &adaptor_info) != Success)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < num_adaptors && !found_port; ++i)
|
||||
{
|
||||
if (adaptor_info[i].type & XvImageMask)
|
||||
{
|
||||
XvMCSurfaceInfo *surface_info = XvMCListSurfaceTypes(display, adaptor_info[i].base_id, &num_types);
|
||||
|
||||
if (surface_info)
|
||||
{
|
||||
for (j = 0; j < num_types && !found_port; ++j)
|
||||
{
|
||||
if
|
||||
(
|
||||
surface_info[j].chroma_format == chroma_format &&
|
||||
surface_info[j].max_width >= width &&
|
||||
surface_info[j].max_height >= height
|
||||
)
|
||||
{
|
||||
for (k = 0; k < num_mc_types && !found_port; ++k)
|
||||
{
|
||||
if ((surface_info[j].mc_type & mc_types[k]) == mc_types[k])
|
||||
{
|
||||
for (l = 0; l < adaptor_info[i].num_ports && !found_port; ++l)
|
||||
{
|
||||
if (XvGrabPort(display, adaptor_info[i].base_id + l, CurrentTime) == Success)
|
||||
{
|
||||
*port_id = adaptor_info[i].base_id + l;
|
||||
*surface_type_id = surface_info[j].surface_type_id;
|
||||
*is_overlay = surface_info[j].flags & XVMC_OVERLAID_SURFACE;
|
||||
*intra_unsigned = surface_info[j].flags & XVMC_INTRA_UNSIGNED;
|
||||
found_port = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(surface_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XvFreeAdaptorInfo(adaptor_info);
|
||||
|
||||
return found_port;
|
||||
}
|
||||
|
||||
unsigned int align(unsigned int value, unsigned int alignment)
|
||||
{
|
||||
return (value + alignment - 1) & ~(alignment - 1);
|
||||
}
|
||||
|
||||
/* From the glibc manual */
|
||||
int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y)
|
||||
{
|
||||
/* Perform the carry for the later subtraction by updating y. */
|
||||
if (x->tv_usec < y->tv_usec)
|
||||
{
|
||||
int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
|
||||
y->tv_usec -= 1000000 * nsec;
|
||||
y->tv_sec += nsec;
|
||||
}
|
||||
if (x->tv_usec - y->tv_usec > 1000000)
|
||||
{
|
||||
int nsec = (x->tv_usec - y->tv_usec) / 1000000;
|
||||
y->tv_usec += 1000000 * nsec;
|
||||
y->tv_sec -= nsec;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the time remaining to wait.
|
||||
* tv_usec is certainly positive.
|
||||
*/
|
||||
result->tv_sec = x->tv_sec - y->tv_sec;
|
||||
result->tv_usec = x->tv_usec - y->tv_usec;
|
||||
|
||||
/* Return 1 if result is negative. */
|
||||
return x->tv_sec < y->tv_sec;
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 Younes Manton.
|
||||
* 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 VMWARE 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef testlib_h
|
||||
#define testlib_h
|
||||
|
||||
/*
|
||||
#define TEST(pred, doc) test(pred, #pred, doc, __FILE__, __LINE__)
|
||||
|
||||
void test(int pred, const char *pred_string, const char *doc_string, const char *file, unsigned int line);
|
||||
*/
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/XvMClib.h>
|
||||
|
||||
/*
|
||||
* display: IN A valid X display
|
||||
* width, height: IN Surface size that the port must display
|
||||
* chroma_format: IN Chroma format that the port must display
|
||||
* mc_types, num_mc_types: IN List of MC types that the port must support, first port that matches the first mc_type will be returned
|
||||
* port_id: OUT Your port's ID
|
||||
* surface_type_id: OUT Your port's surface ID
|
||||
* is_overlay: OUT If 1, port uses overlay surfaces, you need to set a colorkey
|
||||
* intra_unsigned: OUT If 1, port uses unsigned values for intra-coded blocks
|
||||
*/
|
||||
int GetPort
|
||||
(
|
||||
Display *display,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
unsigned int chroma_format,
|
||||
const unsigned int *mc_types,
|
||||
unsigned int num_mc_types,
|
||||
XvPortID *port_id,
|
||||
int *surface_type_id,
|
||||
unsigned int *is_overlay,
|
||||
unsigned int *intra_unsigned
|
||||
);
|
||||
|
||||
unsigned int align(unsigned int value, unsigned int alignment);
|
||||
|
||||
int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y);
|
||||
|
||||
#endif
|
@ -1,309 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 Younes Manton.
|
||||
* 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 VMWARE 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* Force assertions, even on release builds. */
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
#include "testlib.h"
|
||||
|
||||
#define MACROBLOCK_WIDTH 16
|
||||
#define MACROBLOCK_HEIGHT 16
|
||||
#define BLOCKS_PER_MACROBLOCK 6
|
||||
|
||||
#define DEFAULT_INPUT_WIDTH 720
|
||||
#define DEFAULT_INPUT_HEIGHT 480
|
||||
#define DEFAULT_REPS 100
|
||||
|
||||
#define PIPELINE_STEP_MC 1
|
||||
#define PIPELINE_STEP_CSC 2
|
||||
#define PIPELINE_STEP_SWAP 4
|
||||
|
||||
#define MB_TYPE_I 1
|
||||
#define MB_TYPE_P 2
|
||||
#define MB_TYPE_B 4
|
||||
|
||||
struct Config
|
||||
{
|
||||
unsigned int input_width;
|
||||
unsigned int input_height;
|
||||
unsigned int output_width;
|
||||
unsigned int output_height;
|
||||
unsigned int pipeline;
|
||||
unsigned int mb_types;
|
||||
unsigned int reps;
|
||||
};
|
||||
|
||||
void ParseArgs(int argc, char **argv, struct Config *config);
|
||||
|
||||
void ParseArgs(int argc, char **argv, struct Config *config)
|
||||
{
|
||||
int fail = 0;
|
||||
int i;
|
||||
|
||||
config->input_width = DEFAULT_INPUT_WIDTH;
|
||||
config->input_height = DEFAULT_INPUT_HEIGHT;
|
||||
config->output_width = 0;
|
||||
config->output_height = 0;
|
||||
config->pipeline = 0;
|
||||
config->mb_types = 0;
|
||||
config->reps = DEFAULT_REPS;
|
||||
|
||||
for (i = 1; i < argc && !fail; ++i)
|
||||
{
|
||||
if (!strcmp(argv[i], "-iw"))
|
||||
{
|
||||
if (sscanf(argv[++i], "%u", &config->input_width) != 1)
|
||||
fail = 1;
|
||||
}
|
||||
else if (!strcmp(argv[i], "-ih"))
|
||||
{
|
||||
if (sscanf(argv[++i], "%u", &config->input_height) != 1)
|
||||
fail = 1;
|
||||
}
|
||||
else if (!strcmp(argv[i], "-ow"))
|
||||
{
|
||||
if (sscanf(argv[++i], "%u", &config->output_width) != 1)
|
||||
fail = 1;
|
||||
}
|
||||
else if (!strcmp(argv[i], "-oh"))
|
||||
{
|
||||
if (sscanf(argv[++i], "%u", &config->output_height) != 1)
|
||||
fail = 1;
|
||||
}
|
||||
else if (!strcmp(argv[i], "-p"))
|
||||
{
|
||||
char *token = strtok(argv[++i], ",");
|
||||
|
||||
while (token && !fail)
|
||||
{
|
||||
if (!strcmp(token, "mc"))
|
||||
config->pipeline |= PIPELINE_STEP_MC;
|
||||
else if (!strcmp(token, "csc"))
|
||||
config->pipeline |= PIPELINE_STEP_CSC;
|
||||
else if (!strcmp(token, "swp"))
|
||||
config->pipeline |= PIPELINE_STEP_SWAP;
|
||||
else
|
||||
fail = 1;
|
||||
|
||||
if (!fail)
|
||||
token = strtok(NULL, ",");
|
||||
}
|
||||
}
|
||||
else if (!strcmp(argv[i], "-mb"))
|
||||
{
|
||||
char *token = strtok(argv[++i], ",");
|
||||
|
||||
while (token && !fail)
|
||||
{
|
||||
if (strcmp(token, "i") == 0)
|
||||
config->mb_types |= MB_TYPE_I;
|
||||
else if (strcmp(token, "p") == 0)
|
||||
config->mb_types |= MB_TYPE_P;
|
||||
else if (strcmp(token, "b") == 0)
|
||||
config->mb_types |= MB_TYPE_B;
|
||||
else
|
||||
fail = 1;
|
||||
|
||||
if (!fail)
|
||||
token = strtok(NULL, ",");
|
||||
}
|
||||
}
|
||||
else if (!strcmp(argv[i], "-r"))
|
||||
{
|
||||
if (sscanf(argv[++i], "%u", &config->reps) != 1)
|
||||
fail = 1;
|
||||
}
|
||||
else
|
||||
fail = 1;
|
||||
}
|
||||
|
||||
if (fail)
|
||||
{
|
||||
fprintf(
|
||||
stderr,
|
||||
"Bad argument.\n"
|
||||
"\n"
|
||||
"Usage: %s [options]\n"
|
||||
"\t-iw <width>\tInput width\n"
|
||||
"\t-ih <height>\tInput height\n"
|
||||
"\t-ow <width>\tOutput width\n"
|
||||
"\t-oh <height>\tOutput height\n"
|
||||
"\t-p <pipeline>\tPipeline to test\n"
|
||||
"\t-mb <mb type>\tMacroBlock types to use\n"
|
||||
"\t-r <reps>\tRepetitions\n\n"
|
||||
"\tPipeline steps: mc,csc,swap\n"
|
||||
"\tMB types: i,p,b\n",
|
||||
argv[0]
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (config->output_width == 0)
|
||||
config->output_width = config->input_width;
|
||||
if (config->output_height == 0)
|
||||
config->output_height = config->input_height;
|
||||
if (!config->pipeline)
|
||||
config->pipeline = PIPELINE_STEP_MC | PIPELINE_STEP_CSC | PIPELINE_STEP_SWAP;
|
||||
if (!config->mb_types)
|
||||
config->mb_types = MB_TYPE_I | MB_TYPE_P | MB_TYPE_B;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct Config config;
|
||||
Display *display;
|
||||
Window root, window;
|
||||
const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2};
|
||||
XvPortID port_num;
|
||||
int surface_type_id;
|
||||
unsigned int is_overlay, intra_unsigned;
|
||||
int colorkey;
|
||||
XvMCContext context;
|
||||
XvMCSurface surface;
|
||||
XvMCBlockArray block_array;
|
||||
XvMCMacroBlockArray mb_array;
|
||||
unsigned int mbw, mbh;
|
||||
unsigned int mbx, mby;
|
||||
unsigned int reps;
|
||||
struct timeval start, stop, diff;
|
||||
double diff_secs;
|
||||
|
||||
ParseArgs(argc, argv, &config);
|
||||
|
||||
mbw = align(config.input_width, MACROBLOCK_WIDTH) / MACROBLOCK_WIDTH;
|
||||
mbh = align(config.input_height, MACROBLOCK_HEIGHT) / MACROBLOCK_HEIGHT;
|
||||
|
||||
display = XOpenDisplay(NULL);
|
||||
|
||||
if (!GetPort
|
||||
(
|
||||
display,
|
||||
config.input_width,
|
||||
config.input_height,
|
||||
XVMC_CHROMA_FORMAT_420,
|
||||
mc_types,
|
||||
2,
|
||||
&port_num,
|
||||
&surface_type_id,
|
||||
&is_overlay,
|
||||
&intra_unsigned
|
||||
))
|
||||
{
|
||||
XCloseDisplay(display);
|
||||
fprintf(stderr, "Error, unable to find a good port.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (is_overlay)
|
||||
{
|
||||
Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0);
|
||||
XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey);
|
||||
}
|
||||
else
|
||||
{
|
||||
colorkey = 0;
|
||||
}
|
||||
|
||||
root = XDefaultRootWindow(display);
|
||||
window = XCreateSimpleWindow(display, root, 0, 0, config.output_width, config.output_height, 0, 0, colorkey);
|
||||
|
||||
assert(XvMCCreateContext(display, port_num, surface_type_id, config.input_width, config.input_height, XVMC_DIRECT, &context) == Success);
|
||||
assert(XvMCCreateSurface(display, &context, &surface) == Success);
|
||||
assert(XvMCCreateBlocks(display, &context, mbw * mbh * BLOCKS_PER_MACROBLOCK, &block_array) == Success);
|
||||
assert(XvMCCreateMacroBlocks(display, &context, mbw * mbh, &mb_array) == Success);
|
||||
|
||||
for (mby = 0; mby < mbh; ++mby)
|
||||
for (mbx = 0; mbx < mbw; ++mbx)
|
||||
{
|
||||
mb_array.macro_blocks[mby * mbw + mbx].x = mbx;
|
||||
mb_array.macro_blocks[mby * mbw + mbx].y = mby;
|
||||
mb_array.macro_blocks[mby * mbw + mbx].macroblock_type = XVMC_MB_TYPE_INTRA;
|
||||
/*mb->motion_type = ;*/
|
||||
/*mb->motion_vertical_field_select = ;*/
|
||||
mb_array.macro_blocks[mby * mbw + mbx].dct_type = XVMC_DCT_TYPE_FRAME;
|
||||
/*mb->PMV[0][0][0] = ;
|
||||
mb->PMV[0][0][1] = ;
|
||||
mb->PMV[0][1][0] = ;
|
||||
mb->PMV[0][1][1] = ;
|
||||
mb->PMV[1][0][0] = ;
|
||||
mb->PMV[1][0][1] = ;
|
||||
mb->PMV[1][1][0] = ;
|
||||
mb->PMV[1][1][1] = ;*/
|
||||
mb_array.macro_blocks[mby * mbw + mbx].index = (mby * mbw + mbx) * BLOCKS_PER_MACROBLOCK;
|
||||
mb_array.macro_blocks[mby * mbw + mbx].coded_block_pattern = 0x3F;
|
||||
}
|
||||
|
||||
XSelectInput(display, window, ExposureMask | KeyPressMask);
|
||||
XMapWindow(display, window);
|
||||
XSync(display, 0);
|
||||
|
||||
gettimeofday(&start, NULL);
|
||||
|
||||
for (reps = 0; reps < config.reps; ++reps)
|
||||
{
|
||||
if (config.pipeline & PIPELINE_STEP_MC)
|
||||
{
|
||||
assert(XvMCRenderSurface(display, &context, XVMC_FRAME_PICTURE, &surface, NULL, NULL, 0, mbw * mbh, 0, &mb_array, &block_array) == Success);
|
||||
assert(XvMCFlushSurface(display, &surface) == Success);
|
||||
}
|
||||
if (config.pipeline & PIPELINE_STEP_CSC)
|
||||
assert(XvMCPutSurface(display, &surface, window, 0, 0, config.input_width, config.input_height, 0, 0, config.output_width, config.output_height, XVMC_FRAME_PICTURE) == Success);
|
||||
}
|
||||
|
||||
gettimeofday(&stop, NULL);
|
||||
|
||||
timeval_subtract(&diff, &stop, &start);
|
||||
diff_secs = (double)diff.tv_sec + (double)diff.tv_usec / 1000000.0;
|
||||
|
||||
printf("XvMC Benchmark\n");
|
||||
printf("Input: %u,%u\nOutput: %u,%u\n", config.input_width, config.input_height, config.output_width, config.output_height);
|
||||
printf("Pipeline: ");
|
||||
if (config.pipeline & PIPELINE_STEP_MC)
|
||||
printf("|mc|");
|
||||
if (config.pipeline & PIPELINE_STEP_CSC)
|
||||
printf("|csc|");
|
||||
if (config.pipeline & PIPELINE_STEP_SWAP)
|
||||
printf("|swap|");
|
||||
printf("\n");
|
||||
printf("Reps: %u\n", config.reps);
|
||||
printf("Total time: %.2lf (%.2lf reps / sec)\n", diff_secs, config.reps / diff_secs);
|
||||
|
||||
assert(XvMCDestroyBlocks(display, &block_array) == Success);
|
||||
assert(XvMCDestroyMacroBlocks(display, &mb_array) == Success);
|
||||
assert(XvMCDestroySurface(display, &surface) == Success);
|
||||
assert(XvMCDestroyContext(display, &context) == Success);
|
||||
|
||||
XvUngrabPort(display, port_num, CurrentTime);
|
||||
XDestroyWindow(display, window);
|
||||
XCloseDisplay(display);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,125 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2009 Younes Manton.
|
||||
* 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 VMWARE 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.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef xvmc_private_h
|
||||
#define xvmc_private_h
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/XvMClib.h>
|
||||
|
||||
#include "pipe/p_video_state.h"
|
||||
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
#include "vl/vl_csc.h"
|
||||
#include "vl/vl_compositor.h"
|
||||
|
||||
#define BLOCK_SIZE_SAMPLES 64
|
||||
#define BLOCK_SIZE_BYTES (BLOCK_SIZE_SAMPLES * 2)
|
||||
|
||||
struct pipe_video_codec;
|
||||
struct pipe_video_buffer;
|
||||
|
||||
struct pipe_sampler_view;
|
||||
struct pipe_fence_handle;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct vl_screen *vscreen;
|
||||
struct pipe_context *pipe;
|
||||
struct pipe_video_codec *decoder;
|
||||
|
||||
enum VL_CSC_COLOR_STANDARD color_standard;
|
||||
struct vl_procamp procamp;
|
||||
struct vl_compositor compositor;
|
||||
struct vl_compositor_state cstate;
|
||||
|
||||
unsigned short subpicture_max_width;
|
||||
unsigned short subpicture_max_height;
|
||||
|
||||
} XvMCContextPrivate;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct pipe_video_buffer *video_buffer;
|
||||
|
||||
/* nonzero if this picture is already being decoded */
|
||||
unsigned picture_structure;
|
||||
|
||||
XvMCSurface *ref[2];
|
||||
|
||||
struct pipe_fence_handle *fence;
|
||||
|
||||
/* The subpicture associated with this surface, if any. */
|
||||
XvMCSubpicture *subpicture;
|
||||
|
||||
/* Some XvMC functions take a surface but not a context,
|
||||
so we keep track of which context each surface belongs to. */
|
||||
XvMCContext *context;
|
||||
} XvMCSurfacePrivate;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct pipe_sampler_view *sampler;
|
||||
|
||||
/* optional palette for this subpicture */
|
||||
struct pipe_sampler_view *palette;
|
||||
|
||||
struct u_rect src_rect;
|
||||
struct u_rect dst_rect;
|
||||
|
||||
/* The surface this subpicture is currently associated with, if any. */
|
||||
XvMCSurface *surface;
|
||||
|
||||
/* Some XvMC functions take a subpicture but not a context,
|
||||
so we keep track of which context each subpicture belongs to. */
|
||||
XvMCContext *context;
|
||||
} XvMCSubpicturePrivate;
|
||||
|
||||
#define XVMC_OUT 0
|
||||
#define XVMC_ERR 1
|
||||
#define XVMC_WARN 2
|
||||
#define XVMC_TRACE 3
|
||||
|
||||
static inline void XVMC_MSG(int level, const char *fmt, ...)
|
||||
{
|
||||
static int debug_level = -1;
|
||||
|
||||
if (debug_level == -1) {
|
||||
debug_level = MAX2(debug_get_num_option("XVMC_DEBUG", 0), 0);
|
||||
}
|
||||
|
||||
if (level <= debug_level) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
_debug_vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* xvmc_private_h */
|
@ -203,10 +203,6 @@ if with_gallium_vdpau
|
||||
subdir('frontends/vdpau')
|
||||
subdir('targets/vdpau')
|
||||
endif
|
||||
if with_gallium_xvmc
|
||||
subdir('frontends/xvmc')
|
||||
subdir('targets/xvmc')
|
||||
endif
|
||||
if with_gallium_omx != 'disabled'
|
||||
subdir('frontends/omx')
|
||||
subdir('targets/omx')
|
||||
|
@ -40,7 +40,7 @@ if with_ld_version_script
|
||||
endif
|
||||
|
||||
if (with_gallium_va or with_gallium_vdpau or with_gallium_omx != 'disabled' or
|
||||
with_gallium_xvmc or with_dri)
|
||||
with_dri)
|
||||
gallium_nine_link_with += libgalliumvl
|
||||
else
|
||||
gallium_nine_link_with += libgalliumvl_stub
|
||||
|
@ -28,13 +28,12 @@ pipe_loader_incs = [
|
||||
]
|
||||
|
||||
if (with_gallium_va or with_gallium_vdpau or with_gallium_omx != 'disabled' or
|
||||
with_gallium_xvmc or with_dri or with_gallium_radeonsi)
|
||||
with_dri or with_gallium_radeonsi)
|
||||
pipe_loader_link_with += libgalliumvl
|
||||
else
|
||||
pipe_loader_link_with += libgalliumvl_stub
|
||||
endif
|
||||
if (with_gallium_va or with_gallium_vdpau or with_gallium_omx != 'disabled' or
|
||||
with_gallium_xvmc)
|
||||
if (with_gallium_va or with_gallium_vdpau or with_gallium_omx != 'disabled')
|
||||
pipe_loader_link_with += libgalliumvlwinsys
|
||||
endif
|
||||
|
||||
|
@ -1,67 +0,0 @@
|
||||
# Copyright © 2017-2018 Intel Corporation
|
||||
|
||||
# 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 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.
|
||||
|
||||
# TODO: support non-static targets
|
||||
# Static targets are always enabled in autotools (unless you modify
|
||||
# configure.ac)
|
||||
|
||||
xvmc_link_args = []
|
||||
xvmc_link_depends = []
|
||||
xvmc_drivers = []
|
||||
|
||||
if with_ld_version_script
|
||||
xvmc_link_args += ['-Wl,--version-script', join_paths(meson.current_source_dir(), 'xvmc.sym')]
|
||||
xvmc_link_depends += files('xvmc.sym')
|
||||
endif
|
||||
|
||||
libxvmc_gallium = shared_library(
|
||||
'XvMCgallium',
|
||||
'target.c',
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
link_args : [xvmc_link_args, ld_args_gc_sections],
|
||||
include_directories : [
|
||||
inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_util, inc_gallium_winsys, inc_gallium_drivers,
|
||||
],
|
||||
link_whole : [libxvmc_st],
|
||||
link_with : [
|
||||
libgalliumvlwinsys, libgalliumvl, libgallium,
|
||||
libpipe_loader_static, libws_null, libwsw, libswdri, libswkmsdri,
|
||||
],
|
||||
dependencies : [idep_mesautil, driver_r600, driver_nouveau],
|
||||
link_depends : xvmc_link_depends,
|
||||
# Will be deleted during installation, see install_megadrivers.py
|
||||
install : true,
|
||||
install_dir : xvmc_drivers_path,
|
||||
name_suffix : 'so',
|
||||
version : '@0@.@1@.0'.format(XVMC_MAJOR, XVMC_MINOR),
|
||||
)
|
||||
|
||||
foreach d : [[with_gallium_r600, 'r600'], [with_gallium_nouveau, 'nouveau']]
|
||||
if d[0]
|
||||
xvmc_drivers += 'libXvMC@0@.so.@1@.@2@.0'.format(d[1], XVMC_MAJOR, XVMC_MINOR)
|
||||
endif
|
||||
endforeach
|
||||
|
||||
meson.add_install_script(
|
||||
install_megadrivers_py.path(),
|
||||
libxvmc_gallium.full_path(),
|
||||
xvmc_drivers_path,
|
||||
xvmc_drivers,
|
||||
)
|
@ -1,2 +0,0 @@
|
||||
#include "target-helpers/drm_helper.h"
|
||||
#include "target-helpers/sw_helper.h"
|
@ -1,32 +0,0 @@
|
||||
{
|
||||
global:
|
||||
XvMCBlendSubpicture;
|
||||
XvMCBlendSubpicture2;
|
||||
XvMCClearSubpicture;
|
||||
XvMCCompositeSubpicture;
|
||||
XvMCCreateBlocks;
|
||||
XvMCCreateContext;
|
||||
XvMCCreateMacroBlocks;
|
||||
XvMCCreateSubpicture;
|
||||
XvMCCreateSurface;
|
||||
XvMCDestroyBlocks;
|
||||
XvMCDestroyContext;
|
||||
XvMCDestroyMacroBlocks;
|
||||
XvMCDestroySubpicture;
|
||||
XvMCDestroySurface;
|
||||
XvMCFlushSubpicture;
|
||||
XvMCFlushSurface;
|
||||
XvMCGetAttribute;
|
||||
XvMCGetSubpictureStatus;
|
||||
XvMCGetSurfaceStatus;
|
||||
XvMCHideSurface;
|
||||
XvMCPutSurface;
|
||||
XvMCQueryAttributes;
|
||||
XvMCRenderSurface;
|
||||
XvMCSetAttribute;
|
||||
XvMCSetSubpicturePalette;
|
||||
XvMCSyncSubpicture;
|
||||
XvMCSyncSurface;
|
||||
local:
|
||||
*;
|
||||
};
|
Loading…
Reference in New Issue
Block a user