[haiku-commits] haiku: hrev50504 - headers/private/graphics/intel_extreme src/add-ons/accelerants/intel_extreme headers/private/media

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 21 Aug 2016 17:51:48 +0200 (CEST)

hrev50504 adds 3 changesets to branch 'master'
old head: e43cfe781ff6c753f2e7ca78549ec1f18cebe909
new head: 9b1935445c89b49c448e9f60aa534cc60cbf75f6
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=9b1935445c89+%5Ee43cfe781ff6

----------------------------------------------------------------------------

c2775a3bbe37: Revert "intel_extreme: Disable 'experimental' GPUs SNB or higher"
  
  This reverts commit debb71f548bbaea3b8719f703b3db1dfc9a67852.

bb4190f05083: Fix SandyBridge support.
  
  This reverts commit 4f2b258c32efeab97f043519b7f2d4e22819d431.
  This reverts commit c86f3dba238a44a8fcf7b1452c46f1cab68f525a.
  This reverts commit 61fbdb0667c57f6d3d11d33bce6c01bdd625aaec.
  This reverts commit b3f14fb7c715cf95b374ee749dcafd5537d1b017.

9b1935445c89: CID 608995: buffer overflow.
  
  This should not happen, so in case a file has an unexpectedly large
  name, drop to debugger.

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

7 files changed, 38 insertions(+), 28 deletions(-)
.../graphics/intel_extreme/intel_extreme.h       | 24 ++++++++++----------
headers/private/media/ServerInterface.h          |  9 +++++---
src/add-ons/accelerants/intel_extreme/Pipes.cpp  | 20 ++++++++--------
src/add-ons/accelerants/intel_extreme/Ports.cpp  |  3 +++
.../accelerants/intel_extreme/accelerant.cpp     |  3 +++
src/add-ons/accelerants/intel_extreme/dpms.cpp   |  4 ++++
.../drivers/graphics/intel_extreme/driver.cpp    |  3 ---

############################################################################

Commit:      c2775a3bbe37d7e758fc73e844e5b4d499202ae8
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c2775a3bbe37
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Tue May 31 19:56:43 2016 UTC

Revert "intel_extreme: Disable 'experimental' GPUs SNB or higher"

This reverts commit debb71f548bbaea3b8719f703b3db1dfc9a67852.

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp 
b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp
index 5a84537..f5bec9d 100644
--- a/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp
+++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp
@@ -84,8 +84,6 @@ const struct supported_device {
        {0x0046, INTEL_MODEL_ILKGM, "IronLake Mobile"},
        {0x0046, INTEL_MODEL_ILKGM, "IronLake Mobile"},
 
-// Experimental
-#if 0
        {0x0102, INTEL_MODEL_SNBG, "SandyBridge Desktop GT1"},
        {0x0112, INTEL_MODEL_SNBG, "SandyBridge Desktop GT2"},
        {0x0122, INTEL_MODEL_SNBG, "SandyBridge Desktop GT2+"},
@@ -128,7 +126,6 @@ const struct supported_device {
        {0x1926, INTEL_MODEL_SKYM, "Skylake GT3"},
        {0x192a, INTEL_MODEL_SKYS, "Skylake GT3"},
        {0x192b, INTEL_MODEL_SKY,  "Skylake GT3"},
-#endif
 };
 
 int32 api_version = B_CUR_DRIVER_API_VERSION;

############################################################################

Commit:      bb4190f0508392ca43d912b059a10e83268ed483
URL:         http://cgit.haiku-os.org/haiku/commit/?id=bb4190f05083
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Wed Jun  1 17:44:50 2016 UTC

Fix SandyBridge support.

This reverts commit 4f2b258c32efeab97f043519b7f2d4e22819d431.
This reverts commit c86f3dba238a44a8fcf7b1452c46f1cab68f525a.
This reverts commit 61fbdb0667c57f6d3d11d33bce6c01bdd625aaec.
This reverts commit b3f14fb7c715cf95b374ee749dcafd5537d1b017.

----------------------------------------------------------------------------

diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h 
b/headers/private/graphics/intel_extreme/intel_extreme.h
index f607410..52a3c9d 100644
--- a/headers/private/graphics/intel_extreme/intel_extreme.h
+++ b/headers/private/graphics/intel_extreme/intel_extreme.h
@@ -520,18 +520,18 @@ struct intel_free_graphics_memory {
 
 #define INTEL_DISPLAY_OFFSET                   0x1000
 
-#define INTEL_DISPLAY_A_HTOTAL                 (0x0000 | 
REGS_NORTH_PIPE_AND_PORT)
-#define INTEL_DISPLAY_A_HBLANK                 (0x0004 | 
REGS_NORTH_PIPE_AND_PORT)
-#define INTEL_DISPLAY_A_HSYNC                  (0x0008 | 
REGS_NORTH_PIPE_AND_PORT)
-#define INTEL_DISPLAY_A_VTOTAL                 (0x000c | 
REGS_NORTH_PIPE_AND_PORT)
-#define INTEL_DISPLAY_A_VBLANK                 (0x0010 | 
REGS_NORTH_PIPE_AND_PORT)
-#define INTEL_DISPLAY_A_VSYNC                  (0x0014 | 
REGS_NORTH_PIPE_AND_PORT)
-#define INTEL_DISPLAY_B_HTOTAL                 (0x1000 | 
REGS_NORTH_PIPE_AND_PORT)
-#define INTEL_DISPLAY_B_HBLANK                 (0x1004 | 
REGS_NORTH_PIPE_AND_PORT)
-#define INTEL_DISPLAY_B_HSYNC                  (0x1008 | 
REGS_NORTH_PIPE_AND_PORT)
-#define INTEL_DISPLAY_B_VTOTAL                 (0x100c | 
REGS_NORTH_PIPE_AND_PORT)
-#define INTEL_DISPLAY_B_VBLANK                 (0x1010 | 
REGS_NORTH_PIPE_AND_PORT)
-#define INTEL_DISPLAY_B_VSYNC                  (0x1014 | 
REGS_NORTH_PIPE_AND_PORT)
+#define INTEL_DISPLAY_A_HTOTAL                 (0x0000 | 
REGS_SOUTH_TRANSCODER_PORT)
+#define INTEL_DISPLAY_A_HBLANK                 (0x0004 | 
REGS_SOUTH_TRANSCODER_PORT)
+#define INTEL_DISPLAY_A_HSYNC                  (0x0008 | 
REGS_SOUTH_TRANSCODER_PORT)
+#define INTEL_DISPLAY_A_VTOTAL                 (0x000c | 
REGS_SOUTH_TRANSCODER_PORT)
+#define INTEL_DISPLAY_A_VBLANK                 (0x0010 | 
REGS_SOUTH_TRANSCODER_PORT)
+#define INTEL_DISPLAY_A_VSYNC                  (0x0014 | 
REGS_SOUTH_TRANSCODER_PORT)
+#define INTEL_DISPLAY_B_HTOTAL                 (0x1000 | 
REGS_SOUTH_TRANSCODER_PORT)
+#define INTEL_DISPLAY_B_HBLANK                 (0x1004 | 
REGS_SOUTH_TRANSCODER_PORT)
+#define INTEL_DISPLAY_B_HSYNC                  (0x1008 | 
REGS_SOUTH_TRANSCODER_PORT)
+#define INTEL_DISPLAY_B_VTOTAL                 (0x100c | 
REGS_SOUTH_TRANSCODER_PORT)
+#define INTEL_DISPLAY_B_VBLANK                 (0x1010 | 
REGS_SOUTH_TRANSCODER_PORT)
+#define INTEL_DISPLAY_B_VSYNC                  (0x1014 | 
REGS_SOUTH_TRANSCODER_PORT)
 
 #define INTEL_DISPLAY_A_IMAGE_SIZE             (0x001c | 
REGS_NORTH_PIPE_AND_PORT)
 #define INTEL_DISPLAY_B_IMAGE_SIZE             (0x101c | 
REGS_NORTH_PIPE_AND_PORT)
diff --git a/src/add-ons/accelerants/intel_extreme/Pipes.cpp 
b/src/add-ons/accelerants/intel_extreme/Pipes.cpp
index a93636e..2450050 100644
--- a/src/add-ons/accelerants/intel_extreme/Pipes.cpp
+++ b/src/add-ons/accelerants/intel_extreme/Pipes.cpp
@@ -182,31 +182,31 @@ Pipe::ConfigureTimings(display_mode* target)
                return;
        }
 
-       // update timing (fPipeOffset bumps the DISPLAY_A to B when needed)
-       write32(INTEL_DISPLAY_A_HTOTAL + fPipeOffset,
+       // update timing parameters
+       write32(INTEL_DISPLAY_A_HTOTAL,
                ((uint32)(target->timing.h_total - 1) << 16)
                | ((uint32)target->timing.h_display - 1));
-       write32(INTEL_DISPLAY_A_HBLANK + fPipeOffset,
+       write32(INTEL_DISPLAY_A_HBLANK,
                ((uint32)(target->timing.h_total - 1) << 16)
                | ((uint32)target->timing.h_display - 1));
-       write32(INTEL_DISPLAY_A_HSYNC + fPipeOffset,
+       write32(INTEL_DISPLAY_A_HSYNC,
                ((uint32)(target->timing.h_sync_end - 1) << 16)
                | ((uint32)target->timing.h_sync_start - 1));
 
-       write32(INTEL_DISPLAY_A_VTOTAL + fPipeOffset,
+       write32(INTEL_DISPLAY_A_VTOTAL,
                ((uint32)(target->timing.v_total - 1) << 16)
                | ((uint32)target->timing.v_display - 1));
-       write32(INTEL_DISPLAY_A_VBLANK + fPipeOffset,
+       write32(INTEL_DISPLAY_A_VBLANK,
                ((uint32)(target->timing.v_total - 1) << 16)
                | ((uint32)target->timing.v_display - 1));
-       write32(INTEL_DISPLAY_A_VSYNC + fPipeOffset,
+       write32(INTEL_DISPLAY_A_VSYNC,
                ((uint32)(target->timing.v_sync_end - 1) << 16)
                | ((uint32)target->timing.v_sync_start - 1));
 
        // XXX: Is it ok to do these on non-digital?
 
        write32(INTEL_DISPLAY_A_POS + fPipeOffset, 0);
-       write32(INTEL_DISPLAY_A_IMAGE_SIZE + fPipeOffset,
+       write32(INTEL_DISPLAY_A_IMAGE_SIZE,
                ((uint32)(target->virtual_width - 1) << 16)
                        | ((uint32)target->virtual_height - 1));
 
@@ -245,8 +245,8 @@ Pipe::ConfigureClocks(const pll_divisors& divisors, uint32 
pixelClock,
        float refFreq = gInfo->shared_info->pll_info.reference_frequency / 
1000.0f;
 
        if (gInfo->shared_info->device_type.InGroup(INTEL_GROUP_96x)) {
-               float adjusted = ((refFreq * divisors.m) / divisors.n)  / 
divisors.p;
-               uint32 pixelMultiply = uint32(adjusted  / (pixelClock / 
1000.0f));
+               float adjusted = ((refFreq * divisors.m) / divisors.n) / 
divisors.p;
+               uint32 pixelMultiply = uint32(adjusted / (pixelClock / 
1000.0f));
                write32(pllMD, (0 << 24) | ((pixelMultiply - 1) << 8));
        }
 
diff --git a/src/add-ons/accelerants/intel_extreme/Ports.cpp 
b/src/add-ons/accelerants/intel_extreme/Ports.cpp
index 4663a3d..0ac7346 100644
--- a/src/add-ons/accelerants/intel_extreme/Ports.cpp
+++ b/src/add-ons/accelerants/intel_extreme/Ports.cpp
@@ -354,11 +354,14 @@ LVDSPort::LVDSPort()
        :
        Port(INTEL_PORT_C, "LVDS")
 {
+#if 0
+       // FIXME results in black screen on SandyBridge
        // Always unlock LVDS port as soon as we start messing with it.
        uint32 panelControl = INTEL_PANEL_CONTROL;
        if (gInfo->shared_info->pch_info != INTEL_PCH_NONE)
                panelControl = PCH_PANEL_CONTROL;
        write32(panelControl, read32(panelControl) | PANEL_REGISTER_UNLOCK);
+#endif
 }
 
 
diff --git a/src/add-ons/accelerants/intel_extreme/accelerant.cpp 
b/src/add-ons/accelerants/intel_extreme/accelerant.cpp
index d9ca237..37762ac 100644
--- a/src/add-ons/accelerants/intel_extreme/accelerant.cpp
+++ b/src/add-ons/accelerants/intel_extreme/accelerant.cpp
@@ -373,6 +373,9 @@ probe_ports()
                foundLVDS = true;
                gInfo->ports[gInfo->port_count++] = lvdsPort;
                gInfo->head_mode |= HEAD_MODE_LVDS_PANEL;
+               gInfo->head_mode |= HEAD_MODE_A_ANALOG;
+                       // FIXME this should not be set, but without it, LVDS 
modesetting
+                       // doesn't work on SandyBridge. Find out why it makes a 
difference.
                gInfo->head_mode |= HEAD_MODE_B_DIGITAL;
        } else
                delete lvdsPort;
diff --git a/src/add-ons/accelerants/intel_extreme/dpms.cpp 
b/src/add-ons/accelerants/intel_extreme/dpms.cpp
index b21974f..3b9c75d 100644
--- a/src/add-ons/accelerants/intel_extreme/dpms.cpp
+++ b/src/add-ons/accelerants/intel_extreme/dpms.cpp
@@ -47,6 +47,10 @@ static void
 enable_lvds_panel(bool enable)
 {
        bool hasPCH = (gInfo->shared_info->pch_info != INTEL_PCH_NONE);
+       if (hasPCH) {
+               // TODO: fix for PCH (does not enable the panel - crashes?)
+               return;
+       }
 
        int controlRegister = hasPCH ? PCH_PANEL_CONTROL : INTEL_PANEL_CONTROL;
        int statusRegister = hasPCH ? PCH_PANEL_STATUS : INTEL_PANEL_STATUS;

############################################################################

Revision:    hrev50504
Commit:      9b1935445c89b49c448e9f60aa534cc60cbf75f6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9b1935445c89
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun Aug 21 15:49:52 2016 UTC

CID 608995: buffer overflow.

This should not happen, so in case a file has an unexpectedly large
name, drop to debugger.

----------------------------------------------------------------------------

diff --git a/headers/private/media/ServerInterface.h 
b/headers/private/media/ServerInterface.h
index 1ff85f5..0bd7967 100644
--- a/headers/private/media/ServerInterface.h
+++ b/headers/private/media/ServerInterface.h
@@ -244,10 +244,13 @@ public:
        {
                device = ref.device;
                directory = ref.directory;
-               if (ref.name)
-                       strcpy(name, ref.name);
-               else
+               if (ref.name == NULL)
+                       name[0] = 0;
+               else if (strlen(ref.name) > B_FILE_NAME_LENGTH) {
+                       debugger("File name too long!");
                        name[0] = 0;
+               } else 
+                       strcpy(name, ref.name);
 
                return *this;
        }


Other related posts: