changeset 9515:d3af25abde21

Layer configuration handling updates
author zdar
date Sun, 02 Mar 2003 15:56:42 +0000
parents 08264c647f46
children 1a98dc5021ef
files libvo/vo_directfb2.c
diffstat 1 files changed, 47 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_directfb2.c	Sat Mar 01 05:35:09 2003 +0000
+++ b/libvo/vo_directfb2.c	Sun Mar 02 15:56:42 2003 +0000
@@ -217,8 +217,11 @@
    */
 
         DFBCHECK (DirectFBCreate (&dfb));
-        if (DFB_OK != dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)) {
-	    printf("DirectFB: Warning - cannot swith to fullscreen mode");
+        if (DFB_OK != dfb->SetCooperativeLevel (dfb, DFSCL_EXCLUSIVE)) {
+	    printf("DirectFB: Warning - cannot swith to exclusive mode");
+            if (DFB_OK != dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN)) {
+		printf("DirectFB: Warning - cannot swith to fullscreen mode");
+	    };
 	};
 
   /*
@@ -316,22 +319,22 @@
 
         dlc.flags       = DLCONF_PIXELFORMAT;
 	dlc.pixelformat = convformat(params->format);
+
+	layer->SetOpacity(layer,0);
              
-	layer->SetOpacity(layer,0);
 	ret = layer->TestConfiguration(layer,&dlc,NULL);
  
         layer->Release(layer);
 
 	if (verbose) printf("DirectFB: Test format - layer %i scale/pos %i\n",id,(desc.caps & DLCAPS_SCREEN_LOCATION));
      
-	if (!ret) {
+	if (ret==DFB_OK) {
 //	    printf("Test OK\n");     
 	    if (params->result) {
 	        if  ((!params->scale) && (desc.caps & DLCAPS_SCREEN_LOCATION)) {
 		    params->scale=1;
 		    params->id=id;
 		    if (verbose) printf("DirectFB: Test format - added layer %i scale/pos %i\n",id,(desc.caps & DLCAPS_SCREEN_LOCATION));
-		    
 		}
 	    } else {
 		params->result=1;
@@ -343,7 +346,7 @@
      };
 
     };
-    
+
     return DFENUM_OK;
 }
 
@@ -475,12 +478,12 @@
 	    params.width=0;
 	    params.height=0;
 	    switch (format) {
-		    case IMGFMT_RGB32: 
-    		    case IMGFMT_BGR32: 
+		    case IMGFMT_RGB32:
+    		    case IMGFMT_BGR32:
 					params.bpp=32;
 					break;
-        	    case IMGFMT_RGB24: 
-		    case IMGFMT_BGR24: 
+        	    case IMGFMT_RGB24:
+		    case IMGFMT_BGR24:
 					params.bpp=24;
 					break;
 		    case IMGFMT_RGB16:
@@ -489,9 +492,9 @@
 	    	    case IMGFMT_BGR15:
 					params.bpp=16;
 					break;
-		    default:		params.bpp=0;		
-					
-	    }			
+		    default:		params.bpp=0;
+
+	    }
 	    if (verbose) printf("DirectFB: Config - videomode change\n");
             DFBCHECK (dfb->EnumVideoModes(dfb,video_modes_callback,&params));
 	    ret=dfb->SetVideoMode(dfb,params.width,params.height,params.bpp);
@@ -524,12 +527,12 @@
 	if (!params.result) {
 	    printf("DirectFB: ConfigError - no suitable layer found\n");
 	    params.id = DLID_PRIMARY;
-	}	
+	}
 /*	Uncomment following if you want to use tvout on CRTC2 (requieres patch for DirectFB from Ville Syrjala)
 	params.id=2;
 	params.scale=0;
 	params.result=1;
-*/	
+*/
 	if (verbose) printf("DirectFB: Config - layer %i\n",params.id);
 
 
@@ -543,26 +546,41 @@
             dlc.flags       = DLCONF_WIDTH | DLCONF_HEIGHT;
 	    dlc.width       = s_width;
     	    dlc.height      = s_height;
-	    
+
 	    ret = layer->SetConfiguration(layer,&dlc);
-	    
+
 	    if (ret && (params.scale || verbose)) printf("DirectFB: ConfigError in layer configuration (size)\n");
-	
+
 	}
 
-        dlc.flags       = DLCONF_PIXELFORMAT;
-	dlc.pixelformat = convformat(params.format);
+        // look if we need to change pixel fromat of layer
+	// and just for sure fetch also all layer propreties
+	dlc.flags       = DLCONF_PIXELFORMAT | DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_OPTIONS | DLCONF_BUFFERMODE;
+	ret = layer->GetConfiguration(layer,&dlc);
+
+	dlc.flags       = DLCONF_PIXELFORMAT | DLCONF_WIDTH | DLCONF_HEIGHT;
+
+	if (ret) {
+	    printf("DirectFB: Warning - could not get layer properties!\n");
+	} else if (verbose) {
+	    printf("DirectFB: Layer reports format:%x\n",dlc.pixelformat);
+	}
 
-//	printf("DirectFB: Format [%x]\n",dlc.pixelformat);
-             
-        if (verbose) printf("DirectFB: Config - set layer config (format)\n");
-	ret = layer->SetConfiguration(layer,&dlc);
-	
-	if (ret) {
-	    printf("DirectFB: ConfigError in layer configuration (format)\n");
-	    return CONFIG_ERROR;
+	if ((dlc.pixelformat != convformat(params.format)) || (ret != DFB_OK)) {
+
+    	    dlc.flags       = DLCONF_PIXELFORMAT;
+	    dlc.pixelformat = convformat(params.format);
+
+	    printf("DirectFB: Format [%x]\n",dlc.pixelformat);
+
+    	    if (verbose) printf("DirectFB: Config - set layer config (format)\n");
+	    ret = layer->SetConfiguration(layer,&dlc);
+
+	    if (ret) {
+		printf("DirectFB: ConfigError in layer configuration (format)\n");
+		return CONFIG_ERROR;
+	    };
 	};
-	
 
 // flipping of layer