From e724b26f23ad0df100a47f8d913bcdb3d54267df Mon Sep 17 00:00:00 2001 From: John Scipione Date: Mon, 8 Jul 2013 18:27:55 -0400 Subject: [PATCH 01/23] Remove enum elaborated type specifier ...from orientation params. Elaborated type specifiers are not needed for C++ code and removing them makes doxygen happy. Verified working on both gcc2h and gcc4h builds. --- docs/user/interface/GroupLayout.dox | 6 +-- docs/user/interface/LayoutBuilder.Group.dox | 12 ++--- docs/user/interface/LayoutBuilder.dox | 11 ++-- docs/user/interface/TwoDimensionalLayout.dox | 8 +-- docs/user/interface/_layout_intro.dox | 2 +- headers/os/interface/ChannelSlider.h | 6 +-- headers/os/interface/ControlLook.h | 47 +++++++--------- headers/os/interface/GridLayout.h | 2 +- headers/os/interface/GroupLayout.h | 8 +-- headers/os/interface/GroupLayoutBuilder.h | 4 +- headers/os/interface/GroupView.h | 4 +- headers/os/interface/LayoutBuilder.h | 56 ++++++++++---------- headers/os/interface/ScrollBar.h | 4 +- headers/os/interface/SeparatorView.h | 18 +++---- headers/os/interface/SplitLayoutBuilder.h | 2 +- headers/os/interface/SplitView.h | 9 ++-- headers/os/interface/TwoDimensionalLayout.h | 6 +-- src/kits/interface/ChannelSlider.cpp | 6 +-- src/kits/interface/ControlLook.cpp | 38 ++++++------- src/kits/interface/GridLayout.cpp | 2 +- src/kits/interface/GroupLayout.cpp | 8 +-- src/kits/interface/GroupLayoutBuilder.cpp | 6 +-- src/kits/interface/GroupView.cpp | 6 +-- src/kits/interface/ScrollBar.cpp | 2 +- src/kits/interface/SeparatorView.cpp | 15 +++--- src/kits/interface/SplitLayout.cpp | 5 +- src/kits/interface/SplitLayout.h | 4 +- src/kits/interface/SplitLayoutBuilder.cpp | 2 +- src/kits/interface/SplitView.cpp | 8 +-- src/kits/interface/TwoDimensionalLayout.cpp | 16 +++--- 30 files changed, 150 insertions(+), 173 deletions(-) diff --git a/docs/user/interface/GroupLayout.dox b/docs/user/interface/GroupLayout.dox index 75a9ab43b5..70e20950a7 100644 --- a/docs/user/interface/GroupLayout.dox +++ b/docs/user/interface/GroupLayout.dox @@ -52,10 +52,10 @@ /*! - \fn BGroupLayout::BGroupLayout(enum orientation orientation, float spacing) + \fn BGroupLayout::BGroupLayout(orientation orientation, float spacing) \brief Creates a new BGroupLayout. - \param orientation The #orientation of this BGroupLayout. + \param orientation The orientation of this BGroupLayout. \param spacing The spacing between BLayoutItems in this BGroupLayout. */ @@ -95,7 +95,7 @@ /*! - \fn void BGroupLayout::SetOrientation(enum orientation orientation) + \fn void BGroupLayout::SetOrientation(orientation orientation) \brief Set the #orientation of this BGroupLayout. \param orientation The new #orientation of this BGroupLayout. */ diff --git a/docs/user/interface/LayoutBuilder.Group.dox b/docs/user/interface/LayoutBuilder.Group.dox index 719e4ddd56..810fa0dbb5 100644 --- a/docs/user/interface/LayoutBuilder.Group.dox +++ b/docs/user/interface/LayoutBuilder.Group.dox @@ -64,8 +64,7 @@ /*! \fn BLayoutBuilder::Group::Group(BWindow *window, - enum orientation orientation=B_HORIZONTAL, - float spacing=B_USE_DEFAULT_SPACING) + orientation orientation, float spacing) \brief Creates a new BGroupLayout, and attaches it to a BWindow. \note The top BView* in \a window has its ViewColor set to @@ -98,8 +97,7 @@ /*! \fn BLayoutBuilder::Group::Group( - enum orientation orientation=B_HORIZONTAL, - float spacing=B_USE_DEFAULT_SPACING) + orientation orientation, float spacing) \brief Creates a new BGroupView and targets it. Methods called on this builder will be directed to the new BGroupView's @@ -178,8 +176,7 @@ /*! \fn GroupBuilder BLayoutBuilder::Group::AddGroup( - enum orientation orientation, float spacing=B_USE_DEFAULT_SPACING, - float weight=1.0f) + orientation orientation, float spacing, float weight) \brief Construct and add a viewless BGroupLayout, then return a GroupBuilder representing the newly added layout. @@ -264,8 +261,7 @@ /*! \fn SplitBuilder BLayoutBuilder::Group::AddSplit( - enum orientation orientation, float spacing=B_USE_DEFAULT_SPACING, - float weight=1.0f) + orientation orientation, float spacing, float weight) \brief Create and add a new BSplitView with a weight of \c weight, then return a SplitBuilder representing the new BSplitView. diff --git a/docs/user/interface/LayoutBuilder.dox b/docs/user/interface/LayoutBuilder.dox index 957300d207..acaaa50fa2 100644 --- a/docs/user/interface/LayoutBuilder.dox +++ b/docs/user/interface/LayoutBuilder.dox @@ -147,7 +147,7 @@ public: = B_ALIGN_HORIZONTAL_UNSET, int32 columnCount = 1, int32 rowCount = 1); - inline GroupBuilder AddGroup(enum orientation orientation, + inline GroupBuilder AddGroup(orientation orientation, float spacing, int32 column, int32 row, int32 columnCount = 1, int32 rowCount = 1); inline GroupBuilder AddGroup(BGroupView* groupView, int32 column, @@ -168,7 +168,7 @@ public: int32 column, int32 row, int32 columnCount = 1, int32 rowCount = 1); - inline SplitBuilder AddSplit(enum orientation orientation, + inline SplitBuilder AddSplit(orientation orientation, float spacing, int32 column, int32 row, int32 columnCount = 1, int32 rowCount = 1); inline SplitBuilder AddSplit(BSplitView* splitView, int32 column, @@ -197,8 +197,7 @@ public: typedef Split SplitBuilder; public: - inline Split(enum orientation orientation - = B_HORIZONTAL, + inline Split(orientation orientation = B_HORIZONTAL, float spacing = 0.0f); inline Split(BSplitView* view); @@ -211,7 +210,7 @@ public: inline ThisBuilder& Add(BLayoutItem* item); inline ThisBuilder& Add(BLayoutItem* item, float weight); - inline GroupBuilder AddGroup(enum orientation orientation, + inline GroupBuilder AddGroup(orientation orientation, float spacing = 0.0f, float weight = 1.0f); inline GroupBuilder AddGroup(BGroupView* groupView, float weight = 1.0f); @@ -226,7 +225,7 @@ public: inline GridBuilder AddGrid(BGridLayout* gridLayout, float weight = 1.0f); - inline SplitBuilder AddSplit(enum orientation orientation, + inline SplitBuilder AddSplit(orientation orientation, float spacing = 0.0f, float weight = 1.0f); inline SplitBuilder AddSplit(BSplitView* splitView, float weight = 1.0f); diff --git a/docs/user/interface/TwoDimensionalLayout.dox b/docs/user/interface/TwoDimensionalLayout.dox index 2acd2b8919..4e81da21dc 100644 --- a/docs/user/interface/TwoDimensionalLayout.dox +++ b/docs/user/interface/TwoDimensionalLayout.dox @@ -56,7 +56,7 @@ /*! \fn void BTwoDimensionalLayout::AlignLayoutWith( - BTwoDimensionalLayout* other, enum orientation orientation) + BTwoDimensionalLayout* other, orientation orientation) \brief Align the BLayoutItem's in the specified \a orientation within two or more BTwoDimensionalLayout's. @@ -114,7 +114,7 @@ /*! - \fn void BTwoDimensionalLayout::PrepareItems(enum orientation orientation) + \fn void BTwoDimensionalLayout::PrepareItems(orientation orientation) \brief Prepare the BLayoutItem in this BTwoDimensionalLayout subclass for layout within a certain \a orientation. @@ -158,8 +158,8 @@ /*! - \fn void BTwoDimensionalLayout::GetColumnRowConstraints(enum orientation - orientation, int32 index, ColumnRowConstraints* constraints) + \fn void BTwoDimensionalLayout::GetColumnRowConstraints( + orientation orientation, int32 index, ColumnRowConstraints* constraints) \brief Fill in the ColumnRowConstraints for a certain column or row in the BTwoDimensionalLayout. diff --git a/docs/user/interface/_layout_intro.dox b/docs/user/interface/_layout_intro.dox index 44bb17570d..802a77a3ef 100644 --- a/docs/user/interface/_layout_intro.dox +++ b/docs/user/interface/_layout_intro.dox @@ -40,7 +40,7 @@ So, let's review the BGroupLayout constructor: \code -BGroupLayout(enum orientation orientation, float spacing = B_USE_DEFAULT_SPACING) +BGroupLayout(orientation orientation, float spacing = B_USE_DEFAULT_SPACING) \endcode Because we only have one item in this layout, \c orientation and \c spacing diff --git a/headers/os/interface/ChannelSlider.h b/headers/os/interface/ChannelSlider.h index b628801fa4..8c3961ba55 100644 --- a/headers/os/interface/ChannelSlider.h +++ b/headers/os/interface/ChannelSlider.h @@ -19,14 +19,14 @@ public: uint32 flags = B_WILL_DRAW); BChannelSlider(BRect area, const char* name, const char* label, BMessage* message, - enum orientation orientation, + orientation orientation, int32 channels = 1, uint32 resizeMode = B_FOLLOW_LEFT | B_FOLLOW_TOP, uint32 flags = B_WILL_DRAW); BChannelSlider(const char* name, const char* label, BMessage* message, - enum orientation orientation, + orientation orientation, int32 channels = 1, uint32 flags = B_WILL_DRAW); BChannelSlider(BMessage* archive); @@ -67,7 +67,7 @@ public: virtual void SetEnabled(bool on); virtual orientation Orientation() const; - void SetOrientation(enum orientation orientation); + void SetOrientation(orientation orientation); virtual int32 MaxChannelCount() const; virtual bool SupportsIndividualLimits() const; diff --git a/headers/os/interface/ControlLook.h b/headers/os/interface/ControlLook.h index 1e1a5ca904..48fee2b6b5 100644 --- a/headers/os/interface/ControlLook.h +++ b/headers/os/interface/ControlLook.h @@ -119,16 +119,14 @@ public: const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS, - enum orientation orientation - = B_HORIZONTAL); + orientation orientation = B_HORIZONTAL); /*virtual*/ void DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, float radius, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS, - enum orientation orientation - = B_HORIZONTAL); + orientation orientation = B_HORIZONTAL); /*virtual*/ void DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, float leftTopRadius, @@ -138,8 +136,7 @@ public: const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS, - enum orientation orientation - = B_HORIZONTAL); + orientation orientation = B_HORIZONTAL); virtual void DrawMenuBarBackground(BView* view, BRect& rect, const BRect& updateRect, @@ -222,11 +219,11 @@ public: BRect& rect1, BRect& rect2, const BRect& updateRect, const rgb_color& base, uint32 flags, - enum orientation orientation); + orientation orientation); virtual void DrawScrollBarBackground(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, - enum orientation orientation); + orientation orientation); /*virtual*/ void DrawScrollViewFrame(BView* view, BRect& rect, const BRect& updateRect, @@ -251,32 +248,32 @@ public: rgb_color leftFillColor, rgb_color rightFillColor, float sliderScale, uint32 flags, - enum orientation orientation); + orientation orientation); virtual void DrawSliderBar(BView* view, BRect rect, const BRect& updateRect, const rgb_color& base, rgb_color fillColor, - uint32 flags, enum orientation orientation); + uint32 flags, orientation orientation); virtual void DrawSliderThumb(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, - enum orientation orientation); + orientation orientation); /*virtual*/ void DrawSliderTriangle(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, - enum orientation orientation); + orientation orientation); virtual void DrawSliderTriangle(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, const rgb_color& fill, uint32 flags, - enum orientation orientation); + orientation orientation); virtual void DrawSliderHashMarks(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, int32 count, hash_mark_location location, - uint32 flags, enum orientation orientation); + uint32 flags, orientation orientation); virtual void DrawActiveTab(BView* view, BRect& rect, const BRect& updateRect, @@ -291,7 +288,7 @@ public: /*virtual*/ void DrawSplitter(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, - enum orientation orientation, + orientation orientation, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); @@ -381,8 +378,7 @@ protected: const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS, - enum orientation orientation - = B_HORIZONTAL); + orientation orientation = B_HORIZONTAL); void _DrawMenuFieldBackgroundOutside(BView* view, BRect& rect, const BRect& updateRect, @@ -503,7 +499,7 @@ protected: const rgb_color& fillShadowColor, float leftInset, float topInset, float rightInset, float bottomInset, - enum orientation orientation); + orientation orientation); // Border color methods rgb_color _EdgeLightColor(const rgb_color& base, @@ -530,33 +526,28 @@ protected: void _FillGradient(BView* view, const BRect& rect, const rgb_color& base, float topTint, float bottomTint, - enum orientation orientation - = B_HORIZONTAL); + orientation orientation = B_HORIZONTAL); void _FillGlossyGradient(BView* view, const BRect& rect, const rgb_color& base, float topTint, float middle1Tint, float middle2Tint, float bottomTint, - enum orientation orientation - = B_HORIZONTAL); + orientation orientation = B_HORIZONTAL); void _MakeGradient(BGradientLinear& gradient, const BRect& rect, const rgb_color& base, float topTint, float bottomTint, - enum orientation orientation - = B_HORIZONTAL) const; + orientation orientation = B_HORIZONTAL) const; void _MakeGlossyGradient(BGradientLinear& gradient, const BRect& rect, const rgb_color& base, float topTint, float middle1Tint, float middle2Tint, float bottomTint, - enum orientation orientation - = B_HORIZONTAL) const; + orientation orientation = B_HORIZONTAL) const; void _MakeButtonGradient(BGradientLinear& gradient, BRect& rect, const rgb_color& base, - uint32 flags, enum orientation orientation - = B_HORIZONTAL) const; + uint32 flags, orientation orientation = B_HORIZONTAL) const; bool _RadioButtonAndCheckBoxMarkColor( const rgb_color& base, rgb_color& color, diff --git a/headers/os/interface/GridLayout.h b/headers/os/interface/GridLayout.h index ab97397390..fe13f071fa 100644 --- a/headers/os/interface/GridLayout.h +++ b/headers/os/interface/GridLayout.h @@ -80,7 +80,7 @@ protected: virtual int32 InternalCountColumns(); virtual int32 InternalCountRows(); virtual void GetColumnRowConstraints( - enum orientation orientation, + orientation orientation, int32 index, ColumnRowConstraints* constraints); virtual void GetItemDimensions(BLayoutItem* item, diff --git a/headers/os/interface/GroupLayout.h b/headers/os/interface/GroupLayout.h index 75fbaa32e4..d706b669bf 100644 --- a/headers/os/interface/GroupLayout.h +++ b/headers/os/interface/GroupLayout.h @@ -9,7 +9,7 @@ class BGroupLayout : public BTwoDimensionalLayout { public: - BGroupLayout(enum orientation orientation, + BGroupLayout(orientation orientation, float spacing = B_USE_DEFAULT_SPACING); BGroupLayout(BMessage* from); virtual ~BGroupLayout(); @@ -18,7 +18,7 @@ public: void SetSpacing(float spacing); orientation Orientation() const; - void SetOrientation(enum orientation orientation); + void SetOrientation(orientation orientation); float ItemWeight(int32 index) const; void SetItemWeight(int32 index, float weight); @@ -51,12 +51,12 @@ protected: virtual bool ItemAdded(BLayoutItem* item, int32 atIndex); virtual void ItemRemoved(BLayoutItem* item, int32 fromIndex); - virtual void PrepareItems(enum orientation orientation); + virtual void PrepareItems(orientation orientation); virtual int32 InternalCountColumns(); virtual int32 InternalCountRows(); virtual void GetColumnRowConstraints( - enum orientation orientation, + orientation orientation, int32 index, ColumnRowConstraints* constraints); virtual void GetItemDimensions(BLayoutItem* item, diff --git a/headers/os/interface/GroupLayoutBuilder.h b/headers/os/interface/GroupLayoutBuilder.h index 843a00865a..2e86d31654 100644 --- a/headers/os/interface/GroupLayoutBuilder.h +++ b/headers/os/interface/GroupLayoutBuilder.h @@ -12,7 +12,7 @@ class BGroupLayoutBuilder { public: BGroupLayoutBuilder( - enum orientation orientation = B_HORIZONTAL, + orientation orientation = B_HORIZONTAL, float spacing = B_USE_DEFAULT_SPACING); BGroupLayoutBuilder(BGroupLayout* layout); BGroupLayoutBuilder(BGroupView* view); @@ -28,7 +28,7 @@ public: BGroupLayoutBuilder& Add(BLayoutItem* item); BGroupLayoutBuilder& Add(BLayoutItem* item, float weight); - BGroupLayoutBuilder& AddGroup(enum orientation orientation, + BGroupLayoutBuilder& AddGroup(orientation orientation, float spacing = B_USE_DEFAULT_SPACING, float weight = 1.0f); BGroupLayoutBuilder& End(); diff --git a/headers/os/interface/GroupView.h b/headers/os/interface/GroupView.h index b161405a35..ca8ef5486b 100644 --- a/headers/os/interface/GroupView.h +++ b/headers/os/interface/GroupView.h @@ -13,10 +13,10 @@ class BGroupView : public BView { public: BGroupView( - enum orientation orientation = B_HORIZONTAL, + orientation orientation = B_HORIZONTAL, float spacing = B_USE_DEFAULT_SPACING); BGroupView(const char* name, - enum orientation orientation = B_HORIZONTAL, + orientation orientation = B_HORIZONTAL, float spacing = B_USE_DEFAULT_SPACING); BGroupView(BMessage* from); virtual ~BGroupView(); diff --git a/headers/os/interface/LayoutBuilder.h b/headers/os/interface/LayoutBuilder.h index 61bb7be213..1de612016e 100644 --- a/headers/os/interface/LayoutBuilder.h +++ b/headers/os/interface/LayoutBuilder.h @@ -55,14 +55,13 @@ public: typedef Split SplitBuilder; public: - inline Group(enum orientation orientation - = B_HORIZONTAL, + inline Group(orientation orientation = B_HORIZONTAL, float spacing = B_USE_DEFAULT_SPACING); inline Group(BWindow* window, - enum orientation orientation = B_HORIZONTAL, + orientation orientation = B_HORIZONTAL, float spacing = B_USE_DEFAULT_SPACING); inline Group(BView* view, - enum orientation orientation = B_HORIZONTAL, + orientation orientation = B_HORIZONTAL, float spacing = B_USE_DEFAULT_SPACING); inline Group(BGroupLayout* layout); inline Group(BGroupView* view); @@ -77,7 +76,7 @@ public: inline ThisBuilder& Add(BLayoutItem* item); inline ThisBuilder& Add(BLayoutItem* item, float weight); - inline GroupBuilder AddGroup(enum orientation orientation, + inline GroupBuilder AddGroup(orientation orientation, float spacing = B_USE_DEFAULT_SPACING, float weight = 1.0f); inline GroupBuilder AddGroup(BGroupView* groupView, @@ -94,7 +93,7 @@ public: inline GridBuilder AddGrid(BGridView* gridView, float weight = 1.0f); - inline SplitBuilder AddSplit(enum orientation orientation, + inline SplitBuilder AddSplit(orientation orientation, float spacing = B_USE_DEFAULT_SPACING, float weight = 1.0f); inline SplitBuilder AddSplit(BSplitView* splitView, @@ -165,7 +164,7 @@ public: int32 textColumnCount = 1, int32 rowCount = 1); - inline GroupBuilder AddGroup(enum orientation orientation, + inline GroupBuilder AddGroup(orientation orientation, float spacing, int32 column, int32 row, int32 columnCount = 1, int32 rowCount = 1); inline GroupBuilder AddGroup(BGroupView* groupView, int32 column, @@ -186,7 +185,7 @@ public: int32 column, int32 row, int32 columnCount = 1, int32 rowCount = 1); - inline SplitBuilder AddSplit(enum orientation orientation, + inline SplitBuilder AddSplit(orientation orientation, float spacing, int32 column, int32 row, int32 columnCount = 1, int32 rowCount = 1); inline SplitBuilder AddSplit(BSplitView* splitView, int32 column, @@ -225,8 +224,7 @@ public: typedef Split SplitBuilder; public: - inline Split(enum orientation orientation - = B_HORIZONTAL, + inline Split(orientation orientation = B_HORIZONTAL, float spacing = B_USE_DEFAULT_SPACING); inline Split(BSplitView* view); @@ -239,7 +237,7 @@ public: inline ThisBuilder& Add(BLayoutItem* item); inline ThisBuilder& Add(BLayoutItem* item, float weight); - inline GroupBuilder AddGroup(enum orientation orientation, + inline GroupBuilder AddGroup(orientation orientation, float spacing = B_USE_DEFAULT_SPACING, float weight = 1.0f); inline GroupBuilder AddGroup(BGroupView* groupView, @@ -256,7 +254,7 @@ public: inline GridBuilder AddGrid(BGridLayout* gridLayout, float weight = 1.0f); - inline SplitBuilder AddSplit(enum orientation orientation, + inline SplitBuilder AddSplit(orientation orientation, float spacing = B_USE_DEFAULT_SPACING, float weight = 1.0f); inline SplitBuilder AddSplit(BSplitView* splitView, @@ -358,7 +356,7 @@ Base::End() template -Group::Group(enum orientation orientation, float spacing) +Group::Group(orientation orientation, float spacing) : fLayout((new BGroupView(orientation, spacing))->GroupLayout()) { @@ -366,8 +364,8 @@ Group::Group(enum orientation orientation, float spacing) template -Group::Group(BWindow* window, enum orientation orientation, - float spacing) +Group::Group(BWindow* window, orientation orientation, + float spacing) : fLayout(new BGroupLayout(orientation, spacing)) { @@ -379,8 +377,8 @@ Group::Group(BWindow* window, enum orientation orientation, template -Group::Group(BView* view, enum orientation orientation, - float spacing) +Group::Group(BView* view, orientation orientation, + float spacing) : fLayout(new BGroupLayout(orientation, spacing)) { @@ -478,8 +476,8 @@ Group::Add(BLayoutItem* item, float weight) template typename Group::GroupBuilder -Group::AddGroup(enum orientation orientation, float spacing, - float weight) +Group::AddGroup(orientation orientation, float spacing, + float weight) { GroupBuilder builder(new BGroupLayout(orientation, spacing)); builder.SetParent(this); @@ -546,8 +544,8 @@ Group::AddGrid(BGridView* gridView, float weight) template typename Group::SplitBuilder -Group::AddSplit(enum orientation orientation, float spacing, - float weight) +Group::AddSplit(orientation orientation, float spacing, + float weight) { SplitBuilder builder(orientation, spacing); builder.SetParent(this); @@ -800,8 +798,8 @@ Grid::AddTextControl(BTextControl* textControl, int32 column, template typename Grid::GroupBuilder -Grid::AddGroup(enum orientation orientation, float spacing, - int32 column, int32 row, int32 columnCount, int32 rowCount) +Grid::AddGroup(orientation orientation, float spacing, + int32 column, int32 row, int32 columnCount, int32 rowCount) { GroupBuilder builder(new BGroupLayout(orientation, spacing)); builder.SetParent(this); @@ -860,7 +858,7 @@ Grid::AddGrid(BGridView* gridView, int32 column, int32 row, template typename Grid::SplitBuilder -Grid::AddSplit(enum orientation orientation, float spacing, +Grid::AddSplit(orientation orientation, float spacing, int32 column, int32 row, int32 columnCount, int32 rowCount) { SplitBuilder builder(orientation, spacing); @@ -986,7 +984,7 @@ Grid::operator BGridLayout*() template -Split::Split(enum orientation orientation, float spacing) +Split::Split(orientation orientation, float spacing) : fView(new BSplitView(orientation, spacing)) { @@ -1065,8 +1063,8 @@ Split::Add(BLayoutItem* item, float weight) template typename Split::GroupBuilder -Split::AddGroup(enum orientation orientation, float spacing, - float weight) +Split::AddGroup(orientation orientation, float spacing, + float weight) { GroupBuilder builder(new BGroupLayout(orientation, spacing)); builder.SetParent(this); @@ -1133,8 +1131,8 @@ Split::AddGrid(BGridLayout* layout, float weight) template typename Split::SplitBuilder -Split::AddSplit(enum orientation orientation, float spacing, - float weight) +Split::AddSplit(orientation orientation, float spacing, + float weight) { SplitBuilder builder(orientation, spacing); builder.SetParent(this); diff --git a/headers/os/interface/ScrollBar.h b/headers/os/interface/ScrollBar.h index c70acbe88f..fb4f3ec34b 100644 --- a/headers/os/interface/ScrollBar.h +++ b/headers/os/interface/ScrollBar.h @@ -26,7 +26,7 @@ public: orientation direction); BScrollBar(const char* name, BView* target, float min, float max, - enum orientation orientation); + orientation orientation); BScrollBar(BMessage* archive); virtual ~BScrollBar(); static BArchivable* Instantiate(BMessage* archive); @@ -48,7 +48,7 @@ public: void SetTarget(BView *target); void SetTarget(const char* targetName); BView* Target() const; - void SetOrientation(enum orientation orientation); + void SetOrientation(orientation orientation); orientation Orientation() const; // TODO: Make this a virtual method, it should be one, diff --git a/headers/os/interface/SeparatorView.h b/headers/os/interface/SeparatorView.h index 86fb3bb545..4bed93cdf2 100644 --- a/headers/os/interface/SeparatorView.h +++ b/headers/os/interface/SeparatorView.h @@ -13,34 +13,30 @@ class BSeparatorView : public BView { public: - BSeparatorView(enum orientation orientation, + BSeparatorView(orientation orientation, border_style border = B_PLAIN_BORDER); BSeparatorView(const char* name, const char* label, - enum orientation orientation - = B_HORIZONTAL, + orientation orientation = B_HORIZONTAL, border_style border = B_FANCY_BORDER, const BAlignment& alignment = BAlignment(B_ALIGN_HORIZONTAL_CENTER, B_ALIGN_VERTICAL_CENTER)); BSeparatorView(const char* name, BView* labelView, - enum orientation orientation - = B_HORIZONTAL, + orientation orientation = B_HORIZONTAL, border_style border = B_FANCY_BORDER, const BAlignment& alignment = BAlignment(B_ALIGN_HORIZONTAL_CENTER, B_ALIGN_VERTICAL_CENTER)); BSeparatorView(const char* label = NULL, - enum orientation orientation - = B_HORIZONTAL, + orientation orientation = B_HORIZONTAL, border_style border = B_FANCY_BORDER, const BAlignment& alignment = BAlignment(B_ALIGN_HORIZONTAL_CENTER, B_ALIGN_VERTICAL_CENTER)); BSeparatorView(BView* labelView, - enum orientation orientation - = B_HORIZONTAL, + orientation orientation = B_HORIZONTAL, border_style border = B_FANCY_BORDER, const BAlignment& alignment = BAlignment(B_ALIGN_HORIZONTAL_CENTER, @@ -61,7 +57,7 @@ public: virtual BSize MaxSize(); virtual BSize PreferredSize(); - void SetOrientation(enum orientation orientation); + void SetOrientation(orientation orientation); void SetAlignment(const BAlignment& aligment); void SetBorderStyle(border_style border); @@ -88,7 +84,7 @@ private: private: void _Init(const char* label, BView* labelView, - enum orientation orientation, + orientation orientation, BAlignment alignment, border_style border); float _BorderSize() const; diff --git a/headers/os/interface/SplitLayoutBuilder.h b/headers/os/interface/SplitLayoutBuilder.h index a10f1d6b08..9b4566de83 100644 --- a/headers/os/interface/SplitLayoutBuilder.h +++ b/headers/os/interface/SplitLayoutBuilder.h @@ -10,7 +10,7 @@ class BSplitLayoutBuilder { public: BSplitLayoutBuilder( - enum orientation orientation = B_HORIZONTAL, + orientation orientation = B_HORIZONTAL, float spacing = B_USE_DEFAULT_SPACING); BSplitLayoutBuilder(BSplitView* view); diff --git a/headers/os/interface/SplitView.h b/headers/os/interface/SplitView.h index a6fd491514..c4d3dd5f19 100644 --- a/headers/os/interface/SplitView.h +++ b/headers/os/interface/SplitView.h @@ -13,8 +13,7 @@ class BSplitLayout; class BSplitView : public BView { public: BSplitView( - enum orientation orientation - = B_HORIZONTAL, + orientation orientation = B_HORIZONTAL, float spacing = B_USE_DEFAULT_SPACING); BSplitView(BMessage* from); virtual ~BSplitView(); @@ -30,7 +29,7 @@ public: void SetSpacing(float spacing); orientation Orientation() const; - void SetOrientation(enum orientation orientation); + void SetOrientation(orientation orientation); float SplitterSize() const; void SetSplitterSize(float size); @@ -86,7 +85,7 @@ protected: virtual void DrawSplitter(BRect frame, const BRect& updateRect, - enum orientation orientation, + orientation orientation, bool pressed); private: @@ -109,7 +108,7 @@ private: static void _DrawDefaultSplitter(BView* view, BRect frame, const BRect& updateRect, - enum orientation orientation, + orientation orientation, bool pressed); private: diff --git a/headers/os/interface/TwoDimensionalLayout.h b/headers/os/interface/TwoDimensionalLayout.h index 02543c1134..291b691ed3 100644 --- a/headers/os/interface/TwoDimensionalLayout.h +++ b/headers/os/interface/TwoDimensionalLayout.h @@ -25,7 +25,7 @@ public: float* bottom) const; void AlignLayoutWith(BTwoDimensionalLayout* other, - enum orientation orientation); + orientation orientation); virtual BSize BaseMinSize(); virtual BSize BaseMaxSize(); @@ -72,14 +72,14 @@ protected: float* preferredHeight); BSize SubtractInsets(BSize size); - virtual void PrepareItems(enum orientation orientation); + virtual void PrepareItems(orientation orientation); virtual bool HasMultiColumnItems(); virtual bool HasMultiRowItems(); virtual int32 InternalCountColumns() = 0; virtual int32 InternalCountRows() = 0; virtual void GetColumnRowConstraints( - enum orientation orientation, + orientation orientation, int32 index, ColumnRowConstraints* constraints) = 0; virtual void GetItemDimensions(BLayoutItem* item, diff --git a/src/kits/interface/ChannelSlider.cpp b/src/kits/interface/ChannelSlider.cpp index 02e90a9470..607ce55931 100644 --- a/src/kits/interface/ChannelSlider.cpp +++ b/src/kits/interface/ChannelSlider.cpp @@ -83,7 +83,7 @@ BChannelSlider::BChannelSlider(BRect area, const char* name, const char* label, BChannelSlider::BChannelSlider(BRect area, const char* name, const char* label, - BMessage* model, enum orientation orientation, int32 channels, + BMessage* model, orientation orientation, int32 channels, uint32 resizeMode, uint32 flags) : BChannelControl(area, name, label, model, channels, resizeMode, flags) @@ -94,7 +94,7 @@ BChannelSlider::BChannelSlider(BRect area, const char* name, const char* label, BChannelSlider::BChannelSlider(const char* name, const char* label, - BMessage* model, enum orientation orientation, int32 channels, + BMessage* model, orientation orientation, int32 channels, uint32 flags) : BChannelControl(name, label, model, channels, flags) @@ -502,7 +502,7 @@ BChannelSlider::Orientation() const void -BChannelSlider::SetOrientation(enum orientation orientation) +BChannelSlider::SetOrientation(orientation orientation) { bool isVertical = orientation == B_VERTICAL; if (isVertical != fIsVertical) { diff --git a/src/kits/interface/ControlLook.cpp b/src/kits/interface/ControlLook.cpp index ccb87cb863..acb95ed39a 100644 --- a/src/kits/interface/ControlLook.cpp +++ b/src/kits/interface/ControlLook.cpp @@ -143,7 +143,7 @@ BControlLook::DrawButtonFrame(BView* view, BRect& rect, void BControlLook::DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, - uint32 borders, enum orientation orientation) + uint32 borders, orientation orientation) { _DrawButtonBackground(view, rect, updateRect, 0.0f, 0.0f, 0.0f, 0.0f, base, flags, borders, orientation); @@ -153,7 +153,7 @@ BControlLook::DrawButtonBackground(BView* view, BRect& rect, void BControlLook::DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, float radius, const rgb_color& base, uint32 flags, - uint32 borders, enum orientation orientation) + uint32 borders, orientation orientation) { _DrawButtonBackground(view, rect, updateRect, radius, radius, radius, radius, base, flags, borders, orientation); @@ -164,7 +164,7 @@ void BControlLook::DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, float leftTopRadius, float rightTopRadius, float leftBottomRadius, float rightBottomRadius, const rgb_color& base, - uint32 flags, uint32 borders, enum orientation orientation) + uint32 flags, uint32 borders, orientation orientation) { _DrawButtonBackground(view, rect, updateRect, leftTopRadius, rightTopRadius, leftBottomRadius, rightBottomRadius, base, flags, @@ -553,7 +553,7 @@ BControlLook::DrawRadioButton(BView* view, BRect& rect, const BRect& updateRect, void BControlLook::DrawScrollBarBackground(BView* view, BRect& rect1, BRect& rect2, const BRect& updateRect, const rgb_color& base, uint32 flags, - enum orientation orientation) + orientation orientation) { DrawScrollBarBackground(view, rect1, updateRect, base, flags, orientation); DrawScrollBarBackground(view, rect2, updateRect, base, flags, orientation); @@ -563,7 +563,7 @@ BControlLook::DrawScrollBarBackground(BView* view, BRect& rect1, BRect& rect2, void BControlLook::DrawScrollBarBackground(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, - enum orientation orientation) + orientation orientation) { if (!rect.IsValid() || !rect.Intersects(updateRect)) return; @@ -818,7 +818,7 @@ BControlLook::SliderBarColor(const rgb_color& base) void BControlLook::DrawSliderBar(BView* view, BRect rect, const BRect& updateRect, const rgb_color& base, rgb_color leftFillColor, rgb_color rightFillColor, - float sliderScale, uint32 flags, enum orientation orientation) + float sliderScale, uint32 flags, orientation orientation) { if (!rect.IsValid() || !rect.Intersects(updateRect)) return; @@ -875,7 +875,7 @@ BControlLook::DrawSliderBar(BView* view, BRect rect, const BRect& updateRect, void BControlLook::DrawSliderBar(BView* view, BRect rect, const BRect& updateRect, const rgb_color& base, rgb_color fillColor, uint32 flags, - enum orientation orientation) + orientation orientation) { if (!rect.IsValid() || !rect.Intersects(updateRect)) return; @@ -1021,7 +1021,7 @@ BControlLook::DrawSliderBar(BView* view, BRect rect, const BRect& updateRect, void BControlLook::DrawSliderThumb(BView* view, BRect& rect, const BRect& updateRect, - const rgb_color& base, uint32 flags, enum orientation orientation) + const rgb_color& base, uint32 flags, orientation orientation) { if (!rect.IsValid() || !rect.Intersects(updateRect)) return; @@ -1106,7 +1106,7 @@ BControlLook::DrawSliderThumb(BView* view, BRect& rect, const BRect& updateRect, void BControlLook::DrawSliderTriangle(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, - enum orientation orientation) + orientation orientation) { DrawSliderTriangle(view, rect, updateRect, base, base, flags, orientation); } @@ -1115,7 +1115,7 @@ BControlLook::DrawSliderTriangle(BView* view, BRect& rect, void BControlLook::DrawSliderTriangle(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, const rgb_color& fill, - uint32 flags, enum orientation orientation) + uint32 flags, orientation orientation) { if (!rect.IsValid() || !rect.Intersects(updateRect)) return; @@ -1234,7 +1234,7 @@ BControlLook::DrawSliderTriangle(BView* view, BRect& rect, void BControlLook::DrawSliderHashMarks(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, int32 count, - hash_mark_location location, uint32 flags, enum orientation orientation) + hash_mark_location location, uint32 flags, orientation orientation) { if (!rect.IsValid() || !rect.Intersects(updateRect)) return; @@ -1482,7 +1482,7 @@ BControlLook::DrawInactiveTab(BView* view, BRect& rect, const BRect& updateRect, void BControlLook::DrawSplitter(BView* view, BRect& rect, const BRect& updateRect, - const rgb_color& base, enum orientation orientation, uint32 flags, + const rgb_color& base, orientation orientation, uint32 flags, uint32 borders) { if (!rect.IsValid() || !rect.Intersects(updateRect)) @@ -2180,7 +2180,7 @@ void BControlLook::_DrawButtonBackground(BView* view, BRect& rect, const BRect& updateRect, float leftTopRadius, float rightTopRadius, float leftBottomRadius, float rightBottomRadius, const rgb_color& base, - uint32 flags, uint32 borders, enum orientation orientation) + uint32 flags, uint32 borders, orientation orientation) { if (!rect.IsValid() || !rect.Intersects(updateRect)) return; @@ -2886,7 +2886,7 @@ BControlLook::_DrawRoundBarCorner(BView* view, BRect& rect, const rgb_color& frameLightColor, const rgb_color& frameShadowColor, const rgb_color& fillLightColor, const rgb_color& fillShadowColor, float leftInset, float topInset, float rightInset, float bottomInset, - enum orientation orientation) + orientation orientation) { if (!rect.IsValid() || !rect.Intersects(updateRect)) return; @@ -3102,7 +3102,7 @@ BControlLook::_BevelShadowColor(const rgb_color& base, uint32 flags) void BControlLook::_FillGradient(BView* view, const BRect& rect, const rgb_color& base, float topTint, float bottomTint, - enum orientation orientation) + orientation orientation) { BGradientLinear gradient; _MakeGradient(gradient, rect, base, topTint, bottomTint, orientation); @@ -3113,7 +3113,7 @@ BControlLook::_FillGradient(BView* view, const BRect& rect, void BControlLook::_FillGlossyGradient(BView* view, const BRect& rect, const rgb_color& base, float topTint, float middle1Tint, - float middle2Tint, float bottomTint, enum orientation orientation) + float middle2Tint, float bottomTint, orientation orientation) { BGradientLinear gradient; _MakeGlossyGradient(gradient, rect, base, topTint, middle1Tint, @@ -3125,7 +3125,7 @@ BControlLook::_FillGlossyGradient(BView* view, const BRect& rect, void BControlLook::_MakeGradient(BGradientLinear& gradient, const BRect& rect, const rgb_color& base, float topTint, float bottomTint, - enum orientation orientation) const + orientation orientation) const { gradient.AddColor(tint_color(base, topTint), 0); gradient.AddColor(tint_color(base, bottomTint), 255); @@ -3141,7 +3141,7 @@ void BControlLook::_MakeGlossyGradient(BGradientLinear& gradient, const BRect& rect, const rgb_color& base, float topTint, float middle1Tint, float middle2Tint, float bottomTint, - enum orientation orientation) const + orientation orientation) const { gradient.AddColor(tint_color(base, topTint), 0); gradient.AddColor(tint_color(base, middle1Tint), 132); @@ -3157,7 +3157,7 @@ BControlLook::_MakeGlossyGradient(BGradientLinear& gradient, const BRect& rect, void BControlLook::_MakeButtonGradient(BGradientLinear& gradient, BRect& rect, - const rgb_color& base, uint32 flags, enum orientation orientation) const + const rgb_color& base, uint32 flags, orientation orientation) const { float topTint = 0.49; float middleTint1 = 0.62; diff --git a/src/kits/interface/GridLayout.cpp b/src/kits/interface/GridLayout.cpp index 785835ceff..03577d67cf 100644 --- a/src/kits/interface/GridLayout.cpp +++ b/src/kits/interface/GridLayout.cpp @@ -665,7 +665,7 @@ BGridLayout::InternalCountRows() void -BGridLayout::GetColumnRowConstraints(enum orientation orientation, int32 index, +BGridLayout::GetColumnRowConstraints(orientation orientation, int32 index, ColumnRowConstraints* constraints) { if (orientation == B_HORIZONTAL) { diff --git a/src/kits/interface/GroupLayout.cpp b/src/kits/interface/GroupLayout.cpp index 8c18843302..c300152fbc 100644 --- a/src/kits/interface/GroupLayout.cpp +++ b/src/kits/interface/GroupLayout.cpp @@ -33,7 +33,7 @@ struct BGroupLayout::ItemLayoutData { }; -BGroupLayout::BGroupLayout(enum orientation orientation, float spacing) +BGroupLayout::BGroupLayout(orientation orientation, float spacing) : BTwoDimensionalLayout(), fOrientation(orientation) @@ -85,7 +85,7 @@ BGroupLayout::Orientation() const void -BGroupLayout::SetOrientation(enum orientation orientation) +BGroupLayout::SetOrientation(orientation orientation) { if (orientation != fOrientation) { fOrientation = orientation; @@ -262,7 +262,7 @@ BGroupLayout::ItemRemoved(BLayoutItem* item, int32 fromIndex) void -BGroupLayout::PrepareItems(enum orientation orientation) +BGroupLayout::PrepareItems(orientation orientation) { // filter the visible items fVisibleItems.MakeEmpty(); @@ -290,7 +290,7 @@ BGroupLayout::InternalCountRows() void -BGroupLayout::GetColumnRowConstraints(enum orientation orientation, int32 index, +BGroupLayout::GetColumnRowConstraints(orientation orientation, int32 index, ColumnRowConstraints* constraints) { if (index >= 0 && index < fVisibleItems.CountItems()) { diff --git a/src/kits/interface/GroupLayoutBuilder.cpp b/src/kits/interface/GroupLayoutBuilder.cpp index 442b43ff01..91231f3498 100644 --- a/src/kits/interface/GroupLayoutBuilder.cpp +++ b/src/kits/interface/GroupLayoutBuilder.cpp @@ -14,7 +14,7 @@ using std::nothrow; // constructor -BGroupLayoutBuilder::BGroupLayoutBuilder(enum orientation orientation, +BGroupLayoutBuilder::BGroupLayoutBuilder(orientation orientation, float spacing) : fRootLayout((new BGroupView(orientation, spacing))->GroupLayout()) { @@ -118,8 +118,8 @@ BGroupLayoutBuilder::Add(BLayoutItem* item, float weight) // AddGroup BGroupLayoutBuilder& -BGroupLayoutBuilder::AddGroup(enum orientation orientation, - float spacing, float weight) +BGroupLayoutBuilder::AddGroup(orientation orientation, float spacing, + float weight) { if (BGroupLayout* layout = TopLayout()) { BGroupView* group = new(nothrow) BGroupView(orientation, spacing); diff --git a/src/kits/interface/GroupView.cpp b/src/kits/interface/GroupView.cpp index efb71fefbf..39a534ef99 100644 --- a/src/kits/interface/GroupView.cpp +++ b/src/kits/interface/GroupView.cpp @@ -8,7 +8,7 @@ #include -BGroupView::BGroupView(enum orientation orientation, float spacing) +BGroupView::BGroupView(orientation orientation, float spacing) : BView(NULL, 0, new BGroupLayout(orientation, spacing)) { @@ -16,8 +16,8 @@ BGroupView::BGroupView(enum orientation orientation, float spacing) } -BGroupView::BGroupView(const char* name, enum orientation orientation, - float spacing) +BGroupView::BGroupView(const char* name, orientation orientation, + float spacing) : BView(name, 0, new BGroupLayout(orientation, spacing)) { diff --git a/src/kits/interface/ScrollBar.cpp b/src/kits/interface/ScrollBar.cpp index faafab4342..d15e0fe741 100644 --- a/src/kits/interface/ScrollBar.cpp +++ b/src/kits/interface/ScrollBar.cpp @@ -595,7 +595,7 @@ BScrollBar::Target() const void -BScrollBar::SetOrientation(enum orientation orientation) +BScrollBar::SetOrientation(orientation orientation) { if (fOrientation == orientation) return; diff --git a/src/kits/interface/SeparatorView.cpp b/src/kits/interface/SeparatorView.cpp index a464f58e4e..2c24a6aa4c 100644 --- a/src/kits/interface/SeparatorView.cpp +++ b/src/kits/interface/SeparatorView.cpp @@ -24,8 +24,7 @@ static const float kMinBorderLength = 5.0f; // TODO: More testing, especially archiving. -BSeparatorView::BSeparatorView(enum orientation orientation, - border_style border) +BSeparatorView::BSeparatorView(orientation orientation, border_style border) : BView(NULL, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE) { @@ -35,7 +34,7 @@ BSeparatorView::BSeparatorView(enum orientation orientation, BSeparatorView::BSeparatorView(const char* name, const char* label, - enum orientation orientation, border_style border, + orientation orientation, border_style border, const BAlignment& alignment) : BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE) @@ -45,7 +44,7 @@ BSeparatorView::BSeparatorView(const char* name, const char* label, BSeparatorView::BSeparatorView(const char* name, BView* labelView, - enum orientation orientation, border_style border, + orientation orientation, border_style border, const BAlignment& alignment) : BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE) @@ -55,7 +54,7 @@ BSeparatorView::BSeparatorView(const char* name, BView* labelView, BSeparatorView::BSeparatorView(const char* label, - enum orientation orientation, border_style border, + orientation orientation, border_style border, const BAlignment& alignment) : BView("", B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE) @@ -65,7 +64,7 @@ BSeparatorView::BSeparatorView(const char* label, BSeparatorView::BSeparatorView(BView* labelView, - enum orientation orientation, border_style border, + orientation orientation, border_style border, const BAlignment& alignment) : BView("", B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE) @@ -331,7 +330,7 @@ BSeparatorView::PreferredSize() void -BSeparatorView::SetOrientation(enum orientation orientation) +BSeparatorView::SetOrientation(orientation orientation) { if (orientation == fOrientation) return; @@ -437,7 +436,7 @@ BSeparatorView::DoLayout() void BSeparatorView::_Init(const char* label, BView* labelView, - enum orientation orientation, BAlignment alignment, border_style border) + orientation orientation, BAlignment alignment, border_style border) { fLabel = ""; fLabelView = NULL; diff --git a/src/kits/interface/SplitLayout.cpp b/src/kits/interface/SplitLayout.cpp index c1094cdd3f..48537c20ae 100644 --- a/src/kits/interface/SplitLayout.cpp +++ b/src/kits/interface/SplitLayout.cpp @@ -153,8 +153,7 @@ private: // #pragma mark - -BSplitLayout::BSplitLayout(enum orientation orientation, - float spacing) +BSplitLayout::BSplitLayout(orientation orientation, float spacing) : fOrientation(orientation), fLeftInset(0), @@ -319,7 +318,7 @@ BSplitLayout::Orientation() const void -BSplitLayout::SetOrientation(enum orientation orientation) +BSplitLayout::SetOrientation(orientation orientation) { if (orientation != fOrientation) { fOrientation = orientation; diff --git a/src/kits/interface/SplitLayout.h b/src/kits/interface/SplitLayout.h index e2256ec678..a570bf153d 100644 --- a/src/kits/interface/SplitLayout.h +++ b/src/kits/interface/SplitLayout.h @@ -23,7 +23,7 @@ using BPrivate::Layout::LayoutInfo; class BSplitLayout : public BAbstractLayout { public: - BSplitLayout(enum orientation orientation, + BSplitLayout(orientation orientation, float spacing = 0.0f); BSplitLayout(BMessage* from); virtual ~BSplitLayout(); @@ -37,7 +37,7 @@ public: void SetSpacing(float spacing); orientation Orientation() const; - void SetOrientation(enum orientation orientation); + void SetOrientation(orientation orientation); float SplitterSize() const; void SetSplitterSize(float size); diff --git a/src/kits/interface/SplitLayoutBuilder.cpp b/src/kits/interface/SplitLayoutBuilder.cpp index b778d7ce1e..518bfc9a13 100644 --- a/src/kits/interface/SplitLayoutBuilder.cpp +++ b/src/kits/interface/SplitLayoutBuilder.cpp @@ -12,7 +12,7 @@ using std::nothrow; // constructor -BSplitLayoutBuilder::BSplitLayoutBuilder(enum orientation orientation, +BSplitLayoutBuilder::BSplitLayoutBuilder(orientation orientation, float spacing) : fView(new BSplitView(orientation, spacing)) { diff --git a/src/kits/interface/SplitView.cpp b/src/kits/interface/SplitView.cpp index 65b998ed06..6a174d5db6 100644 --- a/src/kits/interface/SplitView.cpp +++ b/src/kits/interface/SplitView.cpp @@ -14,7 +14,7 @@ #include "SplitLayout.h" -BSplitView::BSplitView(enum orientation orientation, float spacing) +BSplitView::BSplitView(orientation orientation, float spacing) : BView(NULL, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_INVALIDATE_AFTER_LAYOUT, @@ -97,7 +97,7 @@ BSplitView::Orientation() const void -BSplitView::SetOrientation(enum orientation orientation) +BSplitView::SetOrientation(orientation orientation) { fSplitLayout->SetOrientation(orientation); } @@ -358,7 +358,7 @@ BSplitView::Instantiate(BMessage* from) void BSplitView::DrawSplitter(BRect frame, const BRect& updateRect, - enum orientation orientation, bool pressed) + orientation orientation, bool pressed) { _DrawDefaultSplitter(this, frame, updateRect, orientation, pressed); } @@ -366,7 +366,7 @@ BSplitView::DrawSplitter(BRect frame, const BRect& updateRect, void BSplitView::_DrawDefaultSplitter(BView* view, BRect frame, - const BRect& updateRect, enum orientation orientation, bool pressed) + const BRect& updateRect, orientation orientation, bool pressed) { uint32 flags = pressed ? BControlLook::B_ACTIVATED : 0; be_control_look->DrawSplitter(view, frame, updateRect, view->ViewColor(), diff --git a/src/kits/interface/TwoDimensionalLayout.cpp b/src/kits/interface/TwoDimensionalLayout.cpp index 6c71fbd805..c8545fec73 100644 --- a/src/kits/interface/TwoDimensionalLayout.cpp +++ b/src/kits/interface/TwoDimensionalLayout.cpp @@ -56,7 +56,7 @@ // CompoundLayouter class BTwoDimensionalLayout::CompoundLayouter : public BReferenceable { public: - CompoundLayouter(enum orientation orientation); + CompoundLayouter(orientation orientation); virtual ~CompoundLayouter(); orientation Orientation(); @@ -167,7 +167,7 @@ public: float* preferredHeight); void AlignWith(LocalLayouter* other, - enum orientation orientation); + orientation orientation); // Archiving stuff status_t AddAlignedLayoutsToArchive(BArchiver* archiver); @@ -203,7 +203,7 @@ public: void SetCompoundLayouter( CompoundLayouter* compoundLayouter, - enum orientation orientation); + orientation orientation); void InternalInvalidateLayout( CompoundLayouter* compoundLayouter); @@ -336,7 +336,7 @@ BTwoDimensionalLayout::GetInsets(float* left, float* top, float* right, void BTwoDimensionalLayout::AlignLayoutWith(BTwoDimensionalLayout* other, - enum orientation orientation) + orientation orientation) { if (!other || other == this) return; @@ -573,7 +573,7 @@ BTwoDimensionalLayout::SubtractInsets(BSize size) void -BTwoDimensionalLayout::PrepareItems(enum orientation orientation) +BTwoDimensionalLayout::PrepareItems(orientation orientation) { } @@ -603,7 +603,7 @@ BTwoDimensionalLayout::_ValidateMinMax() BTwoDimensionalLayout::CompoundLayouter::CompoundLayouter( - enum orientation orientation) + orientation orientation) : fLayouter(NULL), fLayoutInfo(NULL), @@ -1154,7 +1154,7 @@ BTwoDimensionalLayout::LocalLayouter::InternalGetHeightForWidth(float width, void BTwoDimensionalLayout::LocalLayouter::AlignWith(LocalLayouter* other, - enum orientation orientation) + orientation orientation) { if (orientation == B_HORIZONTAL) other->fHLayouter->AbsorbCompoundLayouter(fHLayouter); @@ -1365,7 +1365,7 @@ BTwoDimensionalLayout::LocalLayouter::SetHeightForWidthConstraintsAdded( void BTwoDimensionalLayout::LocalLayouter::SetCompoundLayouter( - CompoundLayouter* compoundLayouter, enum orientation orientation) + CompoundLayouter* compoundLayouter, orientation orientation) { CompoundLayouter* oldCompoundLayouter; if (orientation == B_HORIZONTAL) { From 080bf8fe19351c11230363077b3b6e1a00192c58 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Mon, 8 Jul 2013 19:02:13 -0400 Subject: [PATCH 02/23] Fix rest of warnings, doxygen now runs cleanly. The BTextView::SetText() methods were included twice, update the first and remove the second. --- docs/user/interface/Layout.dox | 4 +++- docs/user/interface/ListItem.dox | 2 +- docs/user/interface/ListView.dox | 19 +++++-------------- docs/user/interface/TextView.dox | 30 +++++++----------------------- 4 files changed, 16 insertions(+), 39 deletions(-) diff --git a/docs/user/interface/Layout.dox b/docs/user/interface/Layout.dox index 627c8ebd61..0b322cad9a 100644 --- a/docs/user/interface/Layout.dox +++ b/docs/user/interface/Layout.dox @@ -528,10 +528,12 @@ topLayout->AddItem(nestedLayoutWithView); /*! - \fn void BLayout::LayoutInvalidated() = 0 + \fn void BLayout::LayoutInvalidated(bool children) Hook method called when this layout becomes invalid. This is a good place to clear any caches your object might hold. + + \param children Whether or not child layouts have also been invalidated. */ diff --git a/docs/user/interface/ListItem.dox b/docs/user/interface/ListItem.dox index 0c6319e6a8..9a2692fd37 100644 --- a/docs/user/interface/ListItem.dox +++ b/docs/user/interface/ListItem.dox @@ -67,7 +67,7 @@ /*! - \fn void DrawItem(BView* owner, BRect frame, bool complete) + \fn void BListItem::DrawItem(BView* owner, BRect frame, bool complete) \brief Hook method called when the item is drawn. \param owner The view that the list item is a child of. diff --git a/docs/user/interface/ListView.dox b/docs/user/interface/ListView.dox index 69475e312f..730b5d8885 100644 --- a/docs/user/interface/ListView.dox +++ b/docs/user/interface/ListView.dox @@ -267,17 +267,6 @@ */ -/*! - \fn void BListView::KeyUp(const char* bytes, int32 numBytes) - \brief Hook method that is called when a keyboard key is released. - - \param bytes The \a bytes representing the keys released. - \param numBytes The size of \a bytes. - - \see BView::KeyUp() -*/ - - /*! \fn void BListView::MouseDown(BPoint point) \brief Hook method that is called when a mouse button is pushed down while @@ -475,7 +464,7 @@ /*! \fn bool BListView::AddList(BList* list) - \fn Add a \a list of list items to the end of the list view. + \brief Add a \a list of list items to the end of the list view. \param list The \a list of list items to add. @@ -698,7 +687,7 @@ /*! - \fn void BListView::DoForEach(bool (*func)(BListItem*)) + \fn void BListView::DoForEach(bool (*func)(BListItem* item)) \brief Calls the specified function on each item in the list. The \a func is called on the items in order starting with the item at index 0 @@ -712,7 +701,8 @@ /*! - \fn void BListView::DoForEach(bool (*func)(BListItem*, void*), void* arg) + \fn void BListView::DoForEach(bool (*func)(BListItem* item, void* arg), + void* arg) \brief Calls the specified function on each item in the list. The \a func is called on the items in order starting with the item at index 0 @@ -723,6 +713,7 @@ as the second argument. \param func The function to call on each item. + \param arg The second argument of the function. */ diff --git a/docs/user/interface/TextView.dox b/docs/user/interface/TextView.dox index 67a5626eda..d504f9917a 100644 --- a/docs/user/interface/TextView.dox +++ b/docs/user/interface/TextView.dox @@ -398,7 +398,8 @@ set in the BTextView with the font and color formats set by \a runs. \param text The text to set. - \param runs The text styling to set, can be \c NULL. + \param runs Set the font and color formats of the new text if provided. Only + applies if the BTextView permits multiple character formats. */ @@ -413,8 +414,9 @@ to 0 to clear the text from the BTextView. \param text The text to set. - \param length The number of bytes of text to set. - \param runs The text styling to use, can be \c NULL. + \param length The maximum number of bytes of \a text to use. + \param runs Set the font and color formats of the new text if provided. Only + applies if the BTextView permits multiple character formats. */ @@ -428,7 +430,8 @@ \param file The file to set the text from. \param offset The position in the file to start reading text. \param length The number of bytes of text to read from the file. - \param runs The text styling to use, can be \c NULL. + \param runs Set the font and color formats of the new text if provided. Only + applies if the BTextView permits multiple character formats. */ @@ -489,25 +492,6 @@ */ -//! @{ - - -/*! - \fn void BTextView::SetText(const char* text, const text_run_array* runs) -*/ - - -/*! - \fn void BTextView::SetText(const char* text, int32 length, - const text_run_array* runs) -*/ - - -/*! - \fn void BTextView::SetText(BFile* file, int32 offset, int32 length, - const text_run_array* runs) -*/ - //! @} From e141e6759627c594920f4cfa28c3a2a36f3c867a Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 8 Jul 2013 17:12:36 +0200 Subject: [PATCH 03/23] Debugger: ElfFile::_CheckRange(): fix check --- src/apps/debugger/elf/ElfFile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/debugger/elf/ElfFile.cpp b/src/apps/debugger/elf/ElfFile.cpp index 23294351e4..bbe6d1ce68 100644 --- a/src/apps/debugger/elf/ElfFile.cpp +++ b/src/apps/debugger/elf/ElfFile.cpp @@ -345,7 +345,7 @@ ElfFile::_LoadFile(const char* fileName) bool ElfFile::_CheckRange(off_t offset, off_t size) const { - return offset < fFileSize && offset + size < fFileSize; + return offset < fFileSize && offset + size <= fFileSize; } From 7de678860dbd54063e1873a2c76c058fe9d53c67 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 9 Jul 2013 11:59:43 -0500 Subject: [PATCH 04/23] RadeonHD: Fix some marketing names * Finally got Sea Islands sorted out (unless they add new chipsets to the line) --- src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index 6816c78efd..59ddaff9ed 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -292,7 +292,7 @@ const struct supported_device { {0x683b, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"}, {0x683f, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD 7750"}, {0x683d, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD 7770"}, - // Bonaire (TODO: Need to find friendly names) + // Bonaire (7xxx rebranded HD 8xxx) {0x6649, 6, 0, RADEON_BONAIRE, CHIP_STD, "Radeon HD Bonaire"}, {0x6650, 6, 0, RADEON_BONAIRE, CHIP_STD, "Radeon HD Bonaire"}, {0x6651, 6, 0, RADEON_BONAIRE, CHIP_STD, "Radeon HD Bonaire"}, @@ -320,14 +320,14 @@ const struct supported_device { {0x679a, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD 7950"}, {0x6798, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD 7970"}, {0x6799, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD 7990"}, + // Oland DCE 6,4 (7xxx rebranded HD 8xxx) // Marketing Names: Radeon HD 83xx - HD 89xx // Introduced: Late 2013 // Codename: Sea Islands // Process: 28 nm - // Oland DCE 6,4 - // Hainan NO DCE? - // Curacao ???? + // Hainan NODCE. No display hardware, OpenCL 3D engine. + // Curacao DCE 8.0 // Marketing Names: Radeon HD 9xxx - HD 9xxx // Introduced: 2014? From 991183511b154ecf3a60e5be62451cd997c7f6a6 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Tue, 9 Jul 2013 12:40:29 -0500 Subject: [PATCH 05/23] RadeonHD: Drop marketing names * They are all over the place.. I give up * Going off of engineering names and DCE is more accurate * A lot of this info came from the x.org wiki * I'd like to transition some of the engineering name checks to use DCE versions.. they tend to be more accurate and exact. (in some cases we can't, but most of the time we can) --- .../private/graphics/radeon_hd/radeon_hd.h | 76 ++++++++++--------- .../drivers/graphics/radeon_hd/driver.cpp | 37 +++++---- 2 files changed, 57 insertions(+), 56 deletions(-) diff --git a/headers/private/graphics/radeon_hd/radeon_hd.h b/headers/private/graphics/radeon_hd/radeon_hd.h index 7025ddf8cf..b979e1c7f7 100644 --- a/headers/private/graphics/radeon_hd/radeon_hd.h +++ b/headers/private/graphics/radeon_hd/radeon_hd.h @@ -62,43 +62,45 @@ enum radeon_chipset { RADEON_RS690, RADEON_RS740, RADEON_RV515, - RADEON_R520, //r500, Radeon X1300-X1950 - RADEON_RV530, - RADEON_RV560, - RADEON_RV570, - RADEON_R580, - RADEON_R600, //r600, Radeon HD 2000, 3000 - RADEON_RV610, - RADEON_RV630, - RADEON_RV670, - RADEON_RV620, - RADEON_RV635, - RADEON_RS780, - RADEON_RS880, - RADEON_RV770, //r700, Radeon HD 4000 - RADEON_RV730, - RADEON_RV710, - RADEON_RV740, - RADEON_CEDAR, //Evergreen, Radeon HD 5000 - RADEON_REDWOOD, - RADEON_JUNIPER, - RADEON_CYPRESS, - RADEON_HEMLOCK, - RADEON_PALM, //Fusion APU (NI), Radeon HD 6000 - RADEON_SUMO, - RADEON_SUMO2, - RADEON_CAICOS, //Nothern Islands, Radeon HD 6000 / Low end 7000 - RADEON_TURKS, - RADEON_BARTS, - RADEON_CAYMAN, - RADEON_ANTILLES, - RADEON_CAPEVERDE, //Southern Islands, Radeon HD 7000 aka ARUBA - RADEON_BONAIRE, - RADEON_PITCAIRN, - RADEON_TAHITI, - RADEON_OLAND, //Sea Islands, Radeon HD 8000 - RADEON_HAINAN, // NO DCE? - RADEON_CURACAO, + RADEON_R520, //r500, DCE 1.0 + RADEON_RV530, // DCE 1.0 + RADEON_RV560, // DCE 1.0 + RADEON_RV570, // DCE 1.0 + RADEON_R580, // DCE 1.0 + RADEON_R600, //r600, DCE 2.0 + RADEON_RV610, // DCE 2.0 + RADEON_RV630, // DCE 2.0 + RADEON_RV670, // DCE 2.0 + RADEON_RV620, // DCE 3.0 + RADEON_RV635, // DCE 3.0 + RADEON_RS780, // DCE 3.0 + RADEON_RS880, // DCE 3.0 + RADEON_RV770, //r700, DCE 3.1 + RADEON_RV730, // DCE 3.2 + RADEON_RV710, // DCE 3.2 + RADEON_RV740, // DCE 3.2 + RADEON_CEDAR, //Evergreen, DCE 4.0 + RADEON_REDWOOD, // DCE 4.0 + RADEON_JUNIPER, // DCE 4.0 + RADEON_CYPRESS, // DCE 4.0 + RADEON_HEMLOCK, // DCE 4.0? + RADEON_PALM, //Fusion APU (NI), DCE 4.1 + RADEON_SUMO, // DCE 4.1 + RADEON_SUMO2, // DCE 4.1 + RADEON_CAICOS, //Nothern Islands, DCE 5.0 + RADEON_TURKS, // DCE 5.0 + RADEON_BARTS, // DCE 5.0 + RADEON_CAYMAN, // DCE 5.0 + RADEON_ANTILLES, // DCE 5.0? + RADEON_CAPEVERDE, //Southern Islands, DCE 6.0 + RADEON_PITCAIRN, // DCE 6.0 + RADEON_TAHITI, // DCE 6.0 + RADEON_ARUBA, // DCE 6.1 Trinity/Richland + RADEON_OLAND, // DCE 6.4 + RADEON_HAINAN, // NO DCE + RADEON_KAVERI, //Sea Islands, DCE 8.1 + RADEON_BONAIRE, // DCE 8.2 + RADEON_KABINI, // DCE 8.3 }; diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp index 59ddaff9ed..21bf09c0db 100644 --- a/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp +++ b/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp @@ -160,8 +160,9 @@ const struct supported_device { {0x9460, 3, 1, RADEON_RV770, CHIP_STD, "Radeon HD 4890"}, // From here on AMD no longer used numeric identifiers + // Marketing names can collide for different generations of cards + // as such we should ignore them at all costs (besides the card name) - // Marketing Names: Radeon HD 5450 - HD 6320 // Introduced: 2009 // Codename: Evergreen // Process: 40 nm @@ -210,7 +211,6 @@ const struct supported_device { {0x9644, 4, 1, RADEON_SUMO2, CHIP_APU, "Radeon HD 6410D"}, {0x9645, 4, 1, RADEON_SUMO2, CHIP_APU, "Radeon HD SUMO2 M"}, - // Radeon HD 6450 - HD 7670 // Introduced: 2010 // Codename: Nothern Islands // Process: 40 nm @@ -268,11 +268,11 @@ const struct supported_device { // Antilles (Top, Dual GPU) {0x671d, 5, 0, RADEON_ANTILLES, CHIP_STD, "Radeon HD 6990"}, - // Marketing Names: Radeon HD 7750 - HD 79xx + // Introduced: Late 2011 // Codename: Southern Islands // Process: 28 nm - // Cape Verde (TODO: Need to find friendly names) + // Cape Verde {0x6820, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"}, {0x6821, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"}, {0x6823, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"}, @@ -292,14 +292,7 @@ const struct supported_device { {0x683b, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"}, {0x683f, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD 7750"}, {0x683d, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD 7770"}, - // Bonaire (7xxx rebranded HD 8xxx) - {0x6649, 6, 0, RADEON_BONAIRE, CHIP_STD, "Radeon HD Bonaire"}, - {0x6650, 6, 0, RADEON_BONAIRE, CHIP_STD, "Radeon HD Bonaire"}, - {0x6651, 6, 0, RADEON_BONAIRE, CHIP_STD, "Radeon HD Bonaire"}, - {0x6658, 6, 0, RADEON_BONAIRE, CHIP_STD, "Radeon HD Bonaire"}, - {0x665c, 6, 0, RADEON_BONAIRE, CHIP_STD, "Radeon HD 7790"}, - {0x665d, 6, 0, RADEON_BONAIRE, CHIP_STD, "Radeon HD Bonaire"}, - // Pitcairn (TODO: Need to find friendly names) + // Pitcairn {0x6800, 6, 0, RADEON_PITCAIRN, CHIP_MOBILE, "Radeon HD 7970"}, {0x6801, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD Pitcairn"}, {0x6802, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD Pitcairn"}, @@ -309,7 +302,7 @@ const struct supported_device { {0x6818, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD 7870"}, {0x6819, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD 7800"}, {0x684c, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD Pitcairn"}, - // Tahiti (TODO: Need to find friendly names) + // Tahiti {0x6780, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD Tahiti"}, {0x6784, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD Tahiti"}, {0x6788, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD Tahiti"}, @@ -320,21 +313,27 @@ const struct supported_device { {0x679a, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD 7950"}, {0x6798, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD 7970"}, {0x6799, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD 7990"}, - // Oland DCE 6,4 (7xxx rebranded HD 8xxx) + // Aruba DCE 6.1 Trinity / Richland + // Oland DCE 6,4 + // Hainan NODCE. No display hardware, OpenCL 3D engine. - // Marketing Names: Radeon HD 83xx - HD 89xx // Introduced: Late 2013 // Codename: Sea Islands // Process: 28 nm - // Hainan NODCE. No display hardware, OpenCL 3D engine. - // Curacao DCE 8.0 + // Kaveri DCE 8.1 + // Bonaire DCE 8.2 + {0x6649, 8, 2, RADEON_BONAIRE, CHIP_STD, "Radeon HD Bonaire"}, + {0x6650, 8, 2, RADEON_BONAIRE, CHIP_STD, "Radeon HD Bonaire"}, + {0x6651, 8, 2, RADEON_BONAIRE, CHIP_STD, "Radeon HD Bonaire"}, + {0x6658, 8, 2, RADEON_BONAIRE, CHIP_STD, "Radeon HD Bonaire"}, + {0x665c, 8, 2, RADEON_BONAIRE, CHIP_STD, "Radeon HD 7790"}, + {0x665d, 8, 2, RADEON_BONAIRE, CHIP_STD, "Radeon HD Bonaire"}, + // Kabini DCE 8.3 - // Marketing Names: Radeon HD 9xxx - HD 9xxx // Introduced: 2014? // Codename: Volcanic Islands // Process: 20 nm - // Marketing Names: Radeon HD 9xxx - HD 9xxx // Introduced: 2015? // Codename: Pirate Islands // Process: ?? nm From 91c6c2ec21d91942c9286983d318845ba0854ae5 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Mon, 8 Jul 2013 23:21:36 -0400 Subject: [PATCH 06/23] Debugger: fix value reading problem. When reading a variable value from a register, if the value's size is smaller than the size of the register and the architecture is little endian, we need to adjust the bit offset we read from in addition to byte swapping, otherwise we wind up reading the wrong bytes. This was mainly noticeable in the case of functions that returned boolean values, which would consequently sometimes show up incorrectly. --- src/apps/debugger/value/ValueLoader.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/apps/debugger/value/ValueLoader.cpp b/src/apps/debugger/value/ValueLoader.cpp index 81b7bfb22e..19f313669a 100644 --- a/src/apps/debugger/value/ValueLoader.cpp +++ b/src/apps/debugger/value/ValueLoader.cpp @@ -1,5 +1,6 @@ /* * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -178,8 +179,10 @@ ValueLoader::LoadValue(ValueLocation* location, type_code valueType, if (registerValue.Size() < bytesToRead) return B_ENTRY_NOT_FOUND; - if (!bigEndian) + if (!bigEndian) { registerValue.SwapEndianess(); + bitOffset = registerValue.Size() * 8 - bitOffset - bitSize; + } valueBuffer.AddBits(registerValue.Bytes(), bitSize, bitOffset); break; } From 86340fcef302ddfcabd57f1fc21e23371ff69bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 9 Jul 2013 23:17:45 +0200 Subject: [PATCH 07/23] kernel/int.cpp: typo fix --- src/system/kernel/int.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/kernel/int.cpp b/src/system/kernel/int.cpp index 9916e4b718..6f9de63a76 100644 --- a/src/system/kernel/int.cpp +++ b/src/system/kernel/int.cpp @@ -457,7 +457,7 @@ reserve_io_interrupt_vectors(long count, long startVector) } -/*! Allocate \a count contigous interrupt vectors. The vectors are allocated +/*! Allocate \a count contiguous interrupt vectors. The vectors are allocated as available so that they do not overlap with any other reserved vector. The first vector to be used is returned in \a startVector on success. */ From 0c0f333a67770cd68b21d906ec97f2f5d127d162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 9 Jul 2013 23:27:28 +0200 Subject: [PATCH 08/23] PCI: added MSI-X and HyperTransport definitions * renamed PCI_cap_id_ldt to PCI_cap_id_ht --- headers/os/drivers/PCI.h | 50 ++++++++++++++++++- .../kernel/bus_managers/pci/pci_info.cpp | 4 +- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/headers/os/drivers/PCI.h b/headers/os/drivers/PCI.h index 1210349995..dd3db1ea48 100644 --- a/headers/os/drivers/PCI.h +++ b/headers/os/drivers/PCI.h @@ -644,6 +644,8 @@ struct pci_module_info { #define PCI_address_io_mask 0xFFFFFFFC /* mask to get i/o space base address */ +#define PCI_range_memory_mask 0xFFFFFFF0 /* mask to get memory ranges */ + /* --- masks for flags in expansion rom base address registers @@ -686,7 +688,7 @@ struct pci_module_info { #define PCI_cap_id_msi 0x05 /* Message signalled interrupt */ #define PCI_cap_id_chswp 0x06 /* Compact PCI HotSwap */ #define PCI_cap_id_pcix 0x07 /* PCI-X */ -#define PCI_cap_id_ldt 0x08 +#define PCI_cap_id_ht 0x08 /* HyperTransport */ #define PCI_cap_id_vendspec 0x09 #define PCI_cap_id_debugport 0x0a #define PCI_cap_id_cpci_rsrcctl 0x0b @@ -773,6 +775,52 @@ struct pci_module_info { #define PCI_msi_control_mmc_16 0x0008 #define PCI_msi_control_mmc_32 0x000a +/** MSI-X registers **/ +#define PCI_msix_control 0x02 +#define PCI_msix_table 0x04 +#define PCI_msix_pba 0x08 + +#define PCI_msix_control_table_size 0x07ff +#define PCI_msix_control_function_mask 0x4000 +#define PCI_msix_control_enable 0x8000 +#define PCI_msix_bir_mask 0x0007 +#define PCI_msix_bir_0 0x10 +#define PCI_msix_bir_1 0x14 +#define PCI_msix_bir_2 0x18 +#define PCI_msix_bir_3 0x1c +#define PCI_msix_bir_4 0x20 +#define PCI_msix_bir_5 0x24 +#define PCI_msix_offset_mask 0xfff8 + +#define PCI_msix_vctrl_mask 0x0001 + +/** HyperTransport registers **/ +#define PCI_ht_command 0x02 +#define PCI_ht_msi_address_low 0x04 +#define PCI_ht_msi_address_high 0x08 + +#define PCI_ht_command_cap_mask 0xf800 +#define PCI_ht_command_cap_slave 0x0000 +#define PCI_ht_command_cap_host 0x2000 +#define PCI_ht_command_cap_switch 0x4000 +#define PCI_ht_command_cap_interrupt 0x8000 +#define PCI_ht_command_cap_revision_id 0x8800 +#define PCI_ht_command_cap_unit_id_clumping 0x9000 +#define PCI_ht_command_cap_ext_config_space 0x9800 +#define PCI_ht_command_cap_address_mapping 0xa000 +#define PCI_ht_command_cap_msi_mapping 0xa800 +#define PCI_ht_command_cap_direct_route 0xb000 +#define PCI_ht_command_cap_vcset 0xb800 +#define PCI_ht_command_cap_retry_mode 0xc000 +#define PCI_ht_command_cap_x86_encoding 0xc800 +#define PCI_ht_command_cap_gen3 0xd000 +#define PCI_ht_command_cap_fle 0xd800 +#define PCI_ht_command_cap_pm 0xe000 +#define PCI_ht_command_cap_high_node_count 0xe800 + +#define PCI_ht_command_msi_enable 0x0001 +#define PCI_ht_command_msi_fixed 0x0002 + #ifdef __cplusplus } #endif diff --git a/src/add-ons/kernel/bus_managers/pci/pci_info.cpp b/src/add-ons/kernel/bus_managers/pci/pci_info.cpp index e5758f2d85..f478b7f037 100644 --- a/src/add-ons/kernel/bus_managers/pci/pci_info.cpp +++ b/src/add-ons/kernel/bus_managers/pci/pci_info.cpp @@ -310,8 +310,8 @@ get_capability_name(uint8 cap_id) return "CompactPCIHotSwap"; case PCI_cap_id_pcix: return "PCI-X"; - case PCI_cap_id_ldt: - return "ldt"; + case PCI_cap_id_ht: + return "HyperTransport"; case PCI_cap_id_vendspec: return "vendspec"; case PCI_cap_id_debugport: From 8cd7d436705bff6300901a77a9eb1727491f2234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 9 Jul 2013 23:31:58 +0200 Subject: [PATCH 09/23] PCI: implemented reading, configuring and enabling MSI-X. --- .../pci/arch/x86/pci_arch_info.cpp | 1 + .../bus_managers/pci/arch/x86/pci_arch_info.h | 1 + .../bus_managers/pci/arch/x86/pci_msi.cpp | 274 ++++++++++++++++++ .../bus_managers/pci/arch/x86/pci_msi.h | 33 +++ 4 files changed, 309 insertions(+) diff --git a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.cpp b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.cpp index f27393a1d0..3071c12245 100644 --- a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.cpp +++ b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.cpp @@ -9,4 +9,5 @@ void pci_read_arch_info(PCIDev *dev) { pci_read_msi_info(dev); + pci_read_msix_info(dev); } diff --git a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.h b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.h index 544eec9a65..4822dbe007 100644 --- a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.h +++ b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.h @@ -9,6 +9,7 @@ typedef struct pci_arch_info { msi_info msi; + msix_info msix; } pci_arch_info; diff --git a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.cpp b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.cpp index cbfe5efb04..590551bff3 100644 --- a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.cpp +++ b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.cpp @@ -1,4 +1,5 @@ /* + * Copyright 2013, Jérôme Duval, korli@users.berlios.de. * Copyright 2010, Michael Lotz, mmlr@mlotz.ch. All Rights Reserved. * Distributed under the terms of the MIT License. */ @@ -225,3 +226,276 @@ pci_read_msi_info(PCIDev *device) info->data_value = 0; info->address_value = 0; } + + +uint8 +pci_get_msix_count(uint8 virtualBus, uint8 _device, uint8 function) +{ + if (!msi_supported()) + return 0; + + uint8 bus; + uint8 domain; + if (gPCI->ResolveVirtualBus(virtualBus, &domain, &bus) != B_OK) + return 0; + + PCIDev *device = gPCI->FindDevice(domain, bus, _device, function); + if (device == NULL) + return 0; + + msix_info *info = &device->arch_info.msix; + if (!info->msix_capable) + return 0; + + return info->message_count; +} + + +status_t +pci_configure_msix(uint8 virtualBus, uint8 _device, uint8 function, + uint8 count, uint8 *startVector) +{ + if (!msi_supported()) + return B_UNSUPPORTED; + + if (count == 0 || startVector == NULL) + return B_BAD_VALUE; + + uint8 bus; + uint8 domain; + status_t result = gPCI->ResolveVirtualBus(virtualBus, &domain, &bus); + if (result != B_OK) + return result; + + PCIDev *device = gPCI->FindDevice(domain, bus, _device, function); + if (device == NULL) + return B_ERROR; + + msix_info *info = &device->arch_info.msix; + if (!info->msix_capable) + return B_UNSUPPORTED; + + if (count > 32 || count > info->message_count) { + return B_BAD_VALUE; + } + + if (info->configured_count != 0) + return B_BUSY; + + // map the table bar + size_t tableSize = info->message_count * 16; + addr_t address; + area_id area = map_physical_memory("msi table map", + device->info.u.h0.base_registers[info->table_bar], + tableSize + info->table_offset, + B_ANY_KERNEL_ADDRESS, B_READ_AREA | B_WRITE_AREA, (void**)&address); + if (area < 0) + return area; + info->table_area_id = area; + info->table_address = address + info->table_offset; + + // and the pba bar if necessary + if (info->table_bar != info->pba_bar) { + area = map_physical_memory("msi pba map", + device->info.u.h0.base_registers[info->pba_bar], + tableSize + info->pba_offset, + B_ANY_KERNEL_ADDRESS, B_READ_AREA | B_WRITE_AREA, + (void**)&address); + if (area < 0) { + delete_area(info->table_area_id); + info->table_area_id = -1; + return area; + } + info->pba_area_id = area; + } else + info->pba_area_id = -1; + info->pba_address = address + info->pba_offset; + + result = msi_allocate_vectors(count, &info->start_vector, + &info->address_value, &info->data_value); + if (result != B_OK) { + delete_area(info->pba_area_id); + delete_area(info->table_area_id); + info->pba_area_id = -1; + info->table_area_id = -1; + return result; + } + + // ensure the memory i/o is enabled + gPCI->WriteConfig(device, PCI_command, 2, + gPCI->ReadConfig(device, PCI_command, 2) | PCI_command_memory); + + uint32 data_value = info->data_value; + for (uint32 index = 0; index < count; index++) { + volatile uint32 *entry = (uint32*)(info->table_address + 16 * index); + *(entry + 3) |= PCI_msix_vctrl_mask; + *entry++ = info->address_value & 0xffffffff; + *entry++ = info->address_value >> 32; + *entry++ = data_value++; + *entry &= ~PCI_msix_vctrl_mask; + } + + info->configured_count = count; + *startVector = info->start_vector; + dprintf("msix configured for %d vectors\n", count); + return B_OK; +} + + +status_t +pci_unconfigure_msix(uint8 virtualBus, uint8 _device, uint8 function) +{ + if (!msi_supported()) + return B_UNSUPPORTED; + + uint8 bus; + uint8 domain; + status_t result = gPCI->ResolveVirtualBus(virtualBus, &domain, &bus); + if (result != B_OK) + return result; + + PCIDev *device = gPCI->FindDevice(domain, bus, _device, function); + if (device == NULL) + return B_ERROR; + + msix_info *info = &device->arch_info.msix; + if (!info->msix_capable) + return B_UNSUPPORTED; + + if (info->configured_count == 0) + return B_NO_INIT; + + // disable msi-x generation + info->control_value &= ~PCI_msix_control_enable; + gPCI->WriteConfig(device, info->capability_offset + PCI_msix_control, 2, + info->control_value); + + msi_free_vectors(info->configured_count, info->start_vector); + for (uint8 index = 0; index < info->configured_count; index++) { + volatile uint32 *entry = (uint32*)(info->table_address + 16 * index); + if ((*(entry + 3) & PCI_msix_vctrl_mask) == 0) + *(entry + 3) |= PCI_msix_vctrl_mask; + } + + if (info->pba_area_id != -1) + delete_area(info->pba_area_id); + if (info->table_area_id != -1) + delete_area(info->table_area_id); + info->pba_area_id= -1; + info->table_area_id = -1; + + info->configured_count = 0; + info->address_value = 0; + info->data_value = 0; + return B_OK; +} + + +status_t +pci_enable_msix(uint8 virtualBus, uint8 _device, uint8 function) +{ + if (!msi_supported()) + return B_UNSUPPORTED; + + uint8 bus; + uint8 domain; + status_t result = gPCI->ResolveVirtualBus(virtualBus, &domain, &bus); + if (result != B_OK) + return result; + + PCIDev *device = gPCI->FindDevice(domain, bus, _device, function); + if (device == NULL) + return B_ERROR; + + msix_info *info = &device->arch_info.msix; + if (!info->msix_capable) + return B_UNSUPPORTED; + + if (info->configured_count == 0) + return B_NO_INIT; + + // ensure the pinned interrupt is disabled + gPCI->WriteConfig(device, PCI_command, 2, + gPCI->ReadConfig(device, PCI_command, 2) | PCI_command_int_disable); + + // enable msi-x generation + info->control_value |= PCI_msix_control_enable; + gPCI->WriteConfig(device, info->capability_offset + PCI_msix_control, 2, + info->control_value); + + dprintf("msi-x enabled: 0x%04" B_PRIx32 "\n", + gPCI->ReadConfig(device, info->capability_offset + PCI_msix_control, 2)); + return B_OK; +} + + +status_t +pci_disable_msix(uint8 virtualBus, uint8 _device, uint8 function) +{ + if (!msi_supported()) + return B_UNSUPPORTED; + + uint8 bus; + uint8 domain; + status_t result = gPCI->ResolveVirtualBus(virtualBus, &domain, &bus); + if (result != B_OK) + return result; + + PCIDev *device = gPCI->FindDevice(domain, bus, _device, function); + if (device == NULL) + return B_ERROR; + + msix_info *info = &device->arch_info.msix; + if (!info->msix_capable) + return B_UNSUPPORTED; + + if (info->configured_count == 0) + return B_NO_INIT; + + // disable msi-x generation + info->control_value &= ~PCI_msix_control_enable; + gPCI->WriteConfig(device, info->capability_offset + PCI_msix_control, 2, + info->control_value); + + return B_OK; +} + + +void +pci_read_msix_info(PCIDev *device) +{ + if (!msi_supported()) + return; + + msix_info *info = &device->arch_info.msix; + info->msix_capable = false; + status_t result = gPCI->FindCapability(device->domain, device->bus, + device->device, device->function, PCI_cap_id_msix, + &info->capability_offset); + if (result != B_OK) + return; + + info->msix_capable = true; + info->control_value = gPCI->ReadConfig(device->domain, device->bus, + device->device, device->function, + info->capability_offset + PCI_msix_control, 2); + info->message_count + = (info->control_value & PCI_msix_control_table_size) + 1; + info->configured_count = 0; + info->data_value = 0; + info->address_value = 0; + info->table_area_id = -1; + info->pba_area_id = -1; + uint32 table_value = gPCI->ReadConfig(device->domain, device->bus, + device->device, device->function, + info->capability_offset + PCI_msix_table, 4); + uint32 pba_value = gPCI->ReadConfig(device->domain, device->bus, + device->device, device->function, + info->capability_offset + PCI_msix_pba, 4); + + info->table_bar = table_value & PCI_msix_bir_mask; + info->table_offset = table_value & PCI_msix_offset_mask; + info->pba_bar = pba_value & PCI_msix_bir_mask; + info->pba_offset = pba_value & PCI_msix_offset_mask; +} + diff --git a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.h b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.h index 849e3b25df..286d030f1a 100644 --- a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.h +++ b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.h @@ -1,12 +1,15 @@ /* + * Copyright 2013, Jérôme Duval, korli@users.berlios.de. * Copyright 2010, Michael Lotz, mmlr@mlotz.ch. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _PCI_x86_MSI_H #define _PCI_x86_MSI_H +#include #include + class PCIDev; // Message Signaled Interrupts @@ -30,4 +33,34 @@ status_t pci_enable_msi(uint8 virtualBus, uint8 device, uint8 function); status_t pci_disable_msi(uint8 virtualBus, uint8 device, uint8 function); void pci_read_msi_info(PCIDev *device); + +// Message Signaled Interrupts +typedef struct msix_info { + bool msix_capable; + uint8 capability_offset; + uint8 message_count; + uint8 table_bar; + uint32 table_offset; + area_id table_area_id; + addr_t table_address; + uint8 pba_bar; + uint32 pba_offset; + area_id pba_area_id; + addr_t pba_address; + uint8 configured_count; + uint8 start_vector; + uint16 control_value; + uint16 data_value; + uint64 address_value; +} msix_info; + + +uint8 pci_get_msix_count(uint8 virtualBus, uint8 _device, uint8 function); +status_t pci_configure_msix(uint8 virtualBus, uint8 _device, uint8 function, + uint8 count, uint8 *startVector); +status_t pci_unconfigure_msix(uint8 virtualBus, uint8 device, uint8 function); +status_t pci_enable_msix(uint8 virtualBus, uint8 _device, uint8 function); +status_t pci_disable_msix(uint8 virtualBus, uint8 _device, uint8 function); +void pci_read_msix_info(PCIDev *device); + #endif // _PCI_x86_MSI_H From 25b723638df76e0c47d02a0e1c1b3c3534735189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Tue, 9 Jul 2013 23:33:27 +0200 Subject: [PATCH 10/23] PCI: the x86 module now exports an MSI-X API. --- headers/os/drivers/PCI_x86.h | 27 +++++++++++++++++++ .../pci/arch/x86/pci_arch_module.cpp | 7 ++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/headers/os/drivers/PCI_x86.h b/headers/os/drivers/PCI_x86.h index fc6f6af00d..d20961fb08 100644 --- a/headers/os/drivers/PCI_x86.h +++ b/headers/os/drivers/PCI_x86.h @@ -35,6 +35,33 @@ typedef struct pci_x86_module_info { uint8 bus, /* bus number */ uint8 device, /* device # on bus */ uint8 function); /* function # in device */ + + uint8 (*get_msix_count)( + uint8 bus, /* bus number */ + uint8 device, /* device # on bus */ + uint8 function); /* function # in device */ + + status_t (*configure_msix)( + uint8 bus, /* bus number */ + uint8 device, /* device # on bus */ + uint8 function, /* function # in device */ + uint8 count, /* count of vectors desired */ + uint8 *startVector); /* first configured vector */ + status_t (*unconfigure_msix)( + uint8 bus, /* bus number */ + uint8 device, /* device # on bus */ + uint8 function); /* function # in device */ + + status_t (*enable_msix)( + uint8 bus, /* bus number */ + uint8 device, /* device # on bus */ + uint8 function); /* function # in device */ + status_t (*disable_msix)( + uint8 bus, /* bus number */ + uint8 device, /* device # on bus */ + uint8 function); /* function # in device */ + + } pci_x86_module_info; #define B_PCI_X86_MODULE_NAME "bus_managers/pci/x86/v1" diff --git a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_module.cpp b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_module.cpp index 1ebb7005dc..0220bf7677 100644 --- a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_module.cpp +++ b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_module.cpp @@ -42,5 +42,10 @@ pci_x86_module_info gPCIArchModule = { &pci_configure_msi, &pci_unconfigure_msi, &pci_enable_msi, - &pci_disable_msi + &pci_disable_msi, + &pci_get_msix_count, + &pci_configure_msix, + &pci_unconfigure_msix, + &pci_enable_msix, + &pci_disable_msix }; From 8f5729e1b9e1bc1f27a8752eee01792d8c9d3ddf Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Tue, 9 Jul 2013 22:00:33 -0400 Subject: [PATCH 11/23] Debugger: ValueLoader: Add TODO note. --- src/apps/debugger/value/ValueLoader.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/apps/debugger/value/ValueLoader.cpp b/src/apps/debugger/value/ValueLoader.cpp index 19f313669a..9d973ebe40 100644 --- a/src/apps/debugger/value/ValueLoader.cpp +++ b/src/apps/debugger/value/ValueLoader.cpp @@ -122,6 +122,11 @@ ValueLoader::LoadValue(ValueLocation* location, type_code valueType, uint32 bytesToRead = piece.size; uint32 bitSize = piece.bitSize; uint8 bitOffset = piece.bitOffset; + // TODO: the offset's ordinal position and direction aren't + // specified by DWARF, and simply follow the target language. + // To handle non C/C++ languages properly, the corresponding + // SourceLanguage will need to be passed in and extended to + // return the relevant information. switch (piece.type) { case VALUE_PIECE_LOCATION_INVALID: From d1a2f6371a3223da24a34eba800c365d21805780 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Wed, 10 Jul 2013 14:02:05 +0100 Subject: [PATCH 12/23] sysinfo: Fixed incorrect memory stats on PAE systems. Memory statistics were calculated as 32-bit values, so they were incorrect on machines with more than 4GB RAM (and on x86_64). --- src/bin/sysinfo.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bin/sysinfo.cpp b/src/bin/sysinfo.cpp index bff7ec31a0..552b3b4f72 100644 --- a/src/bin/sysinfo.cpp +++ b/src/bin/sysinfo.cpp @@ -686,13 +686,13 @@ dump_cpus(system_info *info) static void dump_mem(system_info *info) { - printf("%10" B_PRIu32 " bytes free (used/max %10" B_PRIu32 " / %10" - B_PRIu32 ")\n", - B_PAGE_SIZE * (uint32)(info->max_pages - info->used_pages), - B_PAGE_SIZE * (uint32)info->used_pages, - B_PAGE_SIZE * (uint32)info->max_pages); - printf(" (cached %10" B_PRIu32 ")\n", - B_PAGE_SIZE * (uint32)info->cached_pages); + printf("%10" B_PRIu64 " bytes free (used/max %10" B_PRIu64 " / %10" + B_PRIu64 ")\n", + B_PAGE_SIZE * (uint64)(info->max_pages - info->used_pages), + B_PAGE_SIZE * (uint64)info->used_pages, + B_PAGE_SIZE * (uint64)info->max_pages); + printf(" (cached %10" B_PRIu64 ")\n", + B_PAGE_SIZE * (uint64)info->cached_pages); } From 7164302bb6a45c44c9979928353b51d323e9252d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 10 Jul 2013 18:26:03 +0200 Subject: [PATCH 13/23] PCI: added definitions for NVM Express storage controller subclass. --- headers/os/drivers/PCI.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/headers/os/drivers/PCI.h b/headers/os/drivers/PCI.h index dd3db1ea48..0e5b1d8bdb 100644 --- a/headers/os/drivers/PCI.h +++ b/headers/os/drivers/PCI.h @@ -324,6 +324,7 @@ struct pci_module_info { #define PCI_ata 0x05 /* ATA controller with ADMA interface */ #define PCI_sata 0x06 /* Serial ATA controller */ #define PCI_sas 0x07 /* Serial Attached SCSI controller */ +#define PCI_nvm 0x08 /* NVM Express controller */ #define PCI_mass_storage_other 0x80 /* other mass storage controller */ /* --- @@ -335,6 +336,15 @@ struct pci_module_info { #define PCI_sata_other 0x00 /* vendor specific interface */ #define PCI_sata_ahci 0x01 /* AHCI interface */ +/* --- + values of the class_api field for + class_base = 0x01 (mass storage) + class_sub = 0x08 (NVM Express controller) +--- */ + +#define PCI_nvm_other 0x00 /* vendor specific interface */ +#define PCI_nvm_hci 0x01 /* NVMHCI interface 1.0 */ +#define PCI_nvm_hci_enterprise 0x02 /* NVMHCI enterprise */ /* --- values for the class_sub field for class_base = 0x02 (network) From ca5654d898780fc4ac7ebf462e425dcab776d755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 10 Jul 2013 19:17:37 +0200 Subject: [PATCH 14/23] PCI: added FindHTCapability() for HyperTransport capabilities. * untested. * as it's possible to have several HyperTransport capability blocks, the offset parameter is used as the start pointer for the search in case it's non zero. --- src/add-ons/kernel/bus_managers/pci/pci.cpp | 54 +++++++++++++++++++++ src/add-ons/kernel/bus_managers/pci/pci.h | 7 ++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/bus_managers/pci/pci.cpp b/src/add-ons/kernel/bus_managers/pci/pci.cpp index f13d492e62..91c1132c56 100644 --- a/src/add-ons/kernel/bus_managers/pci/pci.cpp +++ b/src/add-ons/kernel/bus_managers/pci/pci.cpp @@ -1668,6 +1668,60 @@ PCI::FindExtendedCapability(PCIDev *device, uint16 capID, uint16 *offset) } +status_t +PCI::FindHTCapability(uint8 domain, uint8 bus, uint8 device, + uint8 function, uint16 capID, uint8 *offset) +{ + uint8 capPointer; + // consider the passed offset as the current ht capability block pointer + // when it's non zero + if (offset != NULL && *offset != 0) { + capPointer = ReadConfig(domain, bus, device, function, *offset + 1, + 1); + } else if (FindCapability(domain, bus, device, function, PCI_cap_id_ht, + &capPointer) != B_OK) { + FLOW("PCI:FindHTCapability ERROR %u:%u:%u capability %#02x " + "not supported\n", bus, device, function, capID); + return B_NAME_NOT_FOUND; + } + + uint16 mask = PCI_ht_command_cap_mask; + if (capID == PCI_ht_command_cap_slave || capID == PCI_ht_command_cap_host) + mask = 0xe000; + for (int i = 0; i < 48; i++) { + capPointer &= ~3; + if (capPointer == 0) + return B_NAME_NOT_FOUND; + + uint8 capability = ReadConfig(domain, bus, device, function, + capPointer, 1); + if (capability == PCI_cap_id_ht) { + if ((ReadConfig(domain, bus, device, function, + capPointer + PCI_ht_command, 2) & mask) == capID) { + if (offset != NULL) + *offset = capPointer; + return B_OK; + } + } + + capPointer = ReadConfig(domain, bus, device, function, capPointer + 1, + 1); + } + + TRACE_CAP("PCI:FindHTCapability ERROR %u:%u:%u capability %#04x " + "circular list\n", bus, device, function, capID); + return B_ERROR; +} + + +status_t +PCI::FindHTCapability(PCIDev *device, uint16 capID, uint8 *offset) +{ + return FindHTCapability(device->domain, device->bus, device->device, + device->function, capID, offset); +} + + PCIDev * PCI::FindDevice(uint8 domain, uint8 bus, uint8 device, uint8 function) { diff --git a/src/add-ons/kernel/bus_managers/pci/pci.h b/src/add-ons/kernel/bus_managers/pci/pci.h index 2b5f57eabc..3a434a3214 100644 --- a/src/add-ons/kernel/bus_managers/pci/pci.h +++ b/src/add-ons/kernel/bus_managers/pci/pci.h @@ -100,7 +100,12 @@ public: uint16 *offset = NULL); status_t FindExtendedCapability(PCIDev *device, uint16 capID, uint16 *offset = NULL); - + status_t FindHTCapability(uint8 domain, uint8 bus, + uint8 device, uint8 function, uint16 capID, + uint8 *offset); + status_t FindHTCapability(PCIDev *device, + uint16 capID, uint8 *offset = NULL); + status_t ResolveVirtualBus(uint8 virtualBus, uint8 *domain, uint8 *bus); From 8986cafc46105dea6cdce87f2b43ddd3f536c1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 10 Jul 2013 20:57:06 +0200 Subject: [PATCH 15/23] PCI: added some missing subclasses definitions * also renamed the HT capability mask --- headers/os/drivers/PCI.h | 9 ++++++++- src/add-ons/kernel/bus_managers/pci/pci.cpp | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/headers/os/drivers/PCI.h b/headers/os/drivers/PCI.h index 0e5b1d8bdb..873f3aceb4 100644 --- a/headers/os/drivers/PCI.h +++ b/headers/os/drivers/PCI.h @@ -355,6 +355,8 @@ struct pci_module_info { #define PCI_fddi 0x02 /* FDDI controller */ #define PCI_atm 0x03 /* ATM controller */ #define PCI_isdn 0x04 /* ISDN controller */ +#define PCI_worldfip 0x05 /* WorldFip controller */ +#define PCI_picmg 0x06 /* PICMG controller */ #define PCI_network_other 0x80 /* other network controller */ @@ -415,6 +417,8 @@ struct pci_module_info { #define PCI_parallel 0x01 /* parallel port */ #define PCI_multiport_serial 0x02 /* multiport serial controller */ #define PCI_modem 0x03 /* modem */ +#define PCI_gpib 0x04 /* GPIB controller */ +#define PCI_smart_card 0x05 /* Smard Card controller */ #define PCI_simple_communications_other 0x80 /* other communications device */ /* --- @@ -449,6 +453,8 @@ struct pci_module_info { #define PCI_timer 0x02 /* timers */ #define PCI_rtc 0x03 /* real time clock */ #define PCI_generic_hot_plug 0x04 /* generic PCI hot-plug controller */ +#define PCI_sd_host 0x05 /* SD Host controller */ +#define PCI_iommu 0x06 /* IOMMU */ #define PCI_system_peripheral_other 0x80 /* other generic system peripheral */ /* --- @@ -809,7 +815,8 @@ struct pci_module_info { #define PCI_ht_msi_address_low 0x04 #define PCI_ht_msi_address_high 0x08 -#define PCI_ht_command_cap_mask 0xf800 +#define PCI_ht_command_cap_mask_3_bits 0xe000 +#define PCI_ht_command_cap_mask_5_bits 0xf800 #define PCI_ht_command_cap_slave 0x0000 #define PCI_ht_command_cap_host 0x2000 #define PCI_ht_command_cap_switch 0x4000 diff --git a/src/add-ons/kernel/bus_managers/pci/pci.cpp b/src/add-ons/kernel/bus_managers/pci/pci.cpp index 91c1132c56..14ae42f23e 100644 --- a/src/add-ons/kernel/bus_managers/pci/pci.cpp +++ b/src/add-ons/kernel/bus_managers/pci/pci.cpp @@ -1685,9 +1685,9 @@ PCI::FindHTCapability(uint8 domain, uint8 bus, uint8 device, return B_NAME_NOT_FOUND; } - uint16 mask = PCI_ht_command_cap_mask; + uint16 mask = PCI_ht_command_cap_mask_5_bits; if (capID == PCI_ht_command_cap_slave || capID == PCI_ht_command_cap_host) - mask = 0xe000; + mask = PCI_ht_command_cap_mask_3_bits; for (int i = 0; i < 48; i++) { capPointer &= ~3; if (capPointer == 0) From 5994a55ab93c18cefab4215ae00cc66adc3d3daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 10 Jul 2013 22:19:30 +0200 Subject: [PATCH 16/23] PCI: added a HyperTransport mapping info for x86 * fill it with HT MSI mapping capability information. * enable/disable mapping on the device accordingly in enable_msi(), disable_msi(), enable_msix(), disable_msix(). * untested. The mapping could instead be enabled/disabled on the HT PCI bus, aka the parent device of the device passed to enable_msi/disable_msix(). --- .../pci/arch/x86/pci_arch_info.cpp | 1 + .../bus_managers/pci/arch/x86/pci_arch_info.h | 1 + .../bus_managers/pci/arch/x86/pci_msi.cpp | 66 +++++++++++++++++++ .../bus_managers/pci/arch/x86/pci_msi.h | 19 +++++- 4 files changed, 85 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.cpp b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.cpp index 3071c12245..38f18df191 100644 --- a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.cpp +++ b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.cpp @@ -10,4 +10,5 @@ pci_read_arch_info(PCIDev *dev) { pci_read_msi_info(dev); pci_read_msix_info(dev); + pci_read_ht_mapping_info(dev); } diff --git a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.h b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.h index 4822dbe007..7e36c7bf4b 100644 --- a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.h +++ b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_arch_info.h @@ -10,6 +10,7 @@ typedef struct pci_arch_info { msi_info msi; msix_info msix; + ht_mapping_info ht_mapping; } pci_arch_info; diff --git a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.cpp b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.cpp index 590551bff3..e87e852270 100644 --- a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.cpp +++ b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.cpp @@ -15,6 +15,60 @@ extern PCI *gPCI; +static void +pci_ht_msi_map(PCIDev *device, uint64 address) +{ + ht_mapping_info *info = &device->arch_info.ht_mapping; + if (!info->ht_mapping_capable) + return; + + bool enabled = (info->control_value & PCI_ht_command_msi_enable) != 0; + if ((address != 0) != enabled) { + if (enabled) { + info->control_value &= ~PCI_ht_command_msi_enable; + } else { + if ((address >> 20) != (info->address_value >> 20)) + return; + dprintf("ht msi mapping enabled\n"); + info->control_value |= PCI_ht_command_msi_enable; + } + gPCI->WriteConfig(device, info->capability_offset + PCI_ht_command, + info->control_value, 2); + } +} + + +void +pci_read_ht_mapping_info(PCIDev *device) +{ + if (!msi_supported()) + return; + + ht_mapping_info *info = &device->arch_info.ht_mapping; + info->ht_mapping_capable = false; + + uint8 offset = 0; + if (gPCI->FindHTCapability(device, PCI_ht_command_cap_msi_mapping, + &offset) == B_OK) { + info->control_value = gPCI->ReadConfig(device, offset + PCI_ht_command, + 2); + info->capability_offset = offset; + info->ht_mapping_capable = true; + if ((info->control_value & PCI_ht_command_msi_fixed) != 0) + info->address_value = MSI_ADDRESS_BASE; + else { + info->address_value = gPCI->ReadConfig(device, offset + + PCI_ht_msi_address_high, 4); + info->address_value <<= 32; + info->address_value |= gPCI->ReadConfig(device, offset + + PCI_ht_msi_address_low, 4); + } + dprintf("found an ht msi mapping at %#" B_PRIx64 "\n", + info->address_value); + } +} + + uint8 pci_get_msi_count(uint8 virtualBus, uint8 _device, uint8 function) { @@ -164,6 +218,9 @@ pci_enable_msi(uint8 virtualBus, uint8 _device, uint8 function) gPCI->WriteConfig(device, info->capability_offset + PCI_msi_control, 2, info->control_value); + // enable HT msi mapping (if applicable) + pci_ht_msi_map(device, info->address_value); + dprintf("msi enabled: 0x%04" B_PRIx32 "\n", gPCI->ReadConfig(device, info->capability_offset + PCI_msi_control, 2)); return B_OK; @@ -193,6 +250,9 @@ pci_disable_msi(uint8 virtualBus, uint8 _device, uint8 function) if (info->configured_count == 0) return B_NO_INIT; + // disable HT msi mapping (if applicable) + pci_ht_msi_map(device, 0); + // disable msi generation info->control_value &= ~PCI_msi_control_enable; gPCI->WriteConfig(device, info->capability_offset + PCI_msi_control, 2, @@ -423,6 +483,9 @@ pci_enable_msix(uint8 virtualBus, uint8 _device, uint8 function) gPCI->WriteConfig(device, info->capability_offset + PCI_msix_control, 2, info->control_value); + // enable HT msi mapping (if applicable) + pci_ht_msi_map(device, info->address_value); + dprintf("msi-x enabled: 0x%04" B_PRIx32 "\n", gPCI->ReadConfig(device, info->capability_offset + PCI_msix_control, 2)); return B_OK; @@ -452,6 +515,9 @@ pci_disable_msix(uint8 virtualBus, uint8 _device, uint8 function) if (info->configured_count == 0) return B_NO_INIT; + // disable HT msi mapping (if applicable) + pci_ht_msi_map(device, 0); + // disable msi-x generation info->control_value &= ~PCI_msix_control_enable; gPCI->WriteConfig(device, info->capability_offset + PCI_msix_control, 2, diff --git a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.h b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.h index 286d030f1a..52fa47a67d 100644 --- a/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.h +++ b/src/add-ons/kernel/bus_managers/pci/arch/x86/pci_msi.h @@ -10,9 +10,12 @@ #include +// Message Signaled Interrupts + + class PCIDev; -// Message Signaled Interrupts +// MSI typedef struct msi_info { bool msi_capable; uint8 capability_offset; @@ -34,7 +37,7 @@ status_t pci_disable_msi(uint8 virtualBus, uint8 device, uint8 function); void pci_read_msi_info(PCIDev *device); -// Message Signaled Interrupts +// MSI-X typedef struct msix_info { bool msix_capable; uint8 capability_offset; @@ -63,4 +66,16 @@ status_t pci_enable_msix(uint8 virtualBus, uint8 _device, uint8 function); status_t pci_disable_msix(uint8 virtualBus, uint8 _device, uint8 function); void pci_read_msix_info(PCIDev *device); +// HyperTransport MSI mapping +typedef struct ht_mapping_info { + bool ht_mapping_capable; + uint8 capability_offset; + uint16 control_value; + uint64 address_value; +} ht_mapping_info; + + +void pci_read_ht_mapping_info(PCIDev *device); + + #endif // _PCI_x86_MSI_H From 94dbabb056d9ee474c70266aaacf9786a3bb2ad6 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Wed, 10 Jul 2013 19:53:18 -0400 Subject: [PATCH 17/23] Debugger: Cleanups for BreakConditionConfigWindow. - When switching between breaking on all images vs a custom list, rather than enabling/disabling the controls individually, which wasn't necessarily obvious from a visibility standpoint, simply show/hide the entire group of controls as needed. - Update state of add/remove buttons properly. - Sanitize input for leading/trailing whitespace. --- .../BreakConditionConfigWindow.cpp | 138 ++++++++++-------- .../team_window/BreakConditionConfigWindow.h | 8 +- 2 files changed, 83 insertions(+), 63 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/team_window/BreakConditionConfigWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/BreakConditionConfigWindow.cpp index a6428f2229..3e6f6597e8 100644 --- a/src/apps/debugger/user_interface/gui/team_window/BreakConditionConfigWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/BreakConditionConfigWindow.cpp @@ -30,7 +30,8 @@ enum { MSG_SET_STOP_FOR_CUSTOM_IMAGES = 'sfci', MSG_IMAGE_NAME_SELECTION_CHANGED = 'insc', MSG_ADD_IMAGE_NAME = 'anin', - MSG_REMOVE_IMAGE_NAME = 'arin' + MSG_REMOVE_IMAGE_NAME = 'arin', + MSG_IMAGE_NAME_INPUT_CHANGED = 'inic' }; @@ -43,13 +44,6 @@ static int SortStringItems(const void* a, const void* b) } -static bool UpdateItemState(BListItem* item, void* enabled) -{ - item->SetEnabled((bool)enabled); - return false; -} - - BreakConditionConfigWindow::BreakConditionConfigWindow(::Team* team, UserInterfaceListener* listener, BHandler* target) : @@ -57,6 +51,8 @@ BreakConditionConfigWindow::BreakConditionConfigWindow(::Team* team, B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE), fTeam(team), fListener(listener), + fExceptionSettingsBox(NULL), + fImageSettingsBox(NULL), fExceptionThrown(NULL), fExceptionCaught(NULL), fStopOnImageLoad(NULL), @@ -65,6 +61,8 @@ BreakConditionConfigWindow::BreakConditionConfigWindow(::Team* team, fStopImageNameInput(NULL), fAddImageNameButton(NULL), fRemoveImageNameButton(NULL), + fCustomImageGroup(NULL), + fStopOnLoadEnabled(false), fUseCustomImages(false), fCloseButton(NULL), fTarget(target) @@ -116,19 +114,17 @@ BreakConditionConfigWindow::MessageReceived(BMessage* message) case MSG_SET_STOP_FOR_ALL_IMAGES: { - fUseCustomImages = false; fListener->SetStopOnImageLoadRequested( fStopOnImageLoad->Value() == B_CONTROL_ON, - fUseCustomImages); + false); break; } case MSG_SET_STOP_FOR_CUSTOM_IMAGES: { - fUseCustomImages = true; fListener->SetStopOnImageLoadRequested( fStopOnImageLoad->Value() == B_CONTROL_ON, - fUseCustomImages); + true); break; } @@ -142,6 +138,14 @@ BreakConditionConfigWindow::MessageReceived(BMessage* message) break; } + case MSG_IMAGE_NAME_INPUT_CHANGED: + { + BString imageName(fStopImageNameInput->Text()); + imageName.Trim(); + fAddImageNameButton->SetEnabled(!imageName.IsEmpty()); + break; + } + case MSG_STOP_ON_IMAGE_LOAD: { fListener->SetStopOnImageLoadRequested( @@ -152,13 +156,14 @@ BreakConditionConfigWindow::MessageReceived(BMessage* message) case MSG_STOP_IMAGE_SETTINGS_CHANGED: { - _UpdateStopImageButtons(); + _UpdateStopImageState(); break; } case MSG_ADD_IMAGE_NAME: { BString imageName(fStopImageNameInput->Text()); + imageName.Trim(); AutoLocker< ::Team> teamLocker(fTeam); if (fTeam->StopImageNames().HasString(imageName)) break; @@ -268,18 +273,16 @@ BreakConditionConfigWindow::StopOnImageLoadNameRemoved( void BreakConditionConfigWindow::_Init() { - BBox* exceptionSettingsBox = new BBox("exceptionBox"); - exceptionSettingsBox->SetLabel("Exceptions"); - exceptionSettingsBox->AddChild(BLayoutBuilder::Group<>() - .AddGroup(B_VERTICAL) - .SetInsets(B_USE_DEFAULT_SPACING) - .Add(fExceptionThrown = new BCheckBox("exceptionThrown", - "Stop when an exception is thrown", - new BMessage(MSG_STOP_ON_THROWN_EXCEPTION_CHANGED))) - .Add(fExceptionCaught = new BCheckBox("exceptionCaught", - "Stop when an exception is caught", - new BMessage(MSG_STOP_ON_CAUGHT_EXCEPTION_CHANGED))) - .End() + fExceptionSettingsBox = new BBox("exceptionBox"); + fExceptionSettingsBox->SetLabel("Exceptions"); + fExceptionSettingsBox->AddChild(BLayoutBuilder::Group<>(B_VERTICAL, + B_USE_DEFAULT_SPACING) + .Add(fExceptionThrown = new BCheckBox("exceptionThrown", + "Stop when an exception is thrown", + new BMessage(MSG_STOP_ON_THROWN_EXCEPTION_CHANGED))) + .Add(fExceptionCaught = new BCheckBox("exceptionCaught", + "Stop when an exception is caught", + new BMessage(MSG_STOP_ON_CAUGHT_EXCEPTION_CHANGED))) .View()); fExceptionThrown->SetTarget(this); @@ -289,8 +292,8 @@ BreakConditionConfigWindow::_Init() fExceptionCaught->SetEnabled(false); - BBox* imageSettingsBox = new BBox("imageBox"); - imageSettingsBox->SetLabel("Images"); + fImageSettingsBox = new BBox("imageBox"); + fImageSettingsBox->SetLabel("Images"); BMenu* stopImageMenu = new BMenu("stopImageTypesMenu"); stopImageMenu->AddItem(new BMenuItem("All", @@ -303,26 +306,28 @@ BreakConditionConfigWindow::_Init() fStopImageNames->SetSelectionMessage( new BMessage(MSG_IMAGE_NAME_SELECTION_CHANGED)); - imageSettingsBox->AddChild(BLayoutBuilder::Group<>() - .AddGroup(B_VERTICAL) - .SetInsets(B_USE_DEFAULT_SPACING) - .Add(fStopOnImageLoad = new BCheckBox("stopOnImage", - "Stop when an image is loaded", - new BMessage(MSG_STOP_ON_IMAGE_LOAD))) - .Add(fStopImageConstraints = new BMenuField( - "stopTypes", "Types:", stopImageMenu)) - .Add(new BScrollView("stopImageScroll", fStopImageNames, - 0, false, true)) - .Add(fStopImageNameInput = new BTextControl("stopImageName", - "Image:", NULL, NULL)) - .AddGroup(B_HORIZONTAL) - .AddGlue() - .Add(fAddImageNameButton = new BButton("Add", - new BMessage(MSG_ADD_IMAGE_NAME))) - .Add(fRemoveImageNameButton = new BButton("Remove", - new BMessage(MSG_REMOVE_IMAGE_NAME))) - .End() - .End() + fCustomImageGroup = new BGroupView(); + BLayoutBuilder::Group<>(fCustomImageGroup, B_VERTICAL, 0.0) + .Add(new BScrollView("stopImageScroll", fStopImageNames, + 0, false, true)) + .Add(fStopImageNameInput = new BTextControl("stopImageName", + "Image:", NULL, NULL)) + .AddGroup(B_HORIZONTAL) + .AddGlue() + .Add(fAddImageNameButton = new BButton("Add", + new BMessage(MSG_ADD_IMAGE_NAME))) + .Add(fRemoveImageNameButton = new BButton("Remove", + new BMessage(MSG_REMOVE_IMAGE_NAME))) + .End(); + + fImageSettingsBox->AddChild(BLayoutBuilder::Group<>(B_VERTICAL) + .SetInsets(B_USE_DEFAULT_SPACING) + .Add(fStopOnImageLoad = new BCheckBox("stopOnImage", + "Stop when an image is loaded", + new BMessage(MSG_STOP_ON_IMAGE_LOAD))) + .Add(fStopImageConstraints = new BMenuField( + "stopTypes", "Types:", stopImageMenu)) + .Add(fCustomImageGroup) .View()); font_height fontHeight; @@ -333,8 +338,8 @@ BreakConditionConfigWindow::_Init() BLayoutBuilder::Group<>(this, B_VERTICAL) .SetInsets(B_USE_DEFAULT_SPACING) - .Add(exceptionSettingsBox) - .Add(imageSettingsBox) + .Add(fExceptionSettingsBox) + .Add(fImageSettingsBox) .AddGroup(B_HORIZONTAL) .AddGlue() .Add(fCloseButton = new BButton("Close", new BMessage( @@ -343,8 +348,14 @@ BreakConditionConfigWindow::_Init() fCloseButton->SetTarget(this); + fAddImageNameButton->SetEnabled(false); + fRemoveImageNameButton->SetEnabled(false); stopImageMenu->SetTargetForItems(this); stopImageMenu->SetLabelFromMarked(true); + fStopImageNameInput->SetModificationMessage( + new BMessage(MSG_IMAGE_NAME_INPUT_CHANGED)); + + fCustomImageGroup->Hide(); AutoLocker< ::Team> teamLocker(fTeam); _UpdateStopImageState(); @@ -418,9 +429,15 @@ BreakConditionConfigWindow::_UpdateExceptionState() void BreakConditionConfigWindow::_UpdateStopImageState() { + bool previousStop = fStopOnLoadEnabled; + bool previousCustomImages = fUseCustomImages; + + fStopOnLoadEnabled = fTeam->StopOnImageLoad(); + fStopOnImageLoad->SetValue( + fStopOnLoadEnabled ? B_CONTROL_ON : B_CONTROL_OFF); fUseCustomImages = fTeam->StopImageNameListEnabled(); - fStopImageConstraints->Menu()->ItemAt(0)->SetMarked(!fUseCustomImages); - fStopImageConstraints->Menu()->ItemAt(1)->SetMarked(fUseCustomImages); + fStopImageConstraints->Menu() + ->ItemAt(fUseCustomImages ? 1 : 0)->SetMarked(true); fStopImageNames->MakeEmpty(); const BStringList& imageNames = fTeam->StopImageNames(); @@ -436,20 +453,17 @@ BreakConditionConfigWindow::_UpdateStopImageState() itemDeleter.Detach(); } - _UpdateStopImageButtons(); + _UpdateStopImageButtons(previousStop, previousCustomImages); } void -BreakConditionConfigWindow::_UpdateStopImageButtons() +BreakConditionConfigWindow::_UpdateStopImageButtons(bool previousStop, + bool previousCustomImages) { - bool stopOnImageLoad = fTeam->StopOnImageLoad(); - fStopOnImageLoad->SetValue(stopOnImageLoad ? B_CONTROL_ON : B_CONTROL_OFF); - bool enabled = stopOnImageLoad && fUseCustomImages; - fStopImageConstraints->SetEnabled(stopOnImageLoad); - fAddImageNameButton->SetEnabled(enabled); - fRemoveImageNameButton->SetEnabled(enabled - && fStopImageNames->CurrentSelection() >= 0); - fStopImageNames->DoForEach(UpdateItemState, (void*)enabled); - fStopImageNameInput->TextView()->MakeEditable(enabled); + fStopImageConstraints->SetEnabled(fStopOnLoadEnabled); + if (!previousCustomImages && fUseCustomImages) + fCustomImageGroup->Show(); + else if (previousCustomImages && !fUseCustomImages) + fCustomImageGroup->Hide(); } diff --git a/src/apps/debugger/user_interface/gui/team_window/BreakConditionConfigWindow.h b/src/apps/debugger/user_interface/gui/team_window/BreakConditionConfigWindow.h index e1478935f6..1e07c09f27 100644 --- a/src/apps/debugger/user_interface/gui/team_window/BreakConditionConfigWindow.h +++ b/src/apps/debugger/user_interface/gui/team_window/BreakConditionConfigWindow.h @@ -13,6 +13,7 @@ #include "types/Types.h" +class BBox; class BButton; class BCheckBox; class BListView; @@ -56,7 +57,8 @@ private: void _UpdateExceptionState(); void _UpdateStopImageState(); - void _UpdateStopImageButtons(); + void _UpdateStopImageButtons(bool previousStop, + bool previousCustomImages); // must be called with team lock held @@ -64,6 +66,8 @@ private: private: ::Team* fTeam; UserInterfaceListener* fListener; + BBox* fExceptionSettingsBox; + BBox* fImageSettingsBox; BCheckBox* fExceptionThrown; BCheckBox* fExceptionCaught; BCheckBox* fStopOnImageLoad; @@ -72,6 +76,8 @@ private: BTextControl* fStopImageNameInput; BButton* fAddImageNameButton; BButton* fRemoveImageNameButton; + BView* fCustomImageGroup; + bool fStopOnLoadEnabled; bool fUseCustomImages; BButton* fCloseButton; BHandler* fTarget; From 8b2fbc4fa0b6295ed6ebb2484018e42dc12d1cd0 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Wed, 10 Jul 2013 21:54:12 -0400 Subject: [PATCH 18/23] Debugger: minor tweak. Also ensure the custom image list controls are appropriately shown/hidden when enabling the top-level stop on image load setting. --- .../gui/team_window/BreakConditionConfigWindow.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/team_window/BreakConditionConfigWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/BreakConditionConfigWindow.cpp index 3e6f6597e8..e1379aa9ce 100644 --- a/src/apps/debugger/user_interface/gui/team_window/BreakConditionConfigWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/BreakConditionConfigWindow.cpp @@ -430,14 +430,14 @@ void BreakConditionConfigWindow::_UpdateStopImageState() { bool previousStop = fStopOnLoadEnabled; - bool previousCustomImages = fUseCustomImages; + bool previousCustomImages = fUseCustomImages && fStopOnLoadEnabled; fStopOnLoadEnabled = fTeam->StopOnImageLoad(); fStopOnImageLoad->SetValue( fStopOnLoadEnabled ? B_CONTROL_ON : B_CONTROL_OFF); fUseCustomImages = fTeam->StopImageNameListEnabled(); fStopImageConstraints->Menu() - ->ItemAt(fUseCustomImages ? 1 : 0)->SetMarked(true); + ->ItemAt(fTeam->StopImageNameListEnabled() ? 1 : 0)->SetMarked(true); fStopImageNames->MakeEmpty(); const BStringList& imageNames = fTeam->StopImageNames(); @@ -462,8 +462,9 @@ BreakConditionConfigWindow::_UpdateStopImageButtons(bool previousStop, bool previousCustomImages) { fStopImageConstraints->SetEnabled(fStopOnLoadEnabled); - if (!previousCustomImages && fUseCustomImages) + bool showCustomGroup = fUseCustomImages && fStopOnLoadEnabled; + if (!previousCustomImages && showCustomGroup) fCustomImageGroup->Show(); - else if (previousCustomImages && !fUseCustomImages) + else if (previousCustomImages && !showCustomGroup) fCustomImageGroup->Hide(); } From 8832917f2c44f719acff0909010f8e639e8838ab Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Thu, 11 Jul 2013 07:35:06 -0400 Subject: [PATCH 19/23] Debugger: SourceView: Fix several drawing bugs. - MarkerView: If the view was resized, and the newly revealed region was after the last source line, it wouldn't be redrawn properly. - TextView: Reset low color for painting the region after the source. Otherwise, if either the instruction pointer or a breakpoint were at the last line of the current source, the empty space after would be filled in that color rather than the background color. --- .../gui/team_window/SourceView.cpp | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp b/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp index c9249d94c0..3e4527202a 100644 --- a/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp @@ -902,43 +902,42 @@ SourceView::MarkerView::Draw(BRect updateRect) // get the lines intersecting with the update rect int32 minLine, maxLine; GetLineRange(updateRect, minLine, maxLine); - if (minLine > maxLine) - return; + if (minLine <= maxLine) { + // get the markers in that range + SourceView::MarkerManager::MarkerList markers; + fMarkerManager->GetMarkers(minLine, maxLine, markers); - // get the markers in that range - SourceView::MarkerManager::MarkerList markers; - fMarkerManager->GetMarkers(minLine, maxLine, markers); + float width = Bounds().Width(); - float width = Bounds().Width(); + AutoLocker sourceLocker(fSourceCode); - AutoLocker sourceLocker(fSourceCode); + int32 markerIndex = 0; + for (int32 line = minLine; line <= maxLine; line++) { + bool drawBreakpointOptionMarker = true; - int32 markerIndex = 0; - for (int32 line = minLine; line <= maxLine; line++) { - bool drawBreakpointOptionMarker = true; + SourceView::MarkerManager::Marker* marker; + FillRect(LineRect(line), B_SOLID_LOW); + while ((marker = markers.ItemAt(markerIndex)) != NULL + && marker->Line() == (uint32)line) { + marker->Draw(this, LineRect(line)); + drawBreakpointOptionMarker = false; + markerIndex++; + } - SourceView::MarkerManager::Marker* marker; - FillRect(LineRect(line), B_SOLID_LOW); - while ((marker = markers.ItemAt(markerIndex)) != NULL - && marker->Line() == (uint32)line) { - marker->Draw(this, LineRect(line)); - drawBreakpointOptionMarker = false; - markerIndex++; + if (!drawBreakpointOptionMarker) + continue; + + SourceLocation statementStart, statementEnd; + if (!fSourceCode->GetStatementLocationRange(SourceLocation(line), + statementStart, statementEnd) + || statementStart.Line() != line) { + continue; + } + + float y = ((float)line + 0.5f) * fFontInfo->lineHeight; + SetHighColor(fBreakpointOptionMarker); + FillEllipse(BPoint(width - 8, y), 2, 2); } - - if (!drawBreakpointOptionMarker) - continue; - - SourceLocation statementStart, statementEnd; - if (!fSourceCode->GetStatementLocationRange(SourceLocation(line), - statementStart, statementEnd) - || statementStart.Line() != line) { - continue; - } - - float y = ((float)line + 0.5f) * fFontInfo->lineHeight; - SetHighColor(fBreakpointOptionMarker); - FillEllipse(BPoint(width - 8, y), 2, 2); } float y = (maxLine + 1) * fFontInfo->lineHeight; @@ -1154,6 +1153,7 @@ SourceView::TextView::Draw(BRect updateRect) y = (maxLine + 1) * fFontInfo->lineHeight; if (y < updateRect.bottom) { + SetLowColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR)); FillRect(BRect(0.0, y, Bounds().right, updateRect.bottom), B_SOLID_LOW); } From 8a8a325a1e68b83f1eb4960cc9842778554c83bd Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 20 May 2013 02:30:12 +0200 Subject: [PATCH 20/23] Terminal: work-around missing/out-of-order modifiers events ... more aggressively than before: * Only use modifiers(). * Before forwarding any relevant event to the active state, first check whether the modifiers have changed. While the issues should really be fixed where they originate (app server?), this hopefully fixes all situations where the hyperlink mode gets stuck. --- src/apps/terminal/TermView.cpp | 38 +++++++++++++++++++++++----------- src/apps/terminal/TermView.h | 2 ++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index 610208e931..393f0a1ccd 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -1156,7 +1156,8 @@ void TermView::AttachedToWindow() { fMouseButtons = 0; - fModifiers = modifiers(); + + _UpdateModifiers(); // update the terminal size because it may have changed while the TermView // was detached from the window. On such conditions FrameResized was not @@ -1380,14 +1381,9 @@ TermView::WindowActivated(bool active) _Deactivate(); } - fActiveState->WindowActivated(active); + _UpdateModifiers(); - if (active) { - int32 oldModifiers = fModifiers; - fModifiers = modifiers(); - if (fModifiers != oldModifiers) - fActiveState->ModifiersChanged(oldModifiers, fModifiers); - } + fActiveState->WindowActivated(active); } @@ -1409,6 +1405,8 @@ TermView::MakeFocus(bool focusState) void TermView::KeyDown(const char *bytes, int32 numBytes) { + _UpdateModifiers(); + fActiveState->KeyDown(bytes, numBytes); } @@ -1601,10 +1599,7 @@ TermView::MessageReceived(BMessage *msg) case B_MODIFIERS_CHANGED: { - int32 oldModifiers = fModifiers; - fModifiers = msg->GetInt32("modifiers", 0); - if (fModifiers != oldModifiers) - fActiveState->ModifiersChanged(oldModifiers, fModifiers); + _UpdateModifiers(); break; } @@ -2376,6 +2371,8 @@ TermView::MouseDown(BPoint where) if (!IsFocus()) MakeFocus(); + _UpdateModifiers(); + BMessage* currentMessage = Window()->CurrentMessage(); int32 buttons = currentMessage->GetInt32("buttons", 0); @@ -2389,6 +2386,8 @@ TermView::MouseDown(BPoint where) void TermView::MouseMoved(BPoint where, uint32 transit, const BMessage *message) { + _UpdateModifiers(); + fActiveState->MouseMoved(where, transit, message, fModifiers); } @@ -2396,6 +2395,8 @@ TermView::MouseMoved(BPoint where, uint32 transit, const BMessage *message) void TermView::MouseUp(BPoint where) { + _UpdateModifiers(); + int32 buttons = Window()->CurrentMessage()->GetInt32("buttons", 0); fActiveState->MouseUp(where, buttons); @@ -2975,6 +2976,19 @@ TermView::_CancelInputMethod() } +void +TermView::_UpdateModifiers() +{ + // TODO: This method is a general work-around for missing or out-of-order + // B_MODIFIERS_CHANGED messages. This should really be fixed where it is + // broken (app server?). + int32 oldModifiers = fModifiers; + fModifiers = modifiers(); + if (fModifiers != oldModifiers && fActiveState != NULL) + fActiveState->ModifiersChanged(oldModifiers, fModifiers); +} + + void TermView::_NextState(State* state) { diff --git a/src/apps/terminal/TermView.h b/src/apps/terminal/TermView.h index a1ab24ed22..53f7e706cc 100644 --- a/src/apps/terminal/TermView.h +++ b/src/apps/terminal/TermView.h @@ -251,6 +251,8 @@ private: void _HandleInputMethodLocationRequest(); void _CancelInputMethod(); + void _UpdateModifiers(); + void _NextState(State* state); private: From c53508b7305c6b91c250a39fd90bf16ea949484a Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 11 Jul 2013 16:12:19 +0200 Subject: [PATCH 21/23] kernel tracing: implement fallback for meta data allocation We the meta data area couldn't be allocated in any of the supported (reattachable) places, just use a static allocation. The tracing feature wouldn't be available at all in such a case. --- src/system/kernel/debug/tracing.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/system/kernel/debug/tracing.cpp b/src/system/kernel/debug/tracing.cpp index aa9c880243..7855455338 100644 --- a/src/system/kernel/debug/tracing.cpp +++ b/src/system/kernel/debug/tracing.cpp @@ -127,8 +127,8 @@ private: uint32 fMagic3; }; -static TracingMetaData sDummyTracingMetaData; -static TracingMetaData* sTracingMetaData = &sDummyTracingMetaData; +static TracingMetaData sFallbackTracingMetaData; +static TracingMetaData* sTracingMetaData = &sFallbackTracingMetaData; static bool sTracingDataRecovered = false; @@ -525,7 +525,15 @@ TracingMetaData::_CreateMetaDataArea(bool findPrevious, area_id& _area, delete_area(area); } - return B_ENTRY_NOT_FOUND; + if (findPrevious) + return B_ENTRY_NOT_FOUND; + + // We could allocate any of the standard locations. Instead of failing + // entirely, we use the static meta data. The tracing buffer won't be + // reattachable in the next session, but at least we can use it in this + // session. + _metaData = &sFallbackTracingMetaData; + return B_OK; } @@ -1786,7 +1794,8 @@ tracing_init(void) #if ENABLE_TRACING status_t result = TracingMetaData::Create(sTracingMetaData); if (result != B_OK) { - sTracingMetaData = &sDummyTracingMetaData; + memset(&sFallbackTracingMetaData, 0, sizeof(sFallbackTracingMetaData)); + sTracingMetaData = &sFallbackTracingMetaData; return result; } From 7bea0205edb5e824c9599360b8694fbb5d43bcc4 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 11 Jul 2013 17:29:09 +0200 Subject: [PATCH 22/23] vm_page_allocate_page_run(): fix debug output --- src/system/kernel/vm/vm_page.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/kernel/vm/vm_page.cpp b/src/system/kernel/vm/vm_page.cpp index 47011a2ee1..bc536436f7 100644 --- a/src/system/kernel/vm/vm_page.cpp +++ b/src/system/kernel/vm/vm_page.cpp @@ -3887,7 +3887,7 @@ vm_page_allocate_page_run(uint32 flags, page_num_t length, dprintf("vm_page_allocate_page_run(): Failed to allocate run of " "length %" B_PRIuPHYSADDR " (%" B_PRIuPHYSADDR " %" B_PRIuPHYSADDR ") in second iteration (align: %" B_PRIuPHYSADDR - " boundary: %" B_PRIuPHYSADDR ") !", length, requestedStart, + " boundary: %" B_PRIuPHYSADDR ")!\n", length, requestedStart, end, restrictions->alignment, restrictions->boundary); freeClearQueueLocker.Unlock(); From 02b151d3e344772bcc6f91c874b9b87a23350a0a Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 11 Jul 2013 17:54:55 +0200 Subject: [PATCH 23/23] MultiAddressSpaceLocker::AddAreaCacheAndLock(): race condition * Add a VMArea* version of AddArea(). * AddAreaCacheAndLock(): Use the new AddArea() version. This not only saves the ID hash table lookup, but also fixes a race condition with delete_area(). delete_area() removes the area from the hash before removing it from its cache, so iterating through the cache's areas can turn up an area that no longer is in the hash. In that case we would fail immediately. The new AddArea() won't fail in this situation, though. Fixes #9686: vm_copy_area() could fail for the "commpage" area. That's an area all teams share, so any team terminating while another one was fork()ing could trigger it. --- src/system/kernel/vm/VMAddressSpaceLocking.cpp | 4 +--- src/system/kernel/vm/VMAddressSpaceLocking.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/system/kernel/vm/VMAddressSpaceLocking.cpp b/src/system/kernel/vm/VMAddressSpaceLocking.cpp index 0fb7da4436..d1bc1c3247 100644 --- a/src/system/kernel/vm/VMAddressSpaceLocking.cpp +++ b/src/system/kernel/vm/VMAddressSpaceLocking.cpp @@ -511,7 +511,7 @@ MultiAddressSpaceLocker::AddAreaCacheAndLock(area_id areaID, VMArea* firstArea = cache->areas; for (VMArea* current = firstArea; current; current = current->cache_next) { - error = AddArea(current->id, + error = AddArea(current, current == area ? writeLockThisOne : writeLockOthers); if (error != B_OK) { vm_area_put_locked_cache(cache); @@ -569,5 +569,3 @@ MultiAddressSpaceLocker::AddAreaCacheAndLock(area_id areaID, memcpy(fItems, originalItems, fCount * sizeof(lock_item)); } } - - diff --git a/src/system/kernel/vm/VMAddressSpaceLocking.h b/src/system/kernel/vm/VMAddressSpaceLocking.h index cf2ed7d62f..34ec33a8d9 100644 --- a/src/system/kernel/vm/VMAddressSpaceLocking.h +++ b/src/system/kernel/vm/VMAddressSpaceLocking.h @@ -91,6 +91,8 @@ public: VMAddressSpace** _space = NULL); inline status_t AddArea(area_id area, bool writeLock, VMAddressSpace** _space = NULL); + inline status_t AddArea(VMArea* area, bool writeLock, + VMAddressSpace** _space = NULL); status_t AddAreaCacheAndLock(area_id areaID, bool writeLockThisOne, bool writeLockOthers, @@ -139,4 +141,13 @@ MultiAddressSpaceLocker::AddArea(area_id area, bool writeLock, } +inline status_t +MultiAddressSpaceLocker::AddArea(VMArea* area, bool writeLock, + VMAddressSpace** _space) +{ + area->address_space->Get(); + return _AddAddressSpace(area->address_space, writeLock, _space); +} + + #endif // VM_ADDRESS_SPACE_LOCKING_H