-
Notifications
You must be signed in to change notification settings - Fork 169
Port vainfo and tests for libva-win32 #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4d965ae
Import OpenBSD getopt for MSVC from mesa/f9bb5323
sivileri e70eb3f
vainfo: add va-win32 support
sivileri 9e92b99
tests: remove non C++ standard constructs
sivileri 451268c
tests: Remove C++20 constructs in tests project targetting C++11
sivileri b444a23
tests: enable building on Windows
sivileri 8aef416
ci: Add msvc/mingw Windows CI
sivileri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 $ */ | ||
sivileri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /* $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_ */ | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.