annotate libvo/vo_directfb2.c @ 9343:5ac2ce9c0462

-lm needed for svgalib
author gabucino
date Sat, 08 Feb 2003 13:47:19 +0000
parents 554e6aa7da5f
children edfe34c5405d
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;
8640
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
265 #if DIRECTFBVERSION > 915
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
266 case IMGFMT_RGB15: return DSPF_ARGB1555; break;
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
267 case IMGFMT_BGR15: return DSPF_ARGB1555; break;
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
268 #else
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
269 case IMGFMT_RGB15: return DSPF_RGB15; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
270 case IMGFMT_BGR15: return DSPF_RGB15; break;
8640
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
271 #endif
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
272 case IMGFMT_YUY2: return DSPF_YUY2; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
273 case IMGFMT_UYVY: return DSPF_UYVY; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
274 case IMGFMT_YV12: return DSPF_YV12; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
275 case IMGFMT_I420: return DSPF_I420; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
276 // case IMGFMT_IYUV: return DSPF_IYUV; break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
277 default: return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
278 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
279 return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
280 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
281
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
282 typedef struct enum1_s {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
283 uint32_t format;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
284 int scale;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
285 int result;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
286 unsigned int id;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
287 unsigned int width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
288 unsigned int height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
289 int setsize;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
290 } enum1_t;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
291
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
292 DFBEnumerationResult test_format_callback( unsigned int id,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
293 DFBDisplayLayerDescription desc,
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
294 void *data)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
295 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
296 enum1_t *params =(enum1_t *)data;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
297 IDirectFBDisplayLayer *layer;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
298 DFBResult ret;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
299
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
300 if ((layer_id == -1 )||(layer_id == id)) {
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
301
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
302 ret = dfb->GetDisplayLayer( dfb, id, &layer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
303 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
304 DirectFBError( "dfb->GetDisplayLayer failed", ret );
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
305 return DFENUM_OK;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
306 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
307 DFBDisplayLayerConfig dlc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
308
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
309 if (params->setsize) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
310 dlc.flags = DLCONF_WIDTH |DLCONF_HEIGHT;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
311 dlc.width = params->width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
312 dlc.height = params->height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
313 layer->SetConfiguration(layer,&dlc);
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
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
316
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
317 dlc.flags = DLCONF_PIXELFORMAT;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
318 dlc.pixelformat = convformat(params->format);
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 layer->SetOpacity(layer,0);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
321 ret = layer->TestConfiguration(layer,&dlc,NULL);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
322
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
323 layer->Release(layer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
324
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
325 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
326
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
327 if (!ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
328 // printf("Test OK\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
329 if (params->result) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
330 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
331 params->scale=1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
332 params->id=id;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
333 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
334
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
335 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
336 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
337 params->result=1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
338 params->id=id;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
339 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
340 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
341 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
342 };
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
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
345 };
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
346
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
347 return DFENUM_OK;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
348 }
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 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
351 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
352 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
353 enum1_t params;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
354
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
355
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
356 if (!convformat(format)) return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
357 // temporary disable YV12
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
358 // if (format == IMGFMT_YV12) return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
359 // if (format == IMGFMT_I420) return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
360 if (format == IMGFMT_IYUV) return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
361
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
362 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
363
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
364 params.format=format;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
365 params.scale=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
366 params.result=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
367 params.setsize=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
368
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
369 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
370
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
371 if (params.result) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
372 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
373 return ret;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
374 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
375
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
376 return 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
377 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
378
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
379 typedef struct videomode_s {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
380 int width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
381 int height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
382 int out_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
383 int out_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
384 int overx;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
385 int overy;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
386 int bpp;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
387 } videomode_t;
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
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
390 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
391 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
392 videomode_t *params =(videomode_t *)data;
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 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
395 int we_are_under=0;
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 (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
398
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
399 overx=width-params->out_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
400 overy=height-params->out_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
401
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
402 if (!params->width) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
403 params->width=width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
404 params->height=height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
405 params->overx=overx;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
406 params->overy=overy;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
407 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
408 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
409
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
410 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
411 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
412 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
413 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
414 params->width=width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
415 params->height=height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
416 params->overx=overx;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
417 params->overy=overy;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
418 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
419 };
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 return DFENUM_OK;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
422 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
423
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
424 #define CONFIG_ERROR -1
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 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
427 uint32_t d_height, uint32_t fullscreen, char *title,
7272
fcbe94c83ff6 config() parameters change
zdar
parents: 6985
diff changeset
428 uint32_t format)
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
429 {
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 * (Locals)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
432 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
433
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
434 // decode flags
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 int fs = fullscreen & 0x01;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
437 int vm = fullscreen & 0x02;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
438 int zoom = fullscreen & 0x04;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
439 int flip = fullscreen & 0x08;
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 DFBSurfaceDescription dsc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
442 DFBResult ret;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
443 DFBDisplayLayerConfig dlc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
444 DFBSurfaceCapabilities caps;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
445
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
446 enum1_t params;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
447
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
448 if (verbose) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
449 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
450 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
451 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
452 // initial clean-up
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
453 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
454 frame->Release(frame);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
455 frame=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 (primary) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
459 primary->Release(primary);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
460 primary=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 if (layer) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
464 layer->Release(layer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
465 layer=NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
466 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
467
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
468
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
469 // vm things
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
470
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
471 if (vm) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
472 videomode_t params;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
473 params.out_width=d_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
474 params.out_height=d_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
475 params.width=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
476 params.height=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
477 switch (format) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
478 case IMGFMT_RGB32:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
479 case IMGFMT_BGR32:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
480 params.bpp=32;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
481 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
482 case IMGFMT_RGB24:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
483 case IMGFMT_BGR24:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
484 params.bpp=24;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
485 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
486 case IMGFMT_RGB16:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
487 case IMGFMT_BGR16:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
488 case IMGFMT_RGB15:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
489 case IMGFMT_BGR15:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
490 params.bpp=16;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
491 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
492 default: params.bpp=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
493
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
494 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
495 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
496 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
497 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
498 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
499 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
500 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
501 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
502 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
503 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
504 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
505 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
506 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
507 }
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 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
510 } // vm end
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
511
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
512 // find best layer
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
513
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
514 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
515 params.format=format;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
516 params.scale=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
517 params.result=0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
518 params.width=s_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
519 params.height=s_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
520 params.setsize=1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
521
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
522 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
523
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
524 if (!params.result) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
525 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
526 params.id = DLID_PRIMARY;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
527 }
6985
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
528 /* 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
529 params.id=2;
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
530 params.scale=0;
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
531 params.result=1;
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
532 */
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
533 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
534
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 // try to setp-up proper configuration
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
537
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
538
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
539 DFBCHECK (dfb->GetDisplayLayer( dfb, params.id, &layer));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
540
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
541 if (params.scale) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
542 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
543 dlc.flags = DLCONF_WIDTH | DLCONF_HEIGHT;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
544 dlc.width = s_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
545 dlc.height = s_height;
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 ret = layer->SetConfiguration(layer,&dlc);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
548
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
549 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
550
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
551 }
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 dlc.flags = DLCONF_PIXELFORMAT;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
554 dlc.pixelformat = convformat(params.format);
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 // printf("DirectFB: Format [%x]\n",dlc.pixelformat);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
557
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
558 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
559 ret = layer->SetConfiguration(layer,&dlc);
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 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
562 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
563 return CONFIG_ERROR;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
564 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
565
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
566
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
567 // flipping of layer
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
568
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
569 dlc.flags = DLCONF_BUFFERMODE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
570 dlc.buffermode = DLBM_BACKVIDEO;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
571 ret = layer->SetConfiguration( layer, &dlc );
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
572 if (ret!=DFB_OK) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
573 dlc.buffermode = DLBM_BACKSYSTEM;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
574 ret = layer->SetConfiguration( layer, &dlc );
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
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
577 // get layer surface
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
578
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
579 ret = layer->GetSurface(layer,&primary);
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 if (ret) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
582 printf("DirectFB: ConfigError in obtaining surface\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
583 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
584 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
585
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
586 // test surface for flipping
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
587 DFBCHECK(primary->GetCapabilities(primary,&caps));
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
588 #if DIRECTFBVERSION > 913
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
589 primary->Clear(primary,0,0,0,0);
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
590 #endif
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
591 flipping = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
592 if (caps & DSCAPS_FLIPPING) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
593 ret = primary->Flip(primary,NULL,0);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
594 if (ret==DFB_OK) {
8137
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
595 #if DIRECTFBVERSION > 913
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
596 primary->Clear(primary,0,0,0,0);
530d1c5f0c78 Switch containing options for DirectFB library was renamed to dfbopts.
arpi
parents: 7272
diff changeset
597 #endif
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
598 flipping = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
599 }
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 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
603
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
604 // 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
605
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 // get surface size
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
608 DFBCHECK(primary->GetSize(primary,&width,&height));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
609
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
610 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
611
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
612 aspect_save_orig(s_width,s_height);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
613 aspect_save_prescale(d_width,d_height);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
614 if (params.scale) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
615 aspect_save_screenres(10000,10000);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
616 aspect(&out_width,&out_height,A_ZOOM);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
617
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
618 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
619
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
620 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
621
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
622 xoffset = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
623 yoffset = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
624
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
625 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
626
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
627 aspect_save_screenres(width,height);
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 if(fs) /* -fs */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
630 aspect(&out_width,&out_height,A_ZOOM);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
631 else
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
632 aspect(&out_width,&out_height,A_NOZOOM);
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
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
635 xoffset = (width - out_width) / 2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
636 yoffset = (height - out_height) / 2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
637 }
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 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
640 stretch = 0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
641 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
642 stretch = 1;
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
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 // 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
647 if ((!flipping) || stretch) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
648
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
649 DFBCHECK (primary->GetPixelFormat (primary, &dsc.pixelformat));
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 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
652
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
653 dsc.width = s_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
654 dsc.height = s_height;
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 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &frame));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
657 DFBCHECK(frame->GetSize(frame,&width,&height));
6985
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
658 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
659 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
660
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
661 // 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
662 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
663 DFBCHECK (frame->GetPixelFormat(frame,&pixel_format));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
664 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
665 DFBCHECK (primary->GetPixelFormat(primary,&pixel_format));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
666 };
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 // finally turn on layer
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
669 layer->SetOpacity(layer,255);
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 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
672
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
673 return 0;
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
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
676 extern void mplayer_put_key(int code);
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 #include "../linux/keycodes.h"
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 static void check_events(void)
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
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
683 if (buffer) {
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 DFBInputEvent event;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
686
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
687 //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
688 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
689
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
690 if (event.type == DIET_KEYPRESS) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
691 switch (event.key_symbol) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
692 case DIKS_ESCAPE:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
693 mplayer_put_key('q');
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
694 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
695 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
696 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
697 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
698 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
699 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
700 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
701 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
702 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
703 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
704 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
705
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
706 default:mplayer_put_key(event.key_symbol);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
707 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
708 };
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 // 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
711 // and this causes problems during seek)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
712 // 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
713 buffer->Reset(buffer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
714
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 //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
717 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
718
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
719 static void flip_page(void)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
720 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
721 DFBSurfaceBlittingFlags flags=DSBLIT_NOFX;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
722
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
723 unlock(); // unlock frame & primary
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
724
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
725 // if (verbose) printf("DirectFB: Flip page entered");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
726
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
727 DFBCHECK (primary->SetBlittingFlags(primary,flags));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
728
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
729 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
730 if (stretch) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
731 DFBRectangle rect;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
732 rect.x=xoffset;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
733 rect.y=yoffset;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
734 rect.w=out_width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
735 rect.h=out_height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
736
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
737 DFBCHECK (primary->StretchBlit(primary,frame,NULL,&rect));
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 } else {
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 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
742
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
743 };
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 if (flipping) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
748 DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC));
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
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
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 static void uninit(void)
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 if (verbose ) printf("DirectFB: Uninit entered\n");
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 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
761
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
762 /*
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
763 * (Release)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
764 */
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
765 if (verbose ) printf("DirectFB: Release buffer\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
766 if (buffer) buffer->Release (buffer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
767 if (verbose ) printf("DirectFB: Release keyboard\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
768 if (keyboard) keyboard->Release (keyboard);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
769 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
770 if (verbose ) printf("DirectFB: Release frame\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
771 frame->Release (frame);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
772 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
773
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
774 if (verbose ) printf("DirectFB: Release primary\n");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
775 if (primary) primary->Release (primary);
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 // switch off BES
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
778 // if (layer) layer->SetOpacity(layer,0);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
779
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
780 if (layer) layer->Release(layer);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
781
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
782 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
783
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
784 dfb->Release (dfb);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
785
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
786 if (verbose ) printf("DirectFB: Uninit done.\n");
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
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
789
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
790 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
791 {
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 DFBColorAdjustment ca;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
794 float factor = (float)0xffff / 200.0;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
795
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
796 DFBDisplayLayerDescription desc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
797
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
798 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
799
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
800 if (layer) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
801
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
802 layer->GetDescription(layer,&desc);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
803
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
804 ca.flags=DCAF_NONE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
805
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
806 if (! strcmp( data,"brightness" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
807 if (desc.caps & DLCAPS_BRIGHTNESS) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
808 ca.brightness = value * factor +0x8000;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
809 ca.flags |= DCAF_BRIGHTNESS;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
810 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
811 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
812 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
813
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
814 if (! strcmp( data,"contrast" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
815 if ((desc.caps & DLCAPS_CONTRAST)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
816 ca.contrast = value * factor + 0x8000;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
817 ca.flags |= DCAF_CONTRAST;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
818 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
819 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
820 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
821
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
822 if (! strcmp( data,"hue" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
823 if ((desc.caps & DLCAPS_HUE)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
824 ca.hue = value * factor + 0x8000;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
825 ca.flags |= DCAF_HUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
826 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
827 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
828 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
829
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
830 if (! strcmp( data,"saturation" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
831 if ((desc.caps & DLCAPS_SATURATION)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
832 ca.saturation = value * factor + 0x8000;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
833 ca.flags |= DCAF_SATURATION;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
834 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
835 } else return VO_FALSE;
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 if (ca.flags != DCAF_NONE) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
839 layer->SetColorAdjustment(layer,&ca);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
840 return VO_TRUE;
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
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
844 return VO_FALSE;
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 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
847
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
848 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
849 {
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 DFBColorAdjustment ca;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
852 float factor = 200.0 / (float)0xffff;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
853
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
854 DFBDisplayLayerDescription desc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
855
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
856 if (layer) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
857
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
858 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
859
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
860 layer->GetDescription(layer,&desc);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
861
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
862 layer->GetColorAdjustment(layer,&ca);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
863
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
864 if (! strcmp( data,"brightness" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
865 if (desc.caps & DLCAPS_BRIGHTNESS) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
866 *value = (int) ((ca.brightness-0x8000) * factor);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
867 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
868 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
869 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
870 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
871
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
872 if (! strcmp( data,"contrast" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
873 if ((desc.caps & DLCAPS_CONTRAST)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
874 *value = (int) ((ca.contrast-0x8000) * factor);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
875 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
876 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
877 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
878 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
879
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
880 if (! strcmp( data,"hue" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
881 if ((desc.caps & DLCAPS_HUE)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
882 *value = (int) ((ca.hue-0x8000) * factor);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
883 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
884 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
885 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
886 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
887
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
888 if (! strcmp( data,"saturation" )) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
889 if ((desc.caps & DLCAPS_SATURATION)) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
890 *value = (int) ((ca.saturation-0x8000) * factor);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
891 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
892 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
893 } else return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
894 }
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 return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
897 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
898
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
899 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
900 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
901
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
902 int err;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
903 void *dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
904 int pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
905
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
906 // 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
907 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
908 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
909
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
910 // 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
911
6985
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
912 if((mpi->width==pitch) ||
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
913 (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
914 // 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
915
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
916 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
917 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
918 framelocked=1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
919 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
920 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
921 primarylocked=1;
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 (err) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
925 if (verbose) printf("DirectFB: DR lock failed!");
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
926 return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
927 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
928
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
929 if(mpi->flags&MP_IMGFLAG_PLANAR){
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
930 //YV12 format
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
931 mpi->planes[0]=dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
932 if(mpi->flags&MP_IMGFLAG_SWAPPED){
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
933 mpi->planes[1]=dst + pitch*height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
934 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
935 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
936 mpi->planes[2]=dst + pitch*height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
937 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
938 }
6985
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
939 mpi->width=width;
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
940 mpi->stride[0]=pitch;
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
941 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
942 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
943 //YUY2 and RGB formats
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
944 mpi->planes[0]=dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
945 mpi->width=width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
946 mpi->stride[0]=pitch;
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 mpi->flags|=MP_IMGFLAG_DIRECT;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
949 // 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
950 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
951
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 return VO_FALSE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
954 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
955
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
956 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
957 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
958 int i;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
959 unsigned int pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
960 void *dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
961 void *dst2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
962 void *srcp;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
963 unsigned int p;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
964
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
965 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
966
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
967 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
968 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
969 framelocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
970 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
971 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
972 primarylocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
973 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
974
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
975 p=min(w,pitch);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
976
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
977 dst += y*pitch + x;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
978 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
979 srcp = src[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 for (i=0;i<h;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
982 memcpy(dst,srcp,p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
983 dst += pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
984 srcp += stride[0];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
985 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
986
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
987 if (pixel_format == DSPF_YV12) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
988
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
989 dst = dst2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
990 srcp = src[2];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
991 p = p/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 for (i=0;i<h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
994 memcpy(dst,srcp,p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
995 dst += pitch/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
996 srcp += stride[2];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
997 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
998
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
999 dst = dst2 + pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1000 srcp = src[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 for (i=0;i<h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1003 memcpy(dst,srcp,p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1004 dst += pitch/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1005 srcp += stride[1];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1006 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1007
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1008 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1009
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1010 dst = dst2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1011 srcp = src[1];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1012 p = p/2;
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 for (i=0;i<h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1015 memcpy(dst,srcp,p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1016 dst += pitch/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1017 srcp += stride[1];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1018 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1019
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1020 dst = dst2 + pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1021 srcp = src[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 for (i=0;i<h/2;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1024 memcpy(dst,srcp,p);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1025 dst += pitch/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1026 srcp += stride[2];
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
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 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1032
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1033 return 0;
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
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1036
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1037 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
1038
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1039
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1040 static IDirectFBSurface *tmp = NULL;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1041 DFBSurfaceDescription dsc;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1042 DFBRectangle rect;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1043
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1044 // 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
1045
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1046 unlock();
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 // already out?
6985
6074119e09a0 Put/get_image fixed. Deleted forgotten development comments
zdar
parents: 6952
diff changeset
1049 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
1050 // 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
1051 return VO_TRUE;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1052 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1053
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1054 if (mpi->flags&MP_IMGFLAG_PLANAR) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1055 // memcpy all planes - sad but necessary
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1056 int i;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1057 unsigned int pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1058 void *dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1059 void *src;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1060 unsigned int p;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1061
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1062 // 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
1063 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1064 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
1065 framelocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1066 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1067 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
1068 primarylocked = 1;
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
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1071 p=min(mpi->w,pitch);
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 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
1074
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1075 for (i=0;i<mpi->h;i++) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1076 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
1077 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1078
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1079 if (pixel_format == DSPF_YV12) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1080
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1081 dst += pitch*height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1082 p = p/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1083 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
1084
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1085 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
1086 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
1087 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1088
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1089 dst += pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1090 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
1091
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1092 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
1093 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
1094 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1095
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1096 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1097
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1098 dst += pitch*height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1099 p = p/2;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1100 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
1101
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1102 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
1103 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
1104 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1105
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1106 dst += pitch*height/4;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1107 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
1108
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1109 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
1110 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
1111 }
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 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1114 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1115
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1116 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1117
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1118 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
1119 dsc.preallocated[0].data = mpi->planes[0];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1120 dsc.preallocated[0].pitch = mpi->stride[0];
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1121 dsc.width = mpi->width;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1122 dsc.height = mpi->height;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1123 dsc.pixelformat = convformat(mpi->imgfmt);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1124
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1125 DFBCHECK (dfb->CreateSurface( dfb, &dsc, &tmp));
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 rect.x=mpi->x;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1128 rect.y=mpi->y;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1129 rect.w=mpi->w;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1130 rect.h=mpi->h;
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 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1133 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
1134 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1135 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
1136 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1137 tmp->Release(tmp);
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 return VO_TRUE;
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
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1142
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1143
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1144 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
1145 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1146 switch (request) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1147 case VOCTRL_QUERY_FORMAT:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1148 return query_format(*((uint32_t*)data));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1149 case VOCTRL_GET_IMAGE:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1150 return get_image(data);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1151 case VOCTRL_DRAW_IMAGE:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1152 return put_image(data);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1153 case VOCTRL_SET_EQUALIZER:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1154 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1155 va_list ap;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1156 int value;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1157
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1158 va_start(ap, data);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1159 value = va_arg(ap, int);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1160 va_end(ap);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1161
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1162 return(directfb_set_video_eq(data, 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 case VOCTRL_GET_EQUALIZER:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1165 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1166 va_list ap;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1167 int *value;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1168
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1169 va_start(ap, data);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1170 value = va_arg(ap, int*);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1171 va_end(ap);
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 return(directfb_get_video_eq(data, value));
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1174 }
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 return VO_NOTIMPL;
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
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1179 // unused function
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 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
1182 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1183 return -1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1184 }
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 // hopefully will be removed soon
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1187
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1188 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
1189 unsigned char *srca, int stride)
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 void *dst;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1192 int pitch;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1193
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1194 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
1195
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1196 if (frame) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1197 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
1198 framelocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1199 } else {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1200 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
1201 primarylocked = 1;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1202 };
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1203
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1204 switch(pixel_format) {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1205 case DSPF_RGB32:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1206 case DSPF_ARGB:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1207 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
1208 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1209
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1210 case DSPF_RGB24:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1211 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
1212 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1213
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1214 case DSPF_RGB16:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1215 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
1216 break;
8640
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
1217 #if DIRECTFBVERSION > 915
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
1218 case DSPF_ARGB1555:
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
1219 #else
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1220 case DSPF_RGB15:
8640
554e6aa7da5f fix to compile with DirecFB 0.9.16
zdar
parents: 8148
diff changeset
1221 #endif
6952
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1222 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
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_YUY2:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1226 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
1227 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1228
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1229 case DSPF_UYVY:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1230 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
1231 break;
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 case DSPF_I420:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1234 case DSPF_YV12:
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1235 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
1236 break;
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1237 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1238
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1239 unlock();
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1240 }
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1241
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1242 static void draw_osd(void)
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1243 {
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1244 vo_draw_text(width,height,draw_alpha);
fc505cbab7ce new directfb driver for 0.9.13+ by jiri.svoboda@seznam.cz
arpi
parents:
diff changeset
1245 }