~ubuntu-dev/mplayer/ubuntu-feisty

« back to all changes in this revision

Viewing changes to libvo/vo_dfbmga.c

  • Committer: William Grant
  • Date: 2007-02-03 03:16:07 UTC
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: william.grant@ubuntu.org.au-20070203031607-08gc2ompbz6spt9i
Update to 1.0rc1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
   You should have received a copy of the GNU Lesser General Public
20
20
   License along with this library; if not, write to the
21
 
   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22
 
   Boston, MA 02111-1307, USA.
 
21
   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
22
   Boston, MA 02110-1301 USA.
23
23
*/
24
24
 
25
25
/* directfb includes */
26
26
#include <directfb.h>
27
27
 
 
28
#define DFB_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c))
 
29
 
28
30
/* other things */
29
31
#include <stdio.h>
30
32
#include <stdlib.h>
108
110
*           vo_dfbmga         *
109
111
******************************/
110
112
 
111
 
#if DIRECTFBVERSION < 918
 
113
#if DIRECTFBVERSION < DFB_VERSION(0,9,18)
112
114
 #define DSPF_ALUT44 DSPF_LUT8
113
115
 #define DLBM_TRIPLE ~0
114
116
 #define DSFLIP_ONSYNC 0
115
117
#endif
116
118
 
117
 
#if DIRECTFBVERSION < 916
 
119
#if DIRECTFBVERSION < DFB_VERSION(0,9,16)
118
120
 #define DSPF_ARGB1555 DSPF_RGB15
119
121
#endif
120
122
 
121
123
static uint32_t in_width;
122
124
static uint32_t in_height;
 
125
static uint32_t buf_height;
123
126
static uint32_t screen_width;
124
127
static uint32_t screen_height;
125
128
static uint32_t sub_width;
149
152
          return "I420";
150
153
     case DSPF_ALUT44:
151
154
          return "ALUT44";
152
 
#if DIRECTFBVERSION > 921
 
155
#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
153
156
     case DSPF_NV12:
154
157
          return "NV12";
155
158
     case DSPF_NV21:
181
184
     case IMGFMT_I420:
182
185
     case IMGFMT_IYUV:
183
186
          return DSPF_I420;
184
 
#if DIRECTFBVERSION > 921
 
187
#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
185
188
     case IMGFMT_NV12:
186
189
          return DSPF_NV12;
187
190
     case IMGFMT_NV21:
206
209
{
207
210
     struct layer_enum *l = (struct layer_enum *) data;
208
211
 
209
 
#if DIRECTFBVERSION > 915
 
212
#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
210
213
     /* We have desc.name so use it */
211
214
     if (!strcmp( l->name, desc.name ))
212
215
          if ((l->res = dfb->GetDisplayLayer( dfb, id, l->layer )) == DFB_OK)
237
240
     use_crtc2 = 1;
238
241
     use_spic = 1;
239
242
     field_parity = -1;
240
 
#if DIRECTFBVERSION > 917
 
243
#if DIRECTFBVERSION > DFB_VERSION(0,9,17)
241
244
     buffermode = DLBM_TRIPLE;
242
245
     osd_max = 4;
243
246
#else
479
482
 
480
483
     if (use_crtc2) {
481
484
          struct layer_enum l = {
482
 
#if DIRECTFBVERSION > 920
 
485
#if DIRECTFBVERSION > DFB_VERSION(0,9,20)
483
486
               "Matrox CRTC2 Layer",
484
487
#else
485
488
               "Matrox CRTC2",
606
609
 
607
610
          dsc.flags       = DSDESC_WIDTH | DSDESC_HEIGHT |
608
611
                            DSDESC_PIXELFORMAT;
609
 
          dsc.width       = in_width;
610
 
          dsc.height      = in_height;
 
612
          dsc.width       = (in_width + 15) & ~15;
 
613
          dsc.height      = (in_height + 15) & ~15;
611
614
          dsc.pixelformat = dlc.pixelformat;
612
615
 
613
616
          /* Don't waste video memory since we don't need direct stretchblit */
630
633
          frame = bufs[0];
631
634
          current_buf = 0;
632
635
          current_ip_buf = 0;
 
636
          buf_height = dsc.height;
633
637
     }
634
638
     frame->GetPixelFormat( frame, &frame_format );
635
639
     mp_msg( MSGT_VO, MSGL_INFO, "vo_dfbmga: Video surface %dx%d %s\n",
694
698
          dlc.buffermode = buffermode;
695
699
          dlc.options    = DLOP_NONE;
696
700
 
697
 
#if DIRECTFBVERSION > 916
 
701
#if DIRECTFBVERSION > DFB_VERSION(0,9,16)
698
702
          if (field_parity != -1) {
699
703
               dlc.options |= DLOP_FIELD_PARITY;
700
704
          }
742
746
               return -1;
743
747
          }
744
748
 
745
 
#if DIRECTFBVERSION > 916
 
749
#if DIRECTFBVERSION > DFB_VERSION(0,9,16)
746
750
          if (field_parity != -1)
747
751
               crtc2->SetFieldParity( crtc2, field_parity );
748
752
#endif
822
826
          dlc.pixelformat = DSPF_ALUT44;
823
827
          dlc.buffermode  = buffermode;
824
828
 
825
 
#if DIRECTFBVERSION > 916
 
829
#if DIRECTFBVERSION > DFB_VERSION(0,9,16)
826
830
          dlc.flags      |= DLCONF_OPTIONS;
827
831
          dlc.options     = DLOP_ALPHACHANNEL;
828
832
#endif
903
907
                    return 0;
904
908
          case IMGFMT_YUY2:
905
909
               break;
906
 
#if DIRECTFBVERSION > 921
 
910
#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
907
911
          case IMGFMT_NV12:
908
912
          case IMGFMT_NV21:
909
913
               if (!use_bes || use_crtc2)
946
950
clear_alpha( int x0, int y0,
947
951
             int w, int h )
948
952
{
949
 
     if (use_spic && !flipping && vo_osd_changed)
 
953
     if (use_spic && !flipping && vo_osd_changed_flag)
950
954
          subframe->FillRectangle( subframe, x0, y0, w, h );
951
955
}
952
956
 
961
965
     int pitch;
962
966
 
963
967
     if (use_spic) {
964
 
          if (!osd_changed || (!flipping && !vo_osd_changed))
 
968
          if (!osd_changed || (!flipping && !vo_osd_changed_flag))
965
969
               return;
966
970
          osd_dirty |= osd_current;
967
971
     } else {
1012
1016
                              ((uint8_t *) dst) + pitch * y0 + 2 * x0 + 1,
1013
1017
                              pitch );
1014
1018
          break;
1015
 
#if DIRECTFBVERSION > 921
 
1019
#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
1016
1020
     case DSPF_NV12:
1017
1021
     case DSPF_NV21:
1018
1022
#endif
1045
1049
     memcpy_pic( dst + pitch * y + x, src[0],
1046
1050
                 w, h, pitch, stride[0] );
1047
1051
 
1048
 
     dst += pitch * in_height;
 
1052
     dst += pitch * buf_height;
1049
1053
 
1050
1054
     y /= 2;
1051
1055
     h /= 2;
1052
1056
 
1053
 
#if DIRECTFBVERSION > 921
 
1057
#if DIRECTFBVERSION > DFB_VERSION(0,9,21)
1054
1058
     if (frame_format == DSPF_NV12 || frame_format == DSPF_NV21) {
1055
1059
          memcpy_pic( dst + pitch * y + x, src[1],
1056
1060
                      w, h, pitch, stride[1] );
1068
1072
          memcpy_pic( dst + pitch * y + x, src[2],
1069
1073
                      w, h, pitch, stride[2] );
1070
1074
 
1071
 
     dst += pitch * in_height / 2;
 
1075
     dst += pitch * buf_height / 2;
1072
1076
 
1073
1077
     if (frame_format == DSPF_I420 )
1074
1078
          memcpy_pic( dst + pitch * y + x, src[2],
1090
1094
     DFBRectangle *srect = NULL;
1091
1095
 
1092
1096
     if (use_bes) {
1093
 
#if DIRECTFBVERSION > 915
 
1097
#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
1094
1098
          if (vo_vsync && !flipping && !use_crtc2)
1095
1099
               bes->WaitForSync( bes );
1096
1100
#endif
1101
1105
     }
1102
1106
 
1103
1107
     if (use_crtc2) {
1104
 
#if DIRECTFBVERSION > 915
 
1108
#if DIRECTFBVERSION > DFB_VERSION(0,9,15)
1105
1109
          if (vo_vsync && !flipping)
1106
1110
               crtc2->WaitForSync( crtc2 );
1107
1111
#endif
1251
1255
 
1252
1256
               if (mpi->flags & MP_IMGFLAG_SWAPPED) {
1253
1257
                    /* I420 */
1254
 
                    mpi->planes[1] = dst + in_height * pitch;
1255
 
                    mpi->planes[2] = mpi->planes[1] + in_height * pitch / 4;
 
1258
                    mpi->planes[1] = dst + buf_height * pitch;
 
1259
                    mpi->planes[2] = mpi->planes[1] + buf_height * pitch / 4;
1256
1260
               } else {
1257
1261
                    /* YV12 */
1258
 
                    mpi->planes[2] = dst + in_height * pitch;
1259
 
                    mpi->planes[1] = mpi->planes[2] + in_height * pitch / 4;
 
1262
                    mpi->planes[2] = dst + buf_height * pitch;
 
1263
                    mpi->planes[1] = mpi->planes[2] + buf_height * pitch / 4;
1260
1264
               }
1261
1265
               } else {
1262
1266
                    /* NV12/NV21 */
1263
1267
                    mpi->stride[1] = pitch;
1264
 
                    mpi->planes[1] = dst + in_height * pitch;
 
1268
                    mpi->planes[1] = dst + buf_height * pitch;
1265
1269
               }
1266
1270
          }
1267
1271