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
06d54f63
Commit
06d54f63
authored
Jun 02, 2010
by
Xiang, Haihao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libva: update DRI2 to support swapbuffer
parent
8af77b87
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
16 deletions
+102
-16
va/x11/dri2_util.c
va/x11/dri2_util.c
+18
-10
va/x11/va_dri2.c
va/x11/va_dri2.c
+42
-0
va/x11/va_dri2.h
va/x11/va_dri2.h
+5
-3
va/x11/va_dri2str.h
va/x11/va_dri2str.h
+37
-3
No files found.
va/x11/dri2_util.c
View file @
06d54f63
...
@@ -35,6 +35,8 @@ struct dri2_drawable
...
@@ -35,6 +35,8 @@ struct dri2_drawable
int
front_index
;
int
front_index
;
};
};
static
int
gsDRI2SwapAvailable
;
static
struct
dri_drawable
*
static
struct
dri_drawable
*
dri2CreateDrawable
(
VADriverContextP
ctx
,
XID
x_drawable
)
dri2CreateDrawable
(
VADriverContextP
ctx
,
XID
x_drawable
)
{
{
...
@@ -68,15 +70,21 @@ dri2SwapBuffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
...
@@ -68,15 +70,21 @@ dri2SwapBuffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
XserverRegion
region
;
XserverRegion
region
;
if
(
dri2_drawable
->
has_backbuffer
)
{
if
(
dri2_drawable
->
has_backbuffer
)
{
xrect
.
x
=
0
;
if
(
gsDRI2SwapAvailable
)
{
xrect
.
y
=
0
;
CARD64
ret
;
xrect
.
width
=
dri2_drawable
->
width
;
VA_DRI2SwapBuffers
(
ctx
->
x11_dpy
,
dri_drawable
->
x_drawable
,
0
,
0
,
xrect
.
height
=
dri2_drawable
->
height
;
0
,
&
ret
);
}
else
{
region
=
XFixesCreateRegion
(
ctx
->
x11_dpy
,
&
xrect
,
1
);
xrect
.
x
=
0
;
VA_DRI2CopyRegion
(
ctx
->
x11_dpy
,
dri_drawable
->
x_drawable
,
region
,
xrect
.
y
=
0
;
DRI2BufferFrontLeft
,
DRI2BufferBackLeft
);
xrect
.
width
=
dri2_drawable
->
width
;
XFixesDestroyRegion
(
ctx
->
x11_dpy
,
region
);
xrect
.
height
=
dri2_drawable
->
height
;
region
=
XFixesCreateRegion
(
ctx
->
x11_dpy
,
&
xrect
,
1
);
VA_DRI2CopyRegion
(
ctx
->
x11_dpy
,
dri_drawable
->
x_drawable
,
region
,
DRI2BufferFrontLeft
,
DRI2BufferBackLeft
);
XFixesDestroyRegion
(
ctx
->
x11_dpy
,
region
);
}
}
}
}
}
...
@@ -91,7 +99,6 @@ dri2GetRenderingBuffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
...
@@ -91,7 +99,6 @@ dri2GetRenderingBuffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
i
=
0
;
i
=
0
;
attachments
[
i
++
]
=
__DRI_BUFFER_BACK_LEFT
;
attachments
[
i
++
]
=
__DRI_BUFFER_BACK_LEFT
;
attachments
[
i
++
]
=
__DRI_BUFFER_FRONT_LEFT
;
buffers
=
VA_DRI2GetBuffers
(
ctx
->
x11_dpy
,
dri_drawable
->
x_drawable
,
buffers
=
VA_DRI2GetBuffers
(
ctx
->
x11_dpy
,
dri_drawable
->
x_drawable
,
&
dri2_drawable
->
width
,
&
dri2_drawable
->
height
,
&
dri2_drawable
->
width
,
&
dri2_drawable
->
height
,
attachments
,
i
,
&
count
);
attachments
,
i
,
&
count
);
...
@@ -179,6 +186,7 @@ isDRI2Connected(VADriverContextP ctx, char **driver_name)
...
@@ -179,6 +186,7 @@ isDRI2Connected(VADriverContextP ctx, char **driver_name)
dri_state
->
swapBuffer
=
dri2SwapBuffer
;
dri_state
->
swapBuffer
=
dri2SwapBuffer
;
dri_state
->
getRenderingBuffer
=
dri2GetRenderingBuffer
;
dri_state
->
getRenderingBuffer
=
dri2GetRenderingBuffer
;
dri_state
->
close
=
dri2Close
;
dri_state
->
close
=
dri2Close
;
gsDRI2SwapAvailable
=
(
minor
>=
2
);
return
True
;
return
True
;
...
...
va/x11/va_dri2.c
View file @
06d54f63
...
@@ -305,3 +305,45 @@ void VA_DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
...
@@ -305,3 +305,45 @@ void VA_DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
UnlockDisplay
(
dpy
);
UnlockDisplay
(
dpy
);
SyncHandle
();
SyncHandle
();
}
}
static
void
load_swap_req
(
xDRI2SwapBuffersReq
*
req
,
CARD64
target
,
CARD64
divisor
,
CARD64
remainder
)
{
req
->
target_msc_hi
=
target
>>
32
;
req
->
target_msc_lo
=
target
&
0xffffffff
;
req
->
divisor_hi
=
divisor
>>
32
;
req
->
divisor_lo
=
divisor
&
0xffffffff
;
req
->
remainder_hi
=
remainder
>>
32
;
req
->
remainder_lo
=
remainder
&
0xffffffff
;
}
static
CARD64
vals_to_card64
(
CARD32
lo
,
CARD32
hi
)
{
return
(
CARD64
)
hi
<<
32
|
lo
;
}
void
VA_DRI2SwapBuffers
(
Display
*
dpy
,
XID
drawable
,
CARD64
target_msc
,
CARD64
divisor
,
CARD64
remainder
,
CARD64
*
count
)
{
XExtDisplayInfo
*
info
=
DRI2FindDisplay
(
dpy
);
xDRI2SwapBuffersReq
*
req
;
xDRI2SwapBuffersReply
rep
;
XextSimpleCheckExtension
(
dpy
,
info
,
va_dri2ExtensionName
);
LockDisplay
(
dpy
);
GetReq
(
DRI2SwapBuffers
,
req
);
req
->
reqType
=
info
->
codes
->
major_opcode
;
req
->
dri2ReqType
=
X_DRI2SwapBuffers
;
req
->
drawable
=
drawable
;
load_swap_req
(
req
,
target_msc
,
divisor
,
remainder
);
_XReply
(
dpy
,
(
xReply
*
)
&
rep
,
0
,
xFalse
);
*
count
=
vals_to_card64
(
rep
.
swap_lo
,
rep
.
swap_hi
);
UnlockDisplay
(
dpy
);
SyncHandle
();
}
va/x11/va_dri2.h
View file @
06d54f63
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#ifndef _VA_DRI2_H_
#ifndef _VA_DRI2_H_
#define _VA_DRI2_H_
#define _VA_DRI2_H_
#include <X11/Xproto.h>
#include <X11/extensions/Xfixes.h>
#include <X11/extensions/Xfixes.h>
#include <X11/Xfuncproto.h>
#include <X11/Xfuncproto.h>
#include <xf86drm.h>
#include <xf86drm.h>
...
@@ -63,9 +64,10 @@ VA_DRI2GetBuffers(Display *dpy, XID drawable,
...
@@ -63,9 +64,10 @@ VA_DRI2GetBuffers(Display *dpy, XID drawable,
int
*
width
,
int
*
height
,
int
*
width
,
int
*
height
,
unsigned
int
*
attachments
,
int
count
,
unsigned
int
*
attachments
,
int
count
,
int
*
outCount
);
int
*
outCount
);
#if 0
extern
void
extern
void
VA_DRI2CopyRegion
(
Display
*
dpy
,
XID
drawable
,
XserverRegion
region
,
VA_DRI2CopyRegion
(
Display
*
dpy
,
XID
drawable
,
XserverRegion
region
,
CARD32 dest, CARD32 src);
CARD32
dest
,
CARD32
src
);
#endif
extern
void
VA_DRI2SwapBuffers
(
Display
*
dpy
,
XID
drawable
,
CARD64
target_msc
,
CARD64
divisor
,
CARD64
remainder
,
CARD64
*
count
);
#endif
#endif
va/x11/va_dri2str.h
View file @
06d54f63
...
@@ -35,11 +35,11 @@
...
@@ -35,11 +35,11 @@
#define DRI2_NAME "DRI2"
#define DRI2_NAME "DRI2"
#define DRI2_MAJOR 1
#define DRI2_MAJOR 1
#define DRI2_MINOR
0
#define DRI2_MINOR
2
#define DRI2NumberErrors 0
#define DRI2NumberErrors 0
#define DRI2NumberEvents
0
#define DRI2NumberEvents
2
#define DRI2NumberRequests
7
#define DRI2NumberRequests
13
#define X_DRI2QueryVersion 0
#define X_DRI2QueryVersion 0
#define X_DRI2Connect 1
#define X_DRI2Connect 1
...
@@ -48,6 +48,12 @@
...
@@ -48,6 +48,12 @@
#define X_DRI2DestroyDrawable 4
#define X_DRI2DestroyDrawable 4
#define X_DRI2GetBuffers 5
#define X_DRI2GetBuffers 5
#define X_DRI2CopyRegion 6
#define X_DRI2CopyRegion 6
#define X_DRI2GetBuffersWithFormat 7
#define X_DRI2SwapBuffers 8
#define X_DRI2GetMSC 9
#define X_DRI2WaitMSC 10
#define X_DRI2WaitSBC 11
#define X_DRI2SwapInterval 12
typedef
struct
{
typedef
struct
{
CARD32
attachment
B32
;
CARD32
attachment
B32
;
...
@@ -190,4 +196,32 @@ typedef struct {
...
@@ -190,4 +196,32 @@ typedef struct {
}
xDRI2CopyRegionReply
;
}
xDRI2CopyRegionReply
;
#define sz_xDRI2CopyRegionReply 32
#define sz_xDRI2CopyRegionReply 32
typedef
struct
{
CARD8
reqType
;
CARD8
dri2ReqType
;
CARD16
length
B16
;
CARD32
drawable
B32
;
CARD32
target_msc_hi
B32
;
CARD32
target_msc_lo
B32
;
CARD32
divisor_hi
B32
;
CARD32
divisor_lo
B32
;
CARD32
remainder_hi
B32
;
CARD32
remainder_lo
B32
;
}
xDRI2SwapBuffersReq
;
#define sz_xDRI2SwapBuffersReq 32
typedef
struct
{
BYTE
type
;
/* X_Reply */
BYTE
pad1
;
CARD16
sequenceNumber
B16
;
CARD32
length
B32
;
CARD32
swap_hi
B32
;
CARD32
swap_lo
B32
;
CARD32
pad2
B32
;
CARD32
pad3
B32
;
CARD32
pad4
B32
;
CARD32
pad5
B32
;
}
xDRI2SwapBuffersReply
;
#define sz_xDRI2SwapBuffersReply 32
#endif
#endif
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