Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
libva
Commits
2224d4c7
Commit
2224d4c7
authored
Jul 12, 2010
by
Gwenole Beauchesne
Committed by
Austin Yuan
Jul 26, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix detection of fglrx.
parent
0685f070
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
283 additions
and
4 deletions
+283
-4
va/Makefile.am
va/Makefile.am
+1
-1
va/x11/Makefile.am
va/x11/Makefile.am
+2
-2
va/x11/va_fglrx.c
va/x11/va_fglrx.c
+225
-0
va/x11/va_fglrx.h
va/x11/va_fglrx.h
+34
-0
va/x11/va_x11.c
va/x11/va_x11.c
+21
-1
No files found.
va/Makefile.am
View file @
2224d4c7
...
...
@@ -43,7 +43,7 @@ libva_x11_backend = libva-x11.la
libva_x11_backenddir
=
x11
libva_x11_la_SOURCES
=
libva_x11_la_LIBADD
=
$(libvacorelib)
x11/libva_x11.la
$(LIBVA_LIBS)
$(X11_LIBS)
$(XEXT_LIBS)
$(DRM_LIBS)
$(XFIXES_LIBS)
libva_x11_la_LIBADD
=
$(libvacorelib)
x11/libva_x11.la
$(LIBVA_LIBS)
$(X11_LIBS)
$(XEXT_LIBS)
$(DRM_LIBS)
$(XFIXES_LIBS)
-ldl
libva_x11_la_LDFLAGS
=
$(LDADD)
libva_x11_la_DEPENDENCIES
=
$(libvacorelib)
x11/libva_x11.la
...
...
va/x11/Makefile.am
View file @
2224d4c7
...
...
@@ -25,6 +25,6 @@ noinst_LTLIBRARIES = libva_x11.la
libva_x11includedir
=
${includedir}
/va
libva_x11include_HEADERS
=
va_dri.h va_dri2.h va_dricommon.h
libva_x11_la_SOURCES
=
va_x11.c va_dri.c va_dri2.c va_dricommon.c dri2_util.c dri1_util.c va_nvctrl.c
libva_x11_la_SOURCES
=
va_x11.c va_dri.c va_dri2.c va_dricommon.c dri2_util.c dri1_util.c va_nvctrl.c
va_fglrx.c
EXTRA_DIST
=
va_dristr.h va_dri2str.h va_dri2tokens.h va_nvctrl.h
EXTRA_DIST
=
va_dristr.h va_dri2str.h va_dri2tokens.h va_nvctrl.h
va_fglrx.h
va/x11/va_fglrx.c
0 → 100644
View file @
2224d4c7
/*
* Copyright (C) 2010 Splitted-Desktop Systems. 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 PRECISION INSIGHT 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#include <X11/Xlib.h>
#define ADL_OK 0
#define ADL_MAX_PATH 256
/*
* Based on public AMD Display Library (ADL) SDK:
* <http://developer.amd.com/gpu/adlsdk/Pages/default.aspx>
*/
typedef
struct
AdapterInfo
{
int
iSize
;
int
iAdapterIndex
;
char
strUDID
[
ADL_MAX_PATH
];
int
iBusNumber
;
int
iDeviceNumber
;
int
iFunctionNumber
;
int
iVendorID
;
char
strAdapterName
[
ADL_MAX_PATH
];
char
strDisplayName
[
ADL_MAX_PATH
];
int
iPresent
;
int
iXScreenNum
;
int
iDrvIndex
;
char
strXScreenConfigName
[
ADL_MAX_PATH
];
}
AdapterInfo
,
*
LPAdapterInfo
;
typedef
struct
XScreenInfo
{
int
iXScreenNum
;
char
strXScreenConfigName
[
ADL_MAX_PATH
];
}
XScreenInfo
,
*
LPXScreenInfo
;
typedef
void
*
(
*
ADL_MAIN_MALLOC_CALLBACK
)(
int
);
typedef
int
(
*
ADL_MAIN_CONTROL_CREATE
)(
ADL_MAIN_MALLOC_CALLBACK
,
int
);
typedef
int
(
*
ADL_MAIN_CONTROL_DESTROY
)(
void
);
typedef
int
(
*
ADL_ADAPTER_NUMBEROFADAPTERS_GET
)(
int
*
);
typedef
int
(
*
ADL_ADAPTER_ADAPTERINFO_GET
)(
LPAdapterInfo
,
int
);
typedef
int
(
*
ADL_ADAPTER_XSCREENINFO_GET
)(
LPXScreenInfo
,
int
);
static
void
*
ADL_Main_Memory_Alloc
(
int
iSize
)
{
return
malloc
(
iSize
);
}
static
void
ADL_Main_Memory_Free
(
void
*
arg
)
{
void
**
const
lpBuffer
=
arg
;
if
(
lpBuffer
&&
*
lpBuffer
)
{
free
(
*
lpBuffer
);
*
lpBuffer
=
NULL
;
}
}
static
int
match_display
(
Display
*
x11_dpy
,
const
char
*
display_name
)
{
Display
*
test_dpy
;
char
*
test_dpy_name
,
*
x11_dpy_name
;
int
m
;
test_dpy
=
XOpenDisplay
(
display_name
);
if
(
!
test_dpy
)
return
0
;
test_dpy_name
=
XDisplayString
(
test_dpy
);
x11_dpy_name
=
XDisplayString
(
x11_dpy
);
if
(
x11_dpy_name
&&
test_dpy_name
)
m
=
strcmp
(
x11_dpy_name
,
test_dpy_name
)
==
0
;
else
m
=
!
x11_dpy_name
&&
!
test_dpy_name
;
XCloseDisplay
(
test_dpy
);
return
m
;
}
Bool
VA_FGLRXGetClientDriverName
(
Display
*
dpy
,
int
screen
,
int
*
ddxDriverMajorVersion
,
int
*
ddxDriverMinorVersion
,
int
*
ddxDriverPatchVersion
,
char
**
clientDriverName
)
{
ADL_MAIN_CONTROL_CREATE
ADL_Main_Control_Create
;
ADL_MAIN_CONTROL_DESTROY
ADL_Main_Control_Destroy
;
ADL_ADAPTER_NUMBEROFADAPTERS_GET
ADL_Adapter_NumberOfAdapters_Get
;
ADL_ADAPTER_ADAPTERINFO_GET
ADL_Adapter_AdapterInfo_Get
;
ADL_ADAPTER_XSCREENINFO_GET
ADL_Adapter_XScreenInfo_Get
;
LPAdapterInfo
lpAdapterInfo
=
NULL
;
LPXScreenInfo
lpXScreenInfo
=
NULL
;
void
*
libadl_handle
=
NULL
;
Bool
success
=
False
;
int
is_adl_initialized
=
0
;
int
i
,
num_adapters
,
lpAdapterInfo_size
,
lpXScreenInfo_size
;
if
(
ddxDriverMajorVersion
)
*
ddxDriverMajorVersion
=
0
;
if
(
ddxDriverMinorVersion
)
*
ddxDriverMinorVersion
=
0
;
if
(
ddxDriverPatchVersion
)
*
ddxDriverPatchVersion
=
0
;
if
(
clientDriverName
)
*
clientDriverName
=
NULL
;
libadl_handle
=
dlopen
(
"libatiadlxx.so"
,
RTLD_LAZY
|
RTLD_GLOBAL
);
if
(
!
libadl_handle
)
goto
end
;
dlerror
();
ADL_Main_Control_Create
=
(
ADL_MAIN_CONTROL_CREATE
)
dlsym
(
libadl_handle
,
"ADL_Main_Control_Create"
);
if
(
dlerror
())
goto
end
;
ADL_Main_Control_Destroy
=
(
ADL_MAIN_CONTROL_DESTROY
)
dlsym
(
libadl_handle
,
"ADL_Main_Control_Destroy"
);
if
(
dlerror
())
goto
end
;
ADL_Adapter_NumberOfAdapters_Get
=
(
ADL_ADAPTER_NUMBEROFADAPTERS_GET
)
dlsym
(
libadl_handle
,
"ADL_Adapter_NumberOfAdapters_Get"
);
if
(
dlerror
())
goto
end
;
ADL_Adapter_AdapterInfo_Get
=
(
ADL_ADAPTER_ADAPTERINFO_GET
)
dlsym
(
libadl_handle
,
"ADL_Adapter_AdapterInfo_Get"
);
if
(
dlerror
())
goto
end
;
ADL_Adapter_XScreenInfo_Get
=
(
ADL_ADAPTER_XSCREENINFO_GET
)
dlsym
(
libadl_handle
,
"ADL_Adapter_XScreenInfo_Get"
);
if
(
dlerror
())
goto
end
;
if
(
ADL_Main_Control_Create
(
ADL_Main_Memory_Alloc
,
1
)
!=
ADL_OK
)
goto
end
;
is_adl_initialized
=
1
;
if
(
ADL_Adapter_NumberOfAdapters_Get
(
&
num_adapters
)
!=
ADL_OK
)
goto
end
;
if
(
num_adapters
<=
0
)
goto
end
;
lpAdapterInfo_size
=
num_adapters
*
sizeof
(
*
lpAdapterInfo
);
lpAdapterInfo
=
ADL_Main_Memory_Alloc
(
lpAdapterInfo_size
);
if
(
!
lpAdapterInfo
)
goto
end
;
memset
(
lpAdapterInfo
,
0
,
lpAdapterInfo_size
);
for
(
i
=
0
;
i
<
num_adapters
;
i
++
)
lpAdapterInfo
[
i
].
iSize
=
sizeof
(
lpAdapterInfo
[
i
]);
lpXScreenInfo_size
=
num_adapters
*
sizeof
(
*
lpXScreenInfo
);
lpXScreenInfo
=
ADL_Main_Memory_Alloc
(
lpXScreenInfo_size
);
if
(
!
lpXScreenInfo
)
goto
end
;
memset
(
lpXScreenInfo
,
0
,
lpXScreenInfo_size
);
if
(
ADL_Adapter_AdapterInfo_Get
(
lpAdapterInfo
,
lpAdapterInfo_size
)
!=
ADL_OK
)
goto
end
;
if
(
ADL_Adapter_XScreenInfo_Get
(
lpXScreenInfo
,
lpXScreenInfo_size
)
!=
ADL_OK
)
goto
end
;
for
(
i
=
0
;
i
<
num_adapters
;
i
++
)
{
LPXScreenInfo
const
lpCurrXScreenInfo
=
&
lpXScreenInfo
[
i
];
LPAdapterInfo
const
lpCurrAdapterInfo
=
&
lpAdapterInfo
[
i
];
if
(
!
lpCurrAdapterInfo
->
iPresent
)
continue
;
#if 0
printf("Adapter %d:\n", i);
printf(" iAdapterIndex: %d\n", lpCurrAdapterInfo->iAdapterIndex);
printf(" strUDID: '%s'\n", lpCurrAdapterInfo->strUDID);
printf(" iBusNumber: %d\n", lpCurrAdapterInfo->iBusNumber);
printf(" iDeviceNumber: %d\n", lpCurrAdapterInfo->iDeviceNumber);
printf(" iFunctionNumber: %d\n", lpCurrAdapterInfo->iFunctionNumber);
printf(" iVendorID: 0x%04x\n", lpCurrAdapterInfo->iVendorID);
printf(" strAdapterName: '%s'\n", lpCurrAdapterInfo->strAdapterName);
printf(" strDisplayName: '%s'\n", lpCurrAdapterInfo->strDisplayName);
printf(" iPresent: %d\n", lpCurrAdapterInfo->iPresent);
printf(" iXScreenNum: %d\n", lpCurrXScreenInfo->iXScreenNum);
#endif
if
(
match_display
(
dpy
,
lpCurrAdapterInfo
->
strDisplayName
)
&&
screen
==
lpCurrXScreenInfo
->
iXScreenNum
)
{
*
clientDriverName
=
strdup
(
"fglrx"
);
break
;
}
}
success
=
True
;
end:
if
(
lpXScreenInfo
)
ADL_Main_Memory_Free
(
&
lpXScreenInfo
);
if
(
lpAdapterInfo
)
ADL_Main_Memory_Free
(
&
lpAdapterInfo
);
if
(
is_adl_initialized
)
ADL_Main_Control_Destroy
();
if
(
libadl_handle
)
dlclose
(
libadl_handle
);
return
success
;
}
va/x11/va_fglrx.h
0 → 100644
View file @
2224d4c7
/*
* Copyright (C) 2010 Splitted-Desktop Systems. 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 PRECISION INSIGHT 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 VA_FGLRX_H
#define VA_FGLRX_H
#include <X11/Xlib.h>
Bool
VA_FGLRXGetClientDriverName
(
Display
*
dpy
,
int
screen
,
int
*
ddxDriverMajorVersion
,
int
*
ddxDriverMinorVersion
,
int
*
ddxDriverPatchVersion
,
char
**
clientDriverName
);
#endif
/* VA_FGLRX_H */
va/x11/va_x11.c
View file @
2224d4c7
...
...
@@ -31,6 +31,7 @@
#include "va_dri2.h"
#include "va_dricommon.h"
#include "va_nvctrl.h"
#include "va_fglrx.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
...
...
@@ -130,6 +131,24 @@ static VAStatus va_NVCTRL_GetDriverName (
return
VA_STATUS_SUCCESS
;
}
static
VAStatus
va_FGLRX_GetDriverName
(
VADisplayContextP
pDisplayContext
,
char
**
driver_name
)
{
VADriverContextP
ctx
=
pDisplayContext
->
pDriverContext
;
int
driver_major
,
driver_minor
,
driver_patch
;
Bool
result
;
result
=
VA_FGLRXGetClientDriverName
(
ctx
->
native_dpy
,
ctx
->
x11_screen
,
&
driver_major
,
&
driver_minor
,
&
driver_patch
,
driver_name
);
if
(
!
result
)
return
VA_STATUS_ERROR_UNKNOWN
;
return
VA_STATUS_SUCCESS
;
}
static
VAStatus
va_DisplayContextGetDriverName
(
VADisplayContextP
pDisplayContext
,
char
**
driver_name
...
...
@@ -145,7 +164,8 @@ static VAStatus va_DisplayContextGetDriverName (
vaStatus
=
va_DRIGetDriverName
(
pDisplayContext
,
driver_name
);
if
(
vaStatus
!=
VA_STATUS_SUCCESS
)
vaStatus
=
va_NVCTRL_GetDriverName
(
pDisplayContext
,
driver_name
);
if
(
vaStatus
!=
VA_STATUS_SUCCESS
)
vaStatus
=
va_FGLRX_GetDriverName
(
pDisplayContext
,
driver_name
);
return
vaStatus
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment