annotate libvo/vo_directfb2.c @ 8410:9efd0c6e6307

fullscreen fix for KDE (reported to work with gnome 1/2 too) patch by "Puk Madick" <pingy@swirvemail.com>
author arpi
date Sun, 08 Dec 2002 01:35:07 +0000
parents 5b39e79af5fe
children 554e6aa7da5f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
2 MPlayer video driver for DirectFramebuffer device
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
3
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
4 (C) 2002
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
5
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
6 Written by Jiri Svoboda <Jiri.Svoboda@seznam.cz>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
7
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
8 This library is free software; you can redistribute it and/or
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
9 modify it under the terms of the GNU Lesser General Public
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
10 License as published by the Free Software Foundation; either
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
11 version 2 of the License, or (at your option) any later version.
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
12
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
13 This library is distributed in the hope that it will be useful,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
16 Lesser General Public License for more details.
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
17
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
18 You should have received a copy of the GNU Lesser General Public
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
19 License along with this library; if not, write to the
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
20 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
21 Boston, MA 02111-1307, USA.
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
22 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
23
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
24 // directfb includes
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
25
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
26 #include <directfb.h>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
27
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
28 // other things
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
29
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
30 #include <stdio.h>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
31 #include <stdlib.h>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
32 #include <string.h>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
33 #include <fcntl.h>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
34 #include <unistd.h>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
35 #include <errno.h>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
36 #include <ctype.h>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
37 #include <assert.h>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
38
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
39 #include <sys/mman.h>
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
40 #include <sys/ioctl.h>
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
41 #ifdef __linux__
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
42 #include <sys/kd.h>
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
43 #else
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
44 #include <linux/kd.h>
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
45 #endif
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
46
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
47 #include "config.h"
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
48 #include "video_out.h"
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
49 #include "video_out_internal.h"
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
50 #include "fastmemcpy.h"
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
51 #include "sub.h"
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
52
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
53 #include "aspect.h"
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
54
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
55 #ifndef min
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
56 #define min(x,y) (((x)<(y))?(x):(y))
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
57 #endif
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
58
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
59
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 8137
diff changeset
60 static vo_info_t info = {
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
61 "Direct Framebuffer Device",
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
62 "directfb",
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
63 "Jiri Svoboda Jiri.Svoboda@seznam.cz",
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
64 "v 2.0 (for DirectFB version >=0.9.13)"
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
65 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
66
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 8137
diff changeset
67 LIBVO_EXTERN(directfb)
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 8137
diff changeset
68
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
69 extern int verbose;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
70
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
71 /******************************
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
72 * vo_directfb globals *
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
73 ******************************/
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
74
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
75 #define DFBCHECK(x...) \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
76 { \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
77 DFBResult err = x; \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
78 \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
79 if (err != DFB_OK) \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
80 { \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
81 fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
82 DirectFBErrorFatal( #x, err ); \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
83 } \
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
84 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
85
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
86 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
87 * filled by preinit
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
88 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
89
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
90 // main DirectFB handle
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
91 static IDirectFB *dfb = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
92 // keyboard handle
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
93 static IDirectFBInputDevice *keyboard = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
94 // A buffer for input events.
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
95 static IDirectFBEventBuffer *buffer = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
96
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
97 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
98 * filled during config
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
99 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
100
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
101 // handle of used layer
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
102 static IDirectFBDisplayLayer *layer = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
103 // surface of used layer
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
104 static IDirectFBSurface *primary = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
105 static int primarylocked = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
106 // handle of temporary surface (if used)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
107 static IDirectFBSurface *frame = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
108 static int framelocked = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
109 // flipping mode flag (layer/surface)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
110 static int flipping = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
111 // scaling flag
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
112 static int stretch = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
113 // pictrure position
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
114 static int xoffset=0,yoffset=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
115 // picture size
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
116 static int out_width=0,out_height=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
117 // frame/primary size
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
118 static int width=0,height=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
119 // frame primary format
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
120 DFBSurfacePixelFormat pixel_format;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
121 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
122 static void (*draw_alpha_p)(int w, int h, unsigned char *src,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
123 unsigned char *srca, int stride, unsigned char *dst,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
124 int dstride);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
125 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
126
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
127 /******************************
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
128 * cmd line parameteres *
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
129 ******************************/
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
130
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
131 /* command line/config file options */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
132 #ifdef HAVE_FBDEV
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
133 extern char *fb_dev_name;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
134 #else
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
135 char *fb_dev_name;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
136 #endif
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
137 char *dfb_params;
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
138 int layer_id = -1;
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
139
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
140 /******************************
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
141 * implementation *
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
142 ******************************/
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
143
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
144 void unlock() {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
145 if (frame && framelocked) frame->Unlock(frame);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
146 if (primary && primarylocked) primary->Unlock(primary);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
147 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
148
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
149
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
150 static uint32_t preinit(const char *arg)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
151 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
152
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
153 DFBResult ret;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
154
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
155 if (verbose) printf("DirectFB: Preinit entered\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
156
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
157 if (arg) {
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
158 int tmp=-1;
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
159 if (sscanf(arg,"%i",&tmp)) {
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
160 layer_id=tmp;
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
161 if (verbose) printf("DirectFB: Layer id forced to %i\n",layer_id);
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
162 };
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
163 }
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
164
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
165 if (dfb_params)
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
166 {
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
167 int argc = 2;
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
168 char arg0[10] = "mplayer";
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
169 char arg1[256] = "--dfb:";
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
170 char* argv[3];
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
171 char ** a;
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
172
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
173 a = &argv[0];
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
174
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
175 strncat(arg1,dfb_params,249);
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
176
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
177 argv[0]=arg0;
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
178 argv[1]=arg1;
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
179 argv[2]=NULL;
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
180
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
181 DFBCHECK (DirectFBInit (&argc,&a));
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
182
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
183 } else {
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
184
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
185 DFBCHECK (DirectFBInit (NULL,NULL));
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
186 }
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
187
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
188 if (((directfb_major_version <= 0) &&
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
189 (directfb_minor_version <= 9) &&
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
190 (directfb_micro_version < 13)))
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
191 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
192 printf("DirectFB: Unsupported DirectFB version\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
193 return 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
194 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
195
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
196 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
197 * (set options)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
198 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
199
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
200 if (!fb_dev_name && !(fb_dev_name = getenv("FRAMEBUFFER"))) fb_dev_name = "/dev/fb0";
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
201 DFBCHECK (DirectFBSetOption ("fbdev",fb_dev_name));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
202
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
203 // uncomment this if you do not wish to create a new vt for DirectFB
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
204 // DFBCHECK (DirectFBSetOption ("no-vt-switch",""));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
205
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
206 // uncomment this if you want to allow vt switching
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
207 // DFBCHECK (DirectFBSetOption ("vt-switching",""));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
208
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
209 // uncomment this if you want to hide gfx cursor (req dfb >=0.9.9)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
210 DFBCHECK (DirectFBSetOption ("no-cursor",""));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
211
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
212 // bg color fix
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
213 DFBCHECK (DirectFBSetOption ("bg-color","00000000"));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
214
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
215 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
216 * (Initialize)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
217 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
218
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
219 DFBCHECK (DirectFBCreate (&dfb));
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
220 if (DFB_OK != dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)) {
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
221 printf("DirectFB: Warning - cannot swith to fullscreen mode");
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
222 };
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
223
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
224 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
225 * (Get keyboard)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
226 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
227
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
228 ret = dfb->GetInputDevice (dfb, DIDID_KEYBOARD, &keyboard);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
229
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
230 if (ret==DFB_OK) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
231 if (verbose) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
232 printf("DirectFB: Keyboard init OK\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
233 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
234 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
235 keyboard = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
236 printf("DirectFB: Keyboard init FAILED\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
237 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
238
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
239 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
240 * Create an input buffer for the keyboard.
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
241 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
242 if (keyboard) DFBCHECK (keyboard->CreateEventBuffer (keyboard, &buffer));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
243
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
244 // just to start with clean ...
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
245 if (buffer) buffer->Reset(buffer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
246
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
247 if (verbose) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
248 printf("DirectFB: Preinit OK\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
249 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
250
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
251 return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
252
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
253 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
254
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
255 DFBSurfacePixelFormat convformat(uint32_t format)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
256 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
257 // add more formats !!!
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
258 switch (format) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
259 case IMGFMT_RGB32: return DSPF_RGB32; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
260 case IMGFMT_BGR32: return DSPF_RGB32; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
261 case IMGFMT_RGB24: return DSPF_RGB24; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
262 case IMGFMT_BGR24: return DSPF_RGB24; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
263 case IMGFMT_RGB16: return DSPF_RGB16; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
264 case IMGFMT_BGR16: return DSPF_RGB16; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
265 case IMGFMT_RGB15: return DSPF_RGB15; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
266 case IMGFMT_BGR15: return DSPF_RGB15; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
267 case IMGFMT_YUY2: return DSPF_YUY2; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
268 case IMGFMT_UYVY: return DSPF_UYVY; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
269 case IMGFMT_YV12: return DSPF_YV12; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
270 case IMGFMT_I420: return DSPF_I420; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
271 // case IMGFMT_IYUV: return DSPF_IYUV; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
272 default: return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
273 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
274 return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
275 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
276
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
277 typedef struct enum1_s {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
278 uint32_t format;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
279 int scale;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
280 int result;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
281 unsigned int id;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
282 unsigned int width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
283 unsigned int height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
284 int setsize;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
285 } enum1_t;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
286
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
287 DFBEnumerationResult test_format_callback( unsigned int id,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
288 DFBDisplayLayerDescription desc,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
289 void *data)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
290 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
291 enum1_t *params =(enum1_t *)data;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
292 IDirectFBDisplayLayer *layer;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
293 DFBResult ret;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
294
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
295 if ((layer_id == -1 )||(layer_id == id)) {
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
296
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
297 ret = dfb->GetDisplayLayer( dfb, id, &layer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
298 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
299 DirectFBError( "dfb->GetDisplayLayer failed", ret );
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
300 return DFENUM_OK;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
301 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
302 DFBDisplayLayerConfig dlc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
303
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
304 if (params->setsize) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
305 dlc.flags = DLCONF_WIDTH |DLCONF_HEIGHT;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
306 dlc.width = params->width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
307 dlc.height = params->height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
308 layer->SetConfiguration(layer,&dlc);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
309 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
310
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
311
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
312 dlc.flags = DLCONF_PIXELFORMAT;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
313 dlc.pixelformat = convformat(params->format);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
314
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
315 layer->SetOpacity(layer,0);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
316 ret = layer->TestConfiguration(layer,&dlc,NULL);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
317
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
318 layer->Release(layer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
319
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
320 if (verbose) printf("DirectFB: Test format - layer %i scale/pos %i\n",id,(desc.caps & DLCAPS_SCREEN_LOCATION));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
321
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
322 if (!ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
323 // printf("Test OK\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
324 if (params->result) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
325 if ((!params->scale) && (desc.caps & DLCAPS_SCREEN_LOCATION)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
326 params->scale=1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
327 params->id=id;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
328 if (verbose) printf("DirectFB: Test format - added layer %i scale/pos %i\n",id,(desc.caps & DLCAPS_SCREEN_LOCATION));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
329
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
330 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
331 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
332 params->result=1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
333 params->id=id;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
334 if (desc.caps & DLCAPS_SCREEN_LOCATION) params->scale=1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
335 if (verbose) printf("DirectFB: Test format - added layer %i scale/pos %i\n",id,(desc.caps & DLCAPS_SCREEN_LOCATION));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
336 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
337 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
338 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
339
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
340 };
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
341
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
342 return DFENUM_OK;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
343 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
344
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
345 static uint32_t query_format(uint32_t format)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
346 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
347 int ret = VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_OSD; // osd should be removed in future -> will be handled outside...
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
348 enum1_t params;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
349
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
350
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
351 if (!convformat(format)) return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
352 // temporary disable YV12
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
353 // if (format == IMGFMT_YV12) return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
354 // if (format == IMGFMT_I420) return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
355 if (format == IMGFMT_IYUV) return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
356
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
357 if (verbose) printf("DirectFB: Format query: %s\n",vo_format_name(format));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
358
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
359 params.format=format;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
360 params.scale=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
361 params.result=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
362 params.setsize=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
363
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
364 DFBCHECK (dfb->EnumDisplayLayers(dfb,test_format_callback,&params));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
365
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
366 if (params.result) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
367 if (params.scale) ret |=VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
368 return ret;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
369 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
370
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
371 return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
372 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
373
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
374 typedef struct videomode_s {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
375 int width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
376 int height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
377 int out_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
378 int out_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
379 int overx;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
380 int overy;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
381 int bpp;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
382 } videomode_t;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
383
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
384
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
385 DFBEnumerationResult video_modes_callback( unsigned int width,unsigned int height,unsigned int bpp, void *data)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
386 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
387 videomode_t *params =(videomode_t *)data;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
388
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
389 int overx=0,overy=0,closer=0,over=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
390 int we_are_under=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
391
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
392 if (verbose) printf("DirectFB: Validator entered %i %i %i\n",width,height,bpp);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
393
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
394 overx=width-params->out_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
395 overy=height-params->out_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
396
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
397 if (!params->width) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
398 params->width=width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
399 params->height=height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
400 params->overx=overx;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
401 params->overy=overy;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
402 if (verbose) printf("DirectFB: Mode added %i %i %i\n",width,height,bpp);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
403 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
404
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
405 if ((params->overy<0)||(params->overx<0)) we_are_under=1; // stored mode is smaller than req mode
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
406 if (abs(overx*overy)<abs(params->overx * params->overy)) closer=1; // current mode is closer to desired res
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
407 if ((overx>=0)&&(overy>=0)) over=1; // current mode is bigger or equaul to desired res
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
408 if ((closer && (over || we_are_under)) || (we_are_under && over)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
409 params->width=width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
410 params->height=height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
411 params->overx=overx;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
412 params->overy=overy;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
413 if (verbose) printf("DirectFB: Better mode added %i %i %i\n",width,height,bpp);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
414 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
415
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
416 return DFENUM_OK;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
417 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
418
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
419 #define CONFIG_ERROR -1
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
420
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
421 static uint32_t config(uint32_t s_width, uint32_t s_height, uint32_t d_width,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
422 uint32_t d_height, uint32_t fullscreen, char *title,
7272
fcbe94c83ff6 config() parameters change
zdar
parents: 6985
diff changeset
423 uint32_t format)
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
424 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
425 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
426 * (Locals)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
427 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
428
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
429 // decode flags
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
430
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
431 int fs = fullscreen & 0x01;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
432 int vm = fullscreen & 0x02;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
433 int zoom = fullscreen & 0x04;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
434 int flip = fullscreen & 0x08;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
435
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
436 DFBSurfaceDescription dsc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
437 DFBResult ret;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
438 DFBDisplayLayerConfig dlc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
439 DFBSurfaceCapabilities caps;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
440
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
441 enum1_t params;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
442
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
443 if (verbose) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
444 printf("DirectFB: Config entered [%ix%i]\n",s_width,s_height);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
445 printf("DirectFB: With requested format: %s\n",vo_format_name(format));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
446 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
447 // initial clean-up
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
448 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
449 frame->Release(frame);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
450 frame=NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
451 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
452
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
453 if (primary) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
454 primary->Release(primary);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
455 primary=NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
456 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
457
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
458 if (layer) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
459 layer->Release(layer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
460 layer=NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
461 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
462
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
463
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
464 // vm things
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
465
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
466 if (vm) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
467 videomode_t params;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
468 params.out_width=d_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
469 params.out_height=d_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
470 params.width=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
471 params.height=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
472 switch (format) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
473 case IMGFMT_RGB32:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
474 case IMGFMT_BGR32:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
475 params.bpp=32;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
476 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
477 case IMGFMT_RGB24:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
478 case IMGFMT_BGR24:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
479 params.bpp=24;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
480 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
481 case IMGFMT_RGB16:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
482 case IMGFMT_BGR16:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
483 case IMGFMT_RGB15:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
484 case IMGFMT_BGR15:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
485 params.bpp=16;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
486 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
487 default: params.bpp=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
488
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
489 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
490 if (verbose) printf("DirectFB: Config - videomode change\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
491 DFBCHECK (dfb->EnumVideoModes(dfb,video_modes_callback,&params));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
492 ret=dfb->SetVideoMode(dfb,params.width,params.height,params.bpp);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
493 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
494 ret=dfb->SetVideoMode(dfb,params.width,params.height,24);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
495 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
496 ret=dfb->SetVideoMode(dfb,params.width,params.height,32);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
497 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
498 ret=dfb->SetVideoMode(dfb,params.width,params.height,16);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
499 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
500 ret=dfb->SetVideoMode(dfb,params.width,params.height,8);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
501 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
502 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
503 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
504 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
505 } // vm end
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
506
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
507 // find best layer
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
508
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
509 if (verbose) printf("DirectFB: Config - find suitable layer\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
510 params.format=format;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
511 params.scale=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
512 params.result=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
513 params.width=s_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
514 params.height=s_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
515 params.setsize=1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
516
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
517 DFBCHECK (dfb->EnumDisplayLayers(dfb,test_format_callback,&params));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
518
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
519 if (!params.result) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
520 printf("DirectFB: ConfigError - no suitable layer found\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
521 params.id = DLID_PRIMARY;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
522 }
6985
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
523 /* Uncomment following if you want to use tvout on CRTC2 (requieres patch for DirectFB from Ville Syrjala)
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
524 params.id=2;
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
525 params.scale=0;
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
526 params.result=1;
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
527 */
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
528 if (verbose) printf("DirectFB: Config - layer %i\n",params.id);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
529
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
530
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
531 // try to setp-up proper configuration
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
532
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
533
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
534 DFBCHECK (dfb->GetDisplayLayer( dfb, params.id, &layer));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
535
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
536 if (params.scale) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
537 if (verbose) printf("DirectFB: Config - set layer config (size)\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
538 dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
539 dlc.width = s_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
540 dlc.height = s_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
541
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
542 ret = layer->SetConfiguration(layer,&dlc);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
543
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
544 if (ret && (params.scale || verbose)) printf("DirectFB: ConfigError in layer configuration (size)\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
545
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
546 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
547
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
548 dlc.flags = DLCONF_PIXELFORMAT;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
549 dlc.pixelformat = convformat(params.format);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
550
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
551 // printf("DirectFB: Format [%x]\n",dlc.pixelformat);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
552
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
553 if (verbose) printf("DirectFB: Config - set layer config (format)\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
554 ret = layer->SetConfiguration(layer,&dlc);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
555
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
556 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
557 printf("DirectFB: ConfigError in layer configuration (format)\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
558 return CONFIG_ERROR;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
559 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
560
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
561
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
562 // flipping of layer
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
563
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
564 dlc.flags = DLCONF_BUFFERMODE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
565 dlc.buffermode = DLBM_BACKVIDEO;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
566 ret = layer->SetConfiguration( layer, &dlc );
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
567 if (ret!=DFB_OK) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
568 dlc.buffermode = DLBM_BACKSYSTEM;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
569 ret = layer->SetConfiguration( layer, &dlc );
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
570 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
571
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
572 // get layer surface
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
573
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
574 ret = layer->GetSurface(layer,&primary);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
575
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
576 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
577 printf("DirectFB: ConfigError in obtaining surface\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
578 return CONFIG_ERROR; // what shall we report on fail?
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
579 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
580
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
581 // test surface for flipping
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
582 DFBCHECK(primary->GetCapabilities(primary,&caps));
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
583 #if DIRECTFBVERSION > 913
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
584 primary->Clear(primary,0,0,0,0);
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
585 #endif
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
586 flipping = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
587 if (caps & DSCAPS_FLIPPING) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
588 ret = primary->Flip(primary,NULL,0);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
589 if (ret==DFB_OK) {
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
590 #if DIRECTFBVERSION > 913
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
591 primary->Clear(primary,0,0,0,0);
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
592 #endif
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
593 flipping = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
594 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
595 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
596
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
597 if (verbose) printf("DirectFB: Config - flipping = %i\n",flipping);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
598
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
599 // is scale needed ? Aspect ratio and layer pos/size
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
600
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
601
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
602 // get surface size
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
603 DFBCHECK(primary->GetSize(primary,&width,&height));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
604
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
605 if (verbose) printf("DirectFB: Config - surface size = %ix%i\n",width,height);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
606
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
607 aspect_save_orig(s_width,s_height);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
608 aspect_save_prescale(d_width,d_height);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
609 if (params.scale) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
610 aspect_save_screenres(10000,10000);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
611 aspect(&out_width,&out_height,A_ZOOM);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
612
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
613 ret = layer->SetScreenLocation(layer,(1-(float)out_width/10000)/2,(1-(float)out_height/10000)/2,((float)out_width/10000),((float)out_height/10000));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
614
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
615 if (ret) printf("DirectFB: ConfigError in layer configuration (position)\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
616
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
617 xoffset = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
618 yoffset = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
619
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
620 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
621
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
622 aspect_save_screenres(width,height);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
623
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
624 if(fs) /* -fs */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
625 aspect(&out_width,&out_height,A_ZOOM);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
626 else
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
627 aspect(&out_width,&out_height,A_NOZOOM);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
628
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
629
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
630 xoffset = (width - out_width) / 2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
631 yoffset = (height - out_height) / 2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
632 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
633
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
634 if (((s_width==out_width)&&(s_height==out_height)) || (params.scale)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
635 stretch = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
636 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
637 stretch = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
638 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
639
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
640
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
641 // temporary buffer in case of not flipping or scaling
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
642 if ((!flipping) || stretch) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
643
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
644 DFBCHECK (primary->GetPixelFormat (primary, &dsc.pixelformat));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
645
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
646 dsc.flags = DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_WIDTH;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
647
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
648 dsc.width = s_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
649 dsc.height = s_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
650
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
651 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &frame));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
652 DFBCHECK(frame->GetSize(frame,&width,&height));
6985
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
653 if (verbose) printf("DirectFB: Frame is active.\n");
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
654 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
655
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
656 // get format for draw_alpha - should be removed soon - osd will be rendered outside vo driver
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
657 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
658 DFBCHECK (frame->GetPixelFormat(frame,&pixel_format));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
659 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
660 DFBCHECK (primary->GetPixelFormat(primary,&pixel_format));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
661 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
662
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
663 // finally turn on layer
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
664 layer->SetOpacity(layer,255);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
665
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
666 if (verbose) printf("DirectFB: Config finished [%ix%i] - [%ix%i]\n",out_width,out_height,width,height);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
667
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
668 return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
669 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
670
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
671 extern void mplayer_put_key(int code);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
672
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
673 #include "../linux/keycodes.h"
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
674
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
675 static void check_events(void)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
676 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
677
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
678 if (buffer) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
679
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
680 DFBInputEvent event;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
681
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
682 //if (verbose) printf ("DirectFB: Check events entered\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
683 if (buffer->GetEvent(buffer, DFB_EVENT (&event)) == DFB_OK) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
684
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
685 if (event.type == DIET_KEYPRESS) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
686 switch (event.key_symbol) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
687 case DIKS_ESCAPE:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
688 mplayer_put_key('q');
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
689 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
690 case DIKS_PAGE_UP: mplayer_put_key(KEY_PAGE_UP);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
691 case DIKS_PAGE_DOWN: mplayer_put_key(KEY_PAGE_DOWN);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
692 case DIKS_CURSOR_UP: mplayer_put_key(KEY_UP);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
693 case DIKS_CURSOR_DOWN: mplayer_put_key(KEY_DOWN);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
694 case DIKS_CURSOR_LEFT: mplayer_put_key(KEY_LEFT);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
695 case DIKS_CURSOR_RIGHT: mplayer_put_key(KEY_RIGHT);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
696 case DIKS_INSERT: mplayer_put_key(KEY_INSERT);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
697 case DIKS_DELETE: mplayer_put_key(KEY_DELETE);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
698 case DIKS_HOME: mplayer_put_key(KEY_HOME);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
699 case DIKS_END: mplayer_put_key(KEY_END);break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
700
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
701 default:mplayer_put_key(event.key_symbol);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
702 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
703 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
704 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
705 // empty buffer, because of repeating (keyboard repeat is faster than key handling
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
706 // and this causes problems during seek)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
707 // temporary workabout should be solved in the future
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
708 buffer->Reset(buffer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
709
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
710 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
711 //if (verbose) printf ("DirectFB: Check events finished\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
712 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
713
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
714 static void flip_page(void)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
715 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
716 DFBSurfaceBlittingFlags flags=DSBLIT_NOFX;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
717
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
718 unlock(); // unlock frame & primary
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
719
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
720 // if (verbose) printf("DirectFB: Flip page entered");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
721
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
722 DFBCHECK (primary->SetBlittingFlags(primary,flags));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
723
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
724 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
725 if (stretch) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
726 DFBRectangle rect;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
727 rect.x=xoffset;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
728 rect.y=yoffset;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
729 rect.w=out_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
730 rect.h=out_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
731
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
732 DFBCHECK (primary->StretchBlit(primary,frame,NULL,&rect));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
733
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
734 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
735
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
736 DFBCHECK (primary->Blit(primary,frame,NULL,xoffset,yoffset));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
737
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
738 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
739 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
740
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
741
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
742 if (flipping) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
743 DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
744 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
745
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
746 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
747
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
748
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
749
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
750 static void uninit(void)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
751 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
752
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
753 if (verbose ) printf("DirectFB: Uninit entered\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
754
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
755 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
756
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
757 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
758 * (Release)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
759 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
760 if (verbose ) printf("DirectFB: Release buffer\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
761 if (buffer) buffer->Release (buffer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
762 if (verbose ) printf("DirectFB: Release keyboard\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
763 if (keyboard) keyboard->Release (keyboard);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
764 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
765 if (verbose ) printf("DirectFB: Release frame\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
766 frame->Release (frame);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
767 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
768
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
769 if (verbose ) printf("DirectFB: Release primary\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
770 if (primary) primary->Release (primary);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
771
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
772 // switch off BES
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
773 // if (layer) layer->SetOpacity(layer,0);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
774
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
775 if (layer) layer->Release(layer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
776
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
777 if (verbose ) printf("DirectFB: Release DirectFB library\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
778
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
779 dfb->Release (dfb);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
780
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
781 if (verbose ) printf("DirectFB: Uninit done.\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
782 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
783
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
784
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
785 static uint32_t directfb_set_video_eq(char *data, int value) //data==name
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
786 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
787
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
788 DFBColorAdjustment ca;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
789 float factor = (float)0xffff / 200.0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
790
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
791 DFBDisplayLayerDescription desc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
792
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
793 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
794
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
795 if (layer) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
796
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
797 layer->GetDescription(layer,&desc);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
798
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
799 ca.flags=DCAF_NONE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
800
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
801 if (! strcmp( data,"brightness" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
802 if (desc.caps & DLCAPS_BRIGHTNESS) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
803 ca.brightness = value * factor +0x8000;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
804 ca.flags |= DCAF_BRIGHTNESS;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
805 if (verbose) printf("DirectFB: SetVEq Brightness 0x%X %i\n",ca.brightness,value);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
806 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
807 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
808
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
809 if (! strcmp( data,"contrast" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
810 if ((desc.caps & DLCAPS_CONTRAST)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
811 ca.contrast = value * factor + 0x8000;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
812 ca.flags |= DCAF_CONTRAST;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
813 if (verbose) printf("DirectFB: SetVEq Contrast 0x%X %i\n",ca.contrast,value);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
814 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
815 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
816
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
817 if (! strcmp( data,"hue" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
818 if ((desc.caps & DLCAPS_HUE)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
819 ca.hue = value * factor + 0x8000;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
820 ca.flags |= DCAF_HUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
821 if (verbose) printf("DirectFB: SetVEq Hue 0x%X %i\n",ca.hue,value);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
822 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
823 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
824
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
825 if (! strcmp( data,"saturation" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
826 if ((desc.caps & DLCAPS_SATURATION)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
827 ca.saturation = value * factor + 0x8000;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
828 ca.flags |= DCAF_SATURATION;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
829 if (verbose) printf("DirectFB: SetVEq Saturation 0x%X %i\n",ca.saturation,value);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
830 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
831 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
832
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
833 if (ca.flags != DCAF_NONE) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
834 layer->SetColorAdjustment(layer,&ca);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
835 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
836 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
837 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
838
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
839 return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
840
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
841 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
842
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
843 static uint32_t directfb_get_video_eq(char *data, int *value) // data==name
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
844 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
845
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
846 DFBColorAdjustment ca;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
847 float factor = 200.0 / (float)0xffff;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
848
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
849 DFBDisplayLayerDescription desc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
850
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
851 if (layer) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
852
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
853 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
854
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
855 layer->GetDescription(layer,&desc);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
856
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
857 layer->GetColorAdjustment(layer,&ca);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
858
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
859 if (! strcmp( data,"brightness" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
860 if (desc.caps & DLCAPS_BRIGHTNESS) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
861 *value = (int) ((ca.brightness-0x8000) * factor);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
862 if (verbose) printf("DirectFB: GetVEq Brightness 0x%X %i\n",ca.brightness,*value);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
863 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
864 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
865 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
866
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
867 if (! strcmp( data,"contrast" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
868 if ((desc.caps & DLCAPS_CONTRAST)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
869 *value = (int) ((ca.contrast-0x8000) * factor);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
870 if (verbose) printf("DirectFB: GetVEq Contrast 0x%X %i\n",ca.contrast,*value);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
871 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
872 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
873 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
874
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
875 if (! strcmp( data,"hue" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
876 if ((desc.caps & DLCAPS_HUE)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
877 *value = (int) ((ca.hue-0x8000) * factor);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
878 if (verbose) printf("DirectFB: GetVEq Hue 0x%X %i\n",ca.hue,*value);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
879 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
880 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
881 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
882
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
883 if (! strcmp( data,"saturation" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
884 if ((desc.caps & DLCAPS_SATURATION)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
885 *value = (int) ((ca.saturation-0x8000) * factor);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
886 if (verbose) printf("DirectFB: GetVEq Saturation 0x%X %i\n",ca.saturation,*value);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
887 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
888 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
889 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
890 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
891 return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
892 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
893
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
894 static uint32_t get_image(mp_image_t *mpi)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
895 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
896
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
897 int err;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
898 void *dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
899 int pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
900
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
901 // if (verbose) printf("DirectFB: get_image() called\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
902 if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
903 if(mpi->type==MP_IMGTYPE_STATIC) return VO_FALSE; // it is not static
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
904
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
905 // printf("width=%d vs. pitch=%d, flags=0x%X \n",mpi->width,pitch,mpi->flags);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
906
6985
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
907 if((mpi->width==pitch) ||
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
908 (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH))){
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
909 // we're lucky or codec accepts stride => ok, let's go!
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
910
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
911 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
912 err = frame->Lock(frame,DSLF_WRITE,&dst,&pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
913 framelocked=1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
914 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
915 err = primary->Lock(primary,DSLF_WRITE,&dst,&pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
916 primarylocked=1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
917 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
918
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
919 if (err) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
920 if (verbose) printf("DirectFB: DR lock failed!");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
921 return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
922 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
923
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
924 if(mpi->flags&MP_IMGFLAG_PLANAR){
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
925 //YV12 format
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
926 mpi->planes[0]=dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
927 if(mpi->flags&MP_IMGFLAG_SWAPPED){
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
928 mpi->planes[1]=dst + pitch*height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
929 mpi->planes[2]=mpi->planes[1] + pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
930 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
931 mpi->planes[2]=dst + pitch*height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
932 mpi->planes[1]=mpi->planes[2] + pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
933 }
6985
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
934 mpi->width=width;
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
935 mpi->stride[0]=pitch;
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
936 mpi->stride[1]=mpi->stride[2]=pitch/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
937 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
938 //YUY2 and RGB formats
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
939 mpi->planes[0]=dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
940 mpi->width=width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
941 mpi->stride[0]=pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
942 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
943 mpi->flags|=MP_IMGFLAG_DIRECT;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
944 // if (verbose) printf("DirectFB: get_image() SUCCESS -> Direct Rendering ENABLED\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
945 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
946
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
947 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
948 return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
949 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
950
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
951 static uint32_t draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
952 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
953 int i;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
954 unsigned int pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
955 void *dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
956 void *dst2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
957 void *srcp;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
958 unsigned int p;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
959
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
960 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
961
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
962 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
963 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
964 framelocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
965 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
966 DFBCHECK (primary->Lock(primary,DSLF_WRITE,&dst,&pitch));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
967 primarylocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
968 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
969
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
970 p=min(w,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
971
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
972 dst += y*pitch + x;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
973 dst2 = dst + pitch*height - y*pitch + y*pitch/4 - x/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
974 srcp = src[0];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
975
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
976 for (i=0;i<h;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
977 memcpy(dst,srcp,p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
978 dst += pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
979 srcp += stride[0];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
980 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
981
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
982 if (pixel_format == DSPF_YV12) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
983
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
984 dst = dst2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
985 srcp = src[2];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
986 p = p/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
987
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
988 for (i=0;i<h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
989 memcpy(dst,srcp,p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
990 dst += pitch/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
991 srcp += stride[2];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
992 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
993
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
994 dst = dst2 + pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
995 srcp = src[1];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
996
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
997 for (i=0;i<h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
998 memcpy(dst,srcp,p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
999 dst += pitch/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1000 srcp += stride[1];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1001 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1002
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1003 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1004
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1005 dst = dst2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1006 srcp = src[1];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1007 p = p/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1008
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1009 for (i=0;i<h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1010 memcpy(dst,srcp,p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1011 dst += pitch/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1012 srcp += stride[1];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1013 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1014
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1015 dst = dst2 + pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1016 srcp = src[2];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1017
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1018 for (i=0;i<h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1019 memcpy(dst,srcp,p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1020 dst += pitch/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1021 srcp += stride[2];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1022 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1023
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1024 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1025
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1026 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1027
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1028 return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1029 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1030
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1031
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1032 static uint32_t put_image(mp_image_t *mpi){
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1033
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1034
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1035 static IDirectFBSurface *tmp = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1036 DFBSurfaceDescription dsc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1037 DFBRectangle rect;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1038
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1039 // if (verbose) printf("DirectFB: Put_image entered %i %i %i %i %i %i\n",mpi->x,mpi->y,mpi->w,mpi->h,mpi->width,mpi->height);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1040
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1041 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1042
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1043 // already out?
6985
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
1044 if((mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))) {
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1045 // if (verbose) printf("DirectFB: Put_image - nothing todo\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1046 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1047 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1048
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1049 if (mpi->flags&MP_IMGFLAG_PLANAR) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1050 // memcpy all planes - sad but necessary
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1051 int i;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1052 unsigned int pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1053 void *dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1054 void *src;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1055 unsigned int p;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1056
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1057 // if (verbose) printf("DirectFB: Put_image - planar branch\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1058 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1059 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1060 framelocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1061 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1062 DFBCHECK (primary->Lock(primary,DSLF_WRITE,&dst,&pitch));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1063 primarylocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1064 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1065
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1066 p=min(mpi->w,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1067
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1068 src = mpi->planes[0]+mpi->y*mpi->stride[0]+mpi->x;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1069
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1070 for (i=0;i<mpi->h;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1071 memcpy(dst+i*pitch,src+i*mpi->stride[0],p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1072 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1073
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1074 if (pixel_format == DSPF_YV12) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1075
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1076 dst += pitch*height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1077 p = p/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1078 src = mpi->planes[2]+mpi->y*mpi->stride[2]+mpi->x/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1079
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1080 for (i=0;i<mpi->h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1081 memcpy(dst+i*pitch/2,src+i*mpi->stride[2],p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1082 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1083
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1084 dst += pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1085 src = mpi->planes[1]+mpi->y*mpi->stride[1]+mpi->x/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1086
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1087 for (i=0;i<mpi->h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1088 memcpy(dst+i*pitch/2,src+i*mpi->stride[1],p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1089 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1090
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1091 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1092
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1093 dst += pitch*height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1094 p = p/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1095 src = mpi->planes[1]+mpi->y*mpi->stride[1]+mpi->x/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1096
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1097 for (i=0;i<mpi->h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1098 memcpy(dst+i*pitch/2,src+i*mpi->stride[1],p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1099 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1100
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1101 dst += pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1102 src = mpi->planes[2]+mpi->y*mpi->stride[2]+mpi->x/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1103
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1104 for (i=0;i<mpi->h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1105 memcpy(dst+i*pitch/2,src+i*mpi->stride[2],p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1106 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1107
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1108 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1109 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1110
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1111 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1112
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1113 dsc.flags = DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_WIDTH | DSDESC_PREALLOCATED;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1114 dsc.preallocated[0].data = mpi->planes[0];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1115 dsc.preallocated[0].pitch = mpi->stride[0];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1116 dsc.width = mpi->width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1117 dsc.height = mpi->height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1118 dsc.pixelformat = convformat(mpi->imgfmt);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1119
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1120 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &tmp));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1121
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1122 rect.x=mpi->x;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1123 rect.y=mpi->y;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1124 rect.w=mpi->w;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1125 rect.h=mpi->h;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1126
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1127 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1128 DFBCHECK (tmp->Blit(tmp,frame,&rect,0,0));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1129 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1130 DFBCHECK (tmp->Blit(tmp,primary,&rect,xoffset,yoffset));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1131 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1132 tmp->Release(tmp);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1133 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1134 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1135 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1136
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1137
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1138
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1139 static uint32_t control(uint32_t request, void *data, ...)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1140 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1141 switch (request) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1142 case VOCTRL_QUERY_FORMAT:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1143 return query_format(*((uint32_t*)data));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1144 case VOCTRL_GET_IMAGE:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1145 return get_image(data);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1146 case VOCTRL_DRAW_IMAGE:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1147 return put_image(data);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1148 case VOCTRL_SET_EQUALIZER:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1149 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1150 va_list ap;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1151 int value;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1152
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1153 va_start(ap, data);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1154 value = va_arg(ap, int);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1155 va_end(ap);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1156
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1157 return(directfb_set_video_eq(data, value));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1158 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1159 case VOCTRL_GET_EQUALIZER:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1160 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1161 va_list ap;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1162 int *value;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1163
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1164 va_start(ap, data);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1165 value = va_arg(ap, int*);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1166 va_end(ap);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1167
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1168 return(directfb_get_video_eq(data, value));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1169 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1170 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1171 return VO_NOTIMPL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1172 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1173
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1174 // unused function
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1175
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1176 static uint32_t draw_frame(uint8_t *src[])
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1177 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1178 return -1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1179 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1180
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1181 // hopefully will be removed soon
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1182
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1183 static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1184 unsigned char *srca, int stride)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1185 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1186 void *dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1187 int pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1188
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1189 unlock(); // isnt it silly I have to unlock surface and than lock again :-)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1190
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1191 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1192 DFBCHECK (frame->Lock(frame,DSLF_WRITE,&dst,&pitch));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1193 framelocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1194 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1195 DFBCHECK (primary->Lock(primary,DSLF_WRITE,&dst,&pitch));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1196 primarylocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1197 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1198
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1199 switch(pixel_format) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1200 case DSPF_RGB32:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1201 case DSPF_ARGB:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1202 vo_draw_alpha_rgb32(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 4*x0,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1203 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1204
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1205 case DSPF_RGB24:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1206 vo_draw_alpha_rgb24(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 3*x0,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1207 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1208
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1209 case DSPF_RGB16:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1210 vo_draw_alpha_rgb16(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1211 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1212
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1213 case DSPF_RGB15:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1214 vo_draw_alpha_rgb15(w,h,src,srca,stride,((uint8_t *) dst)+pitch*y0 + 2*x0,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1215 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1216
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1217 case DSPF_YUY2:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1218 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 2*x0,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1219 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1220
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1221 case DSPF_UYVY:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1222 vo_draw_alpha_yuy2(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 2*x0 + 1,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1223 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1224
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1225 case DSPF_I420:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1226 case DSPF_YV12:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1227 vo_draw_alpha_yv12(w,h,src,srca,stride,((uint8_t *) dst) + pitch*y0 + 1*x0,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1228 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1229 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1230
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1231 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1232 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1233
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1234 static void draw_osd(void)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1235 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1236 vo_draw_text(width,height,draw_alpha);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1237 }