[haiku-commits] r42818 - haiku/trunk/src/add-ons/accelerants/radeon_hd

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 10 Oct 2011 18:46:23 +0200 (CEST)

Author: kallisti5
Date: 2011-10-10 18:46:22 +0200 (Mon, 10 Oct 2011)
New Revision: 42818
Changeset: https://dev.haiku-os.org/changeset/42818

Modified:
   haiku/trunk/src/add-ons/accelerants/radeon_hd/display.cpp
   haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.cpp
   haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.h
   haiku/trunk/src/add-ons/accelerants/radeon_hd/mode.cpp
   haiku/trunk/src/add-ons/accelerants/radeon_hd/pll.cpp
Log:
* detect hdmi and tv and set as such
* set encoder flags the same as connector flags
* add curly comments to make troubleshooting clearer
* program encoder dpms scratch registers


Modified: haiku/trunk/src/add-ons/accelerants/radeon_hd/display.cpp
===================================================================
--- haiku/trunk/src/add-ons/accelerants/radeon_hd/display.cpp   2011-10-09 
22:04:07 UTC (rev 42817)
+++ haiku/trunk/src/add-ons/accelerants/radeon_hd/display.cpp   2011-10-10 
16:46:22 UTC (rev 42818)
@@ -6,7 +6,12 @@
  *      Alexander von Gluck, kallisti5@xxxxxxxxxxx
  */
 
+/*
+ * It's dangerous to go alone, take this!
+ *     framebuffer -> crtc -> encoder -> transmitter -> connector -> monitor
+ */
 
+
 #include "accelerant_protos.h"
 #include "accelerant.h"
 #include "bios.h"
@@ -398,7 +403,6 @@
                                continue;
                        }
 
-
                        uint16 igp_lane_info;
                        if (0)
                                ERROR("%s: TODO : IGP chip connector 
detection\n", __func__);
@@ -426,6 +430,7 @@
                                uint8 grph_obj_type
                                        = 
(B_LENDIAN_TO_HOST_INT16(path->usGraphicObjIds[j]) &
                                        OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT;
+
                                if (grph_obj_type == GRAPH_OBJECT_TYPE_ENCODER) 
{
                                        // Found an encoder
                                        // TODO : it may be possible to have 
more then one encoder
@@ -535,6 +540,9 @@
                                                        TRACE("%s: Path #%" 
B_PRId32 ": Found encoder "
                                                                "%s\n", 
__func__, i,
                                                                
get_encoder_name(encoder_type));
+
+                                                       
gConnector[connector_index]->encoder.flags
+                                                               = 
connector_flags;
                                                        
gConnector[connector_index]->encoder.valid
                                                                = true;
                                                        
gConnector[connector_index]->encoder.object_id
@@ -543,9 +551,10 @@
                                                                = encoder_type;
                                                }
                                        }
+                                       // END if object is encoder
                                } else if (grph_obj_type == 
GRAPH_OBJECT_TYPE_ROUTER) {
                                        ERROR("%s: TODO : Found router 
object?\n", __func__);
-                               }
+                               } // END if object is router
                        }
 
                        // Set up information buses such as ddc
@@ -593,6 +602,7 @@
 
                        // TODO : aux chan transactions
 
+                       // record connector information
                        TRACE("%s: Path #%" B_PRId32 ": Found %s (0x%" B_PRIX32 
")\n",
                                __func__, i, get_connector_name(connector_type),
                                connector_type);
@@ -603,16 +613,23 @@
                        gConnector[connector_index]->object_id
                                = connector_object_id;
 
-                       if (connector_type == VIDEO_CONNECTOR_COMPOSITE
-                               || connector_type == VIDEO_CONNECTOR_SVIDEO
-                               || connector_type == VIDEO_CONNECTOR_9DIN) {
-                               gConnector[connector_index]->encoder.is_tv = 
true;
-                       } else {
-                               gConnector[connector_index]->encoder.is_tv = 
false;
+                       gConnector[connector_index]->encoder.is_tv = false;
+                       gConnector[connector_index]->encoder.is_hdmi = false;
+
+                       switch(connector_type) {
+                               case VIDEO_CONNECTOR_COMPOSITE:
+                               case VIDEO_CONNECTOR_SVIDEO:
+                               case VIDEO_CONNECTOR_9DIN:
+                                       
gConnector[connector_index]->encoder.is_tv = true;
+                                       break;
+                               case VIDEO_CONNECTOR_HDMIA:
+                               case VIDEO_CONNECTOR_HDMIB:
+                                       
gConnector[connector_index]->encoder.is_hdmi = true;
+                                       break;
                        }
 
                        connector_index++;
-               }
+               } // END for each valid connector
        } // end for each display path
 
        return B_OK;

Modified: haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.cpp
===================================================================
--- haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.cpp   2011-10-09 
22:04:07 UTC (rev 42817)
+++ haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.cpp   2011-10-10 
16:46:22 UTC (rev 42818)
@@ -366,8 +366,83 @@
 
 
 void
-encoder_dpms_set(uint8 encoder_id, int mode)
+encoder_dpms_scratch(uint8 crtc_id, bool power)
 {
+       TRACE("%s: power: %s\n", __func__, power ? "true" : "false");
+
+       uint32 connector_index = gDisplay[crtc_id]->connector_index;
+       uint32 encoder_flags = gConnector[connector_index]->encoder.flags;
+
+       // TODO : r500
+       uint32 bios_2_scratch = Read32(OUT, R600_BIOS_2_SCRATCH);
+
+       if (encoder_flags & ATOM_DEVICE_TV1_SUPPORT) {
+               if (power == true)
+                       bios_2_scratch &= ~ATOM_S2_TV1_DPMS_STATE;
+               else
+                       bios_2_scratch |= ATOM_S2_TV1_DPMS_STATE;
+       }
+       if (encoder_flags & ATOM_DEVICE_CV_SUPPORT) {
+               if (power == true)
+                       bios_2_scratch &= ~ATOM_S2_CV_DPMS_STATE;
+               else
+                       bios_2_scratch |= ATOM_S2_CV_DPMS_STATE;
+       }
+       if (encoder_flags & ATOM_DEVICE_CRT1_SUPPORT) {
+               if (power == true)
+                       bios_2_scratch &= ~ATOM_S2_CRT1_DPMS_STATE;
+               else
+                       bios_2_scratch |= ATOM_S2_CRT1_DPMS_STATE;
+       }
+       if (encoder_flags & ATOM_DEVICE_CRT2_SUPPORT) {
+               if (power == true)
+                       bios_2_scratch &= ~ATOM_S2_CRT2_DPMS_STATE;
+               else
+                       bios_2_scratch |= ATOM_S2_CRT2_DPMS_STATE;
+       }
+       if (encoder_flags & ATOM_DEVICE_LCD1_SUPPORT) {
+               if (power == true)
+                       bios_2_scratch &= ~ATOM_S2_LCD1_DPMS_STATE;
+               else
+                       bios_2_scratch |= ATOM_S2_LCD1_DPMS_STATE;
+       }
+       if (encoder_flags & ATOM_DEVICE_DFP1_SUPPORT) {
+               if (power == true)
+                       bios_2_scratch &= ~ATOM_S2_DFP1_DPMS_STATE;
+               else
+                       bios_2_scratch |= ATOM_S2_DFP1_DPMS_STATE;
+       }
+       if (encoder_flags & ATOM_DEVICE_DFP2_SUPPORT) {
+               if (power == true)
+                       bios_2_scratch &= ~ATOM_S2_DFP2_DPMS_STATE;
+               else
+                       bios_2_scratch |= ATOM_S2_DFP2_DPMS_STATE;
+       }
+       if (encoder_flags & ATOM_DEVICE_DFP3_SUPPORT) {
+               if (power == true)
+                       bios_2_scratch &= ~ATOM_S2_DFP3_DPMS_STATE;
+               else
+                       bios_2_scratch |= ATOM_S2_DFP3_DPMS_STATE;
+       }
+       if (encoder_flags & ATOM_DEVICE_DFP4_SUPPORT) {
+               if (power == true)
+                       bios_2_scratch &= ~ATOM_S2_DFP4_DPMS_STATE;
+               else
+                       bios_2_scratch |= ATOM_S2_DFP4_DPMS_STATE;
+       }
+       if (encoder_flags & ATOM_DEVICE_DFP5_SUPPORT) {
+               if (power == true)
+                       bios_2_scratch &= ~ATOM_S2_DFP5_DPMS_STATE;
+               else
+                       bios_2_scratch |= ATOM_S2_DFP5_DPMS_STATE;
+       }
+       Write32(OUT, R600_BIOS_2_SCRATCH, bios_2_scratch);
+}
+
+
+void
+encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode)
+{
        int index = 0;
        DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args;
 
@@ -430,6 +505,7 @@
                        atom_execute_table(gAtomContext, index, (uint32*)&args);
                        // TODO : ATOM_DEVICE_LCD_SUPPORT : args.ucAction = 
ATOM_LCD_BLON;
                        //                execute again
+                       encoder_dpms_scratch(crtc_id, true);
                        break;
                case B_DPMS_STAND_BY:
                case B_DPMS_SUSPEND:
@@ -438,6 +514,7 @@
                        atom_execute_table(gAtomContext, index, (uint32*)&args);
                        // TODO : ATOM_DEVICE_LCD_SUPPORT : args.ucAction = 
ATOM_LCD_BLOFF;
                        //                execute again
+                       encoder_dpms_scratch(crtc_id, false);
                        break;
        }
 }

Modified: haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.h
===================================================================
--- haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.h     2011-10-09 
22:04:07 UTC (rev 42817)
+++ haiku/trunk/src/add-ons/accelerants/radeon_hd/encoder.h     2011-10-10 
16:46:22 UTC (rev 42818)
@@ -14,7 +14,8 @@
 status_t encoder_digital_setup(uint8 id, uint32 pixelClock, int command);
 status_t encoder_analog_setup(uint8 id, uint32 pixelClock, int command);
 void encoder_output_lock(bool lock);
-void encoder_dpms_set(uint8 encoder_id, int mode);
+void encoder_dpms_scratch(uint8 crtc_id, bool power);
+void encoder_dpms_set(uint8 crtc_id, uint8 encoder_id, int mode);
 
 
 #endif /* RADEON_HD_ENCODER_H */

Modified: haiku/trunk/src/add-ons/accelerants/radeon_hd/mode.cpp
===================================================================
--- haiku/trunk/src/add-ons/accelerants/radeon_hd/mode.cpp      2011-10-09 
22:04:07 UTC (rev 42817)
+++ haiku/trunk/src/add-ons/accelerants/radeon_hd/mode.cpp      2011-10-10 
16:46:22 UTC (rev 42818)
@@ -144,7 +144,7 @@
 
                // *** encoder prep
                encoder_output_lock(true);
-               encoder_dpms_set(gConnector[connector_index]->encoder.object_id,
+               encoder_dpms_set(id, 
gConnector[connector_index]->encoder.object_id,
                        B_DPMS_OFF);
                encoder_assign_crtc(id);
 
@@ -175,7 +175,7 @@
                display_crtc_lock(id, ATOM_DISABLE);
 
                // *** encoder commit
-               encoder_dpms_set(gConnector[connector_index]->encoder.object_id,
+               encoder_dpms_set(id, 
gConnector[connector_index]->encoder.object_id,
                        B_DPMS_ON);
                encoder_output_lock(false);
        }

Modified: haiku/trunk/src/add-ons/accelerants/radeon_hd/pll.cpp
===================================================================
--- haiku/trunk/src/add-ons/accelerants/radeon_hd/pll.cpp       2011-10-09 
22:04:07 UTC (rev 42817)
+++ haiku/trunk/src/add-ons/accelerants/radeon_hd/pll.cpp       2011-10-10 
16:46:22 UTC (rev 42818)
@@ -233,7 +233,5 @@
 
        TRACE("%s: setting pixel clock %" B_PRIu32 "\n", __func__, pixelClock);
 
-       atom_execute_table(gAtomContext, index, (uint32 *)&args);
-
-       return B_OK;
+       return atom_execute_table(gAtomContext, index, (uint32 *)&args);
 }


Other related posts:

  • » [haiku-commits] r42818 - haiku/trunk/src/add-ons/accelerants/radeon_hd - kallisti5