Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/EnterDevShell.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
param(
[Parameter()]
[String]$architecture
)

function EnterDevShellEnv {

param(
[Parameter()]
[String]$arch
)

$vsw = Get-Command 'vswhere'
$VSFfavors = 'Community','Professional','Enterprise','BuildTools' | %{ "Microsoft.VisualStudio.Product.$_" }
$vs = & $vsw.Path -products $VSFfavors -latest -format json | ConvertFrom-Json
$tools_dir = Join-Path $vs.installationPath 'Common7' 'Tools'
# Try the root tools dir
$devshell = Join-Path $tools_dir 'Microsoft.VisualStudio.DevShell.dll'
# Try finding it under vsdevshell
if (!(Test-Path $devshell -Type Leaf)) {
$devshell = Join-Path $tools_dir 'vsdevshell' 'Microsoft.VisualStudio.DevShell.dll'
}
# Fail if didn't find the DevShell library
if (!(Test-Path $devshell -Type Leaf)) {
throw "error: cannot find Microsoft.VisualStudio.DevShell.dll"
}
Import-Module $devshell
Enter-VsDevShell -VsInstanceId $vs.instanceId -SkipAutomaticLocation -DevCmdArguments "-arch=$arch -no_logo"
}

# Enter VsDevShell, capture the environment difference and export it to github env
$env_before = @{}
Get-ChildItem env: | %{ $env_before.Add($_.Name, $_.Value) }
EnterDevShellEnv -arch "$architecture"
$env_after = @{}
Get-ChildItem env: | %{ $env_after.Add($_.Name, $_.Value) }
$env_diff = $env_after.GetEnumerator() | where { -not $env_before.ContainsKey($_.Name) -or $env_before[$_.Name] -ne $_.Value }
$env_diff | %{ echo "$($_.Name)=$($_.Value)" >> $env:GITHUB_ENV }
101 changes: 101 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: windows

on:
push:
paths-ignore:
- '.github/workflows/**'
- '!.github/workflows/windows.yml'
- '!.github/workflows/EnterDevShell.ps1'
pull_request:
paths-ignore:
- '.github/workflows/**'
- '!.github/workflows/windows.yml'
- '!.github/workflows/EnterDevShell.ps1'

jobs:
windows-msvc:
runs-on: windows-2022
steps:
- name: checkout libva
uses: actions/checkout@v2
with:
repository: intel/libva
path: libva
- name: checkout libva-utils
uses: actions/checkout@v2
with:
path: libva-utils
- name: 'Setup Python'
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Meson
run: pip install meson
- name: Install pkg-config
shell: pwsh
run: |
Invoke-RestMethod -Uri https://download.gnome.org/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip -OutFile pkg-config_0.26-1_win32.zip
Expand-Archive pkg-config_0.26-1_win32.zip
Invoke-RestMethod -Uri http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib_2.28.8-1_win32.zip -OutFile glib_2.28.8-1_win32.zip
Expand-Archive glib_2.28.8-1_win32.zip
Invoke-RestMethod -Uri http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime_0.18.1.1-2_win32.zip -OutFile gettext-runtime_0.18.1.1-2_win32.zip
Expand-Archive gettext-runtime_0.18.1.1-2_win32.zip
mkdir pkg-config
cp pkg-config_0.26-1_win32\bin\* pkg-config\
cp gettext-runtime_0.18.1.1-2_win32\bin\* pkg-config\
cp glib_2.28.8-1_win32\bin\* pkg-config\
- name: Enter DevShell
run: 'libva-utils\.github\workflows\EnterDevShell.ps1 ${{ inputs.architecture }}'
shell: pwsh
- name: Build libva
run: |
cd libva
meson build
ninja -C build install
- name: Build libva-utils
run: |
$env:Path += ";"
$env:Path += Resolve-Path pkg-config\
$env:Path += ";c:\bin\;c:\lib\"
$env:PKG_CONFIG_PATH = "C:\lib\pkgconfig"
del C:\Strawberry\perl\bin\pkg-config*
cd libva-utils
meson build -Dtests=true
ninja -C build install

windows-mingw:
runs-on: windows-2022
defaults:
run:
shell: msys2 {0}
steps:
- name: checkout libva
uses: actions/checkout@v2
with:
repository: intel/libva
path: libva
- name: checkout libva-utils
uses: actions/checkout@v2
with:
path: libva-utils
- name: 'Setup MSYS2'
uses: msys2/setup-msys2@v2
with:
msystem: mingw64
update: false
pacboy: >-
toolchain:p
meson:p
- name: Enter DevShell
run: 'libva-utils\.github\workflows\EnterDevShell.ps1 ${{ inputs.architecture }}'
shell: pwsh
- name: Build libva
run: |
cd libva
CC=gcc meson build
CC=gcc ninja -C build install
- name: Build libva-utils
run: |
cd libva-utils
CC=gcc meson build -Dtests=true
CC=gcc ninja -C build install
5 changes: 5 additions & 0 deletions common/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ if use_wayland
libva_display_deps += wayland_deps
endif

if use_win32
libva_display_src += [ 'va_display_win32.c' ]
libva_display_deps += win32_deps
endif

libva_display_lib = static_library('common', libva_display_src,
dependencies: libva_display_deps,
include_directories: include_directories('.'))
Expand Down
4 changes: 4 additions & 0 deletions common/va_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,16 @@ extern const VADisplayHooks va_display_hooks_android;
extern const VADisplayHooks va_display_hooks_wayland;
extern const VADisplayHooks va_display_hooks_x11;
extern const VADisplayHooks va_display_hooks_drm;
extern const VADisplayHooks va_display_hooks_win32;

static const VADisplayHooks *g_display_hooks;
static const VADisplayHooks *g_display_hooks_available[] = {
#ifdef ANDROID
&va_display_hooks_android,
#else
#ifdef HAVE_VA_WIN32
&va_display_hooks_win32,
#endif
#ifdef HAVE_VA_WAYLAND
&va_display_hooks_wayland,
#endif
Expand Down
57 changes: 57 additions & 0 deletions common/va_display_win32.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright © Microsoft 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 (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/

#include <stdio.h>
#include <stdbool.h>
#include <va/va_win32.h>
#include "va_display.h"

static VADisplay
va_open_display_win32(void)
{
// Choose default adapter on NULL
return vaGetDisplayWin32(NULL);
}

static void
va_close_display_win32(VADisplay va_dpy)
{
}

static VAStatus
va_put_surface_win32(
VADisplay va_dpy,
VASurfaceID surface,
const VARectangle *src_rect,
const VARectangle *dst_rect
)
{
return VA_STATUS_ERROR_OPERATION_FAILED;
}

const VADisplayHooks va_display_hooks_win32 = {
"win32",
va_open_display_win32,
va_close_display_win32,
va_put_surface_win32,
};
82 changes: 82 additions & 0 deletions getopt/getopt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/* $OpenBSD: getopt.h,v 1.2 2008/06/26 05:42:04 ray Exp $ */
/* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */

/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Dieter Baron and Thomas Klausner.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef _GETOPT_H_
#define _GETOPT_H_

/*
* GNU-like getopt_long() and 4.4BSD getsubopt()/optreset extensions
*/
#define no_argument 0
#define required_argument 1
#define optional_argument 2

#ifdef __cplusplus
extern "C" {
#endif

struct option {
/* name of long option */
const char *name;
/*
* one of no_argument, required_argument, and optional_argument:
* whether option takes an argument
*/
int has_arg;
/* if not NULL, set *flag to val when option found */
int *flag;
/* if flag not NULL, value to set *flag to; else return value */
int val;
};

int getopt_long(int, char * const *, const char *,
const struct option *, int *);
int getopt_long_only(int, char * const *, const char *,
const struct option *, int *);
#ifndef _GETOPT_DEFINED_
#define _GETOPT_DEFINED_
int getopt(int, char * const *, const char *);
int getsubopt(char **, char * const *, char **);

extern char *optarg; /* getopt(3) external variables */
extern int opterr;
extern int optind;
extern int optopt;
extern int optreset;
extern char *suboptarg; /* getsubopt(3) external variable */
#endif

#ifdef __cplusplus
}
#endif

#endif /* !_GETOPT_H_ */
Loading