Changeset e0ff9af8b32e6d53648344c457e8b30d55052a7f
- Timestamp:
- 16/09/07 19:40:33
(1 year ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1189964433 +0000
- git-parent:
[965b82cc765e3ad499d6c5e752cf9fa483a4875f]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1189964433 +0000
- Message:
Really fix XShm detection with remote X11 (cf [19346]):
Get correct major opcode for MIT-SHM instead of an hard-coded one that
works with some X servers (not including mine).
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r9c76726 |
re0ff9af |
|
| 117 | 117 | static IMAGE_TYPE *CreateShmImage ( vout_thread_t *, |
|---|
| 118 | 118 | Display *, EXTRA_ARGS_SHM, int, int ); |
|---|
| 119 | | static vlc_bool_t b_shm = VLC_TRUE; |
|---|
| | 119 | static int i_shm_major = 0; |
|---|
| 120 | 120 | #endif |
|---|
| 121 | 121 | |
|---|
| … | … | |
| 1066 | 1066 | |
|---|
| 1067 | 1067 | #ifdef HAVE_SYS_SHM_H |
|---|
| 1068 | | if( p_vout->p_sys->b_shm ) |
|---|
| | 1068 | if( p_vout->p_sys->i_shm_opcode ) |
|---|
| 1069 | 1069 | { |
|---|
| 1070 | 1070 | /* Display rendered image using shared memory extension */ |
|---|
| … | … | |
| 1886 | 1886 | |
|---|
| 1887 | 1887 | #ifdef HAVE_SYS_SHM_H |
|---|
| 1888 | | if( p_vout->p_sys->b_shm ) |
|---|
| | 1888 | if( p_vout->p_sys->i_shm_opcode ) |
|---|
| 1889 | 1889 | { |
|---|
| 1890 | 1890 | /* Create image using XShm extension */ |
|---|
| … | … | |
| 1902 | 1902 | } |
|---|
| 1903 | 1903 | |
|---|
| 1904 | | if( !p_vout->p_sys->b_shm || !p_pic->p_sys->p_image ) |
|---|
| | 1904 | if( !p_vout->p_sys->i_shm_opcode || !p_pic->p_sys->p_image ) |
|---|
| 1905 | 1905 | #endif /* HAVE_SYS_SHM_H */ |
|---|
| 1906 | 1906 | { |
|---|
| … | … | |
| 1920 | 1920 | |
|---|
| 1921 | 1921 | #ifdef HAVE_SYS_SHM_H |
|---|
| 1922 | | if( p_pic->p_sys->p_image && p_vout->p_sys->b_shm ) |
|---|
| | 1922 | if( p_pic->p_sys->p_image && p_vout->p_sys->i_shm_opcode ) |
|---|
| 1923 | 1923 | { |
|---|
| 1924 | 1924 | msg_Warn( p_vout, "couldn't create SHM image, disabling SHM" ); |
|---|
| 1925 | | p_vout->p_sys->b_shm = VLC_FALSE; |
|---|
| | 1925 | p_vout->p_sys->i_shm_opcode = 0; |
|---|
| 1926 | 1926 | } |
|---|
| 1927 | 1927 | #endif /* HAVE_SYS_SHM_H */ |
|---|
| … | … | |
| 2013 | 2013 | /* The order of operations is correct */ |
|---|
| 2014 | 2014 | #ifdef HAVE_SYS_SHM_H |
|---|
| 2015 | | if( p_vout->p_sys->b_shm ) |
|---|
| | 2015 | if( p_vout->p_sys->i_shm_opcode ) |
|---|
| 2016 | 2016 | { |
|---|
| 2017 | 2017 | XShmDetach( p_vout->p_sys->p_display, &p_pic->p_sys->shminfo ); |
|---|
| … | … | |
| 2614 | 2614 | |
|---|
| 2615 | 2615 | #ifdef HAVE_SYS_SHM_H |
|---|
| 2616 | | p_vout->p_sys->b_shm = 0; |
|---|
| | 2616 | p_vout->p_sys->i_shm_opcode = 0; |
|---|
| 2617 | 2617 | |
|---|
| 2618 | 2618 | if( config_GetInt( p_vout, MODULE_STRING "-shm" ) ) |
|---|
| … | … | |
| 2621 | 2621 | /* FIXME: As of 2001-03-16, XFree4 for MacOS X does not support Xshm */ |
|---|
| 2622 | 2622 | # else |
|---|
| 2623 | | p_vout->p_sys->b_shm = |
|---|
| 2624 | | ( XShmQueryExtension( p_vout->p_sys->p_display ) == True ); |
|---|
| 2625 | | if( p_vout->p_sys->b_shm ) |
|---|
| | 2623 | int major, evt, err; |
|---|
| | 2624 | |
|---|
| | 2625 | if( XQueryExtension( p_vout->p_sys->p_display, "MIT-SHM", &major, |
|---|
| | 2626 | &evt, &err ) |
|---|
| | 2627 | && XShmQueryExtension( p_vout->p_sys->p_display ) ) |
|---|
| | 2628 | p_vout->p_sys->i_shm_opcode = major; |
|---|
| | 2629 | |
|---|
| | 2630 | if( p_vout->p_sys->i_shm_opcode ) |
|---|
| 2626 | 2631 | { |
|---|
| 2627 | 2632 | int major, minor; |
|---|
| … | … | |
| 2630 | 2635 | XShmQueryVersion( p_vout->p_sys->p_display, &major, &minor, |
|---|
| 2631 | 2636 | &pixmaps ); |
|---|
| 2632 | | msg_Dbg( p_vout, "XShm video extension v%d.%d (with%s pixmaps)", |
|---|
| 2633 | | major, minor, pixmaps ? "" : "out" ); |
|---|
| | 2637 | msg_Dbg( p_vout, "XShm video extension v%d.%d " |
|---|
| | 2638 | "(with%s pixmaps, opcode: %d)", |
|---|
| | 2639 | major, minor, pixmaps ? "" : "out", |
|---|
| | 2640 | p_vout->p_sys->i_shm_opcode ); |
|---|
| 2634 | 2641 | } |
|---|
| 2635 | 2642 | |
|---|
| 2636 | 2643 | # endif |
|---|
| 2637 | 2644 | |
|---|
| 2638 | | if( !p_vout->p_sys->b_shm ) |
|---|
| | 2645 | if( !p_vout->p_sys->i_shm_opcode ) |
|---|
| 2639 | 2646 | { |
|---|
| 2640 | 2647 | msg_Warn( p_vout, "XShm video extension is unavailable" ); |
|---|
| … | … | |
| 2818 | 2825 | /* Attach shared memory segment to X server */ |
|---|
| 2819 | 2826 | XSynchronize( p_display, True ); |
|---|
| 2820 | | b_shm = VLC_TRUE; |
|---|
| | 2827 | i_shm_major = p_vout->p_sys->i_shm_opcode; |
|---|
| 2821 | 2828 | result = XShmAttach( p_display, p_shm ); |
|---|
| 2822 | | if( result == False || !b_shm ) |
|---|
| | 2829 | if( result == False || !i_shm_major ) |
|---|
| 2823 | 2830 | { |
|---|
| 2824 | 2831 | msg_Err( p_vout, "cannot attach shared memory to X server" ); |
|---|
| … | … | |
| 2933 | 2940 | * (they happen when a window is not yet mapped) */ |
|---|
| 2934 | 2941 | return 0; |
|---|
| 2935 | | |
|---|
| 2936 | | case 150: /* MIT-SHM */ |
|---|
| 2937 | | case 146: /* MIT-SHM too, what gives? */ |
|---|
| 2938 | | if( event->minor_code == X_ShmAttach ) |
|---|
| 2939 | | { |
|---|
| 2940 | | b_shm = VLC_FALSE; |
|---|
| 2941 | | return 0; |
|---|
| 2942 | | } |
|---|
| 2943 | | break; |
|---|
| 2944 | | } |
|---|
| | 2942 | } |
|---|
| | 2943 | |
|---|
| | 2944 | if( event->request_code == i_shm_major ) /* MIT-SHM */ |
|---|
| | 2945 | return i_shm_major = 0; |
|---|
| 2945 | 2946 | |
|---|
| 2946 | 2947 | XSetErrorHandler(NULL); |
|---|
| r6ee1e19 |
re0ff9af |
|
| 108 | 108 | vlc_bool_t b_altfullscreen; /* which fullscreen method */ |
|---|
| 109 | 109 | #ifdef HAVE_SYS_SHM_H |
|---|
| 110 | | vlc_bool_t b_shm; /* shared memory extension flag */ |
|---|
| | 110 | vlc_bool_t i_shm_opcode; /* shared memory extension opcode */ |
|---|
| 111 | 111 | #endif |
|---|
| 112 | 112 | |
|---|