Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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
vlc-2-2
Commits
e44eb2ad
Commit
e44eb2ad
authored
Sep 27, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XCB: don't bother X server with drawing requests if we are not visible
parent
904882f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
17 deletions
+32
-17
modules/video_output/xcb/events.c
modules/video_output/xcb/events.c
+17
-11
modules/video_output/xcb/x11.c
modules/video_output/xcb/x11.c
+7
-2
modules/video_output/xcb/xcb_vlc.h
modules/video_output/xcb/xcb_vlc.h
+1
-1
modules/video_output/xcb/xvideo.c
modules/video_output/xcb/xvideo.c
+7
-3
No files found.
modules/video_output/xcb/events.c
View file @
e44eb2ad
...
...
@@ -74,6 +74,13 @@ static void HandleMotionNotify (vout_display_t *vd,
vout_display_SendEventMouseMoved
(
vd
,
x
,
y
);
}
static
void
HandleVisibilityNotify
(
vout_display_t
*
vd
,
bool
*
visible
,
const
xcb_visibility_notify_event_t
*
ev
)
{
*
visible
=
ev
->
state
!=
XCB_VISIBILITY_FULLY_OBSCURED
;
msg_Dbg
(
vd
,
"display is %svisible"
,
*
visible
?
""
:
"not "
);
}
static
void
HandleParentStructure
(
vout_display_t
*
vd
,
const
xcb_configure_notify_event_t
*
ev
)
...
...
@@ -86,8 +93,8 @@ HandleParentStructure (vout_display_t *vd,
/**
* Process an X11 event.
*/
static
int
ProcessEvent
(
vout_display_t
*
vd
,
xcb_
window_t
window
,
xcb_
generic_event_t
*
ev
)
static
int
ProcessEvent
(
vout_display_t
*
vd
,
bool
*
visible
,
xcb_generic_event_t
*
ev
)
{
switch
(
ev
->
response_type
&
0x7f
)
{
...
...
@@ -103,15 +110,14 @@ static int ProcessEvent (vout_display_t *vd,
HandleMotionNotify
(
vd
,
(
xcb_motion_notify_event_t
*
)
ev
);
break
;
case
XCB_
CONFIGURE
_NOTIFY
:
{
xcb_configure_notify_event_t
*
cn
=
(
xcb_configure_notify_event_t
*
)
ev
;
case
XCB_
VISIBILITY
_NOTIFY
:
HandleVisibilityNotify
(
vd
,
visible
,
(
xcb_visibility_notify_event_t
*
)
ev
);
break
;
assert
(
cn
->
window
!=
window
);
HandleParentStructure
(
vd
,
cn
);
case
XCB_CONFIGURE_NOTIFY
:
HandleParentStructure
(
vd
,
(
xcb_configure_notify_event_t
*
)
ev
);
break
;
}
/* FIXME I am not sure it is the right one */
case
XCB_DESTROY_NOTIFY
:
...
...
@@ -132,12 +138,12 @@ static int ProcessEvent (vout_display_t *vd,
/**
* Process incoming X events.
*/
int
ManageEvent
(
vout_display_t
*
vd
,
xcb_connection_t
*
conn
,
xcb_window_t
window
)
int
ManageEvent
(
vout_display_t
*
vd
,
xcb_connection_t
*
conn
,
bool
*
visible
)
{
xcb_generic_event_t
*
ev
;
while
((
ev
=
xcb_poll_for_event
(
conn
))
!=
NULL
)
ProcessEvent
(
vd
,
window
,
ev
);
ProcessEvent
(
vd
,
visible
,
ev
);
if
(
xcb_connection_has_error
(
conn
))
{
...
...
modules/video_output/xcb/x11.c
View file @
e44eb2ad
...
...
@@ -79,6 +79,7 @@ struct vout_display_sys_t
xcb_window_t
window
;
/* drawable X window */
xcb_gcontext_t
gc
;
/* context to put images */
bool
shm
;
/* whether to use MIT-SHM */
bool
visible
;
/* whether to draw */
uint8_t
bpp
;
/* bits per pixel */
uint8_t
pad
;
/* scanline pad */
uint8_t
depth
;
/* useful bits per pixel */
...
...
@@ -256,7 +257,7 @@ static int Open (vlc_object_t *obj)
const
uint32_t
values
[]
=
{
/* XCB_CW_EVENT_MASK */
XCB_EVENT_MASK_BUTTON_PRESS
|
XCB_EVENT_MASK_BUTTON_RELEASE
|
XCB_EVENT_MASK_POINTER_MOTION
,
XCB_EVENT_MASK_POINTER_MOTION
|
XCB_EVENT_MASK_VISIBILITY_CHANGE
,
/* XCB_CW_COLORMAP */
cmap
,
};
...
...
@@ -276,6 +277,7 @@ static int Open (vlc_object_t *obj)
}
msg_Dbg
(
vd
,
"using X11 window %08"
PRIx32
,
p_sys
->
window
);
msg_Dbg
(
vd
,
"using X11 graphic context %08"
PRIx32
,
p_sys
->
gc
);
p_sys
->
visible
=
false
;
/* */
vout_display_info_t
info
=
vd
->
info
;
...
...
@@ -391,6 +393,8 @@ static void Display (vout_display_t *vd, picture_t *pic)
xcb_shm_seg_t
segment
=
pic
->
p_sys
->
segment
;
xcb_void_cookie_t
ck
;
if
(
!
p_sys
->
visible
)
goto
out
;
if
(
segment
!=
0
)
ck
=
xcb_shm_put_image_checked
(
p_sys
->
conn
,
p_sys
->
window
,
p_sys
->
gc
,
/* real width */
pic
->
p
->
i_pitch
/
pic
->
p
->
i_pixel_pitch
,
...
...
@@ -427,6 +431,7 @@ static void Display (vout_display_t *vd, picture_t *pic)
/* FIXME might be WAY better to wait in some case (be carefull with
* VOUT_DISPLAY_RESET_PICTURES if done) + does not work with
* vout_display wrapper. */
out:
picture_Release
(
pic
);
}
...
...
@@ -516,7 +521,7 @@ static void Manage (vout_display_t *vd)
{
vout_display_sys_t
*
p_sys
=
vd
->
sys
;
ManageEvent
(
vd
,
p_sys
->
conn
,
p_sys
->
window
);
ManageEvent
(
vd
,
p_sys
->
conn
,
&
p_sys
->
visible
);
}
static
void
ResetPictures
(
vout_display_t
*
vd
)
...
...
modules/video_output/xcb/xcb_vlc.h
View file @
e44eb2ad
...
...
@@ -29,7 +29,7 @@
#include <vlc_picture.h>
#include <vlc_vout_display.h>
int
ManageEvent
(
vout_display_t
*
vd
,
xcb_connection_t
*
conn
,
xcb_window_t
window
);
int
ManageEvent
(
vout_display_t
*
vd
,
xcb_connection_t
*
conn
,
bool
*
);
/* keys.c */
typedef
struct
key_handler_t
key_handler_t
;
...
...
modules/video_output/xcb/xvideo.c
View file @
e44eb2ad
...
...
@@ -93,6 +93,7 @@ struct vout_display_sys_t
uint16_t
height
;
/* display height */
uint32_t
data_size
;
/* picture byte size (for non-SHM) */
bool
shm
;
/* whether to use MIT-SHM */
bool
visible
;
/* whether it makes sense to draw at all */
xcb_xv_query_image_attributes_reply_t
*
att
;
picture_pool_t
*
pool
;
/* picture pool */
...
...
@@ -440,7 +441,7 @@ static int Open (vlc_object_t *obj)
const
uint32_t
mask
=
/* XCB_CW_EVENT_MASK */
XCB_EVENT_MASK_BUTTON_PRESS
|
XCB_EVENT_MASK_BUTTON_RELEASE
|
XCB_EVENT_MASK_POINTER_MOTION
;
XCB_EVENT_MASK_POINTER_MOTION
|
XCB_EVENT_MASK_VISIBILITY_CHANGE
;
xcb_void_cookie_t
c
;
xcb_window_t
window
=
xcb_generate_id
(
conn
);
...
...
@@ -468,6 +469,7 @@ static int Open (vlc_object_t *obj)
XCB_CONFIG_WINDOW_WIDTH
|
XCB_CONFIG_WINDOW_HEIGHT
,
values
);
}
p_sys
->
visible
=
false
;
/* Create graphic context */
p_sys
->
gc
=
xcb_generate_id
(
conn
);
...
...
@@ -613,6 +615,8 @@ static void Display (vout_display_t *vd, picture_t *pic)
xcb_shm_seg_t
segment
=
pic
->
p_sys
->
segment
;
xcb_void_cookie_t
ck
;
if
(
!
p_sys
->
visible
)
goto
out
;
if
(
segment
)
ck
=
xcb_xv_shm_put_image_checked
(
p_sys
->
conn
,
p_sys
->
port
,
p_sys
->
window
,
p_sys
->
gc
,
segment
,
p_sys
->
id
,
0
,
...
...
@@ -642,7 +646,7 @@ static void Display (vout_display_t *vd, picture_t *pic)
msg_Dbg
(
vd
,
"%s: X11 error %d"
,
"cannot put image"
,
e
->
error_code
);
free
(
e
);
}
out:
picture_Release
(
pic
);
}
...
...
@@ -727,6 +731,6 @@ static void Manage (vout_display_t *vd)
{
vout_display_sys_t
*
p_sys
=
vd
->
sys
;
ManageEvent
(
vd
,
p_sys
->
conn
,
p_sys
->
window
);
ManageEvent
(
vd
,
p_sys
->
conn
,
&
p_sys
->
visible
);
}
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