summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/shmobile-iommu.c
AgeCommit message (Collapse)Author
2015-03-31iommu/shmobile: Make use of domain_alloc and domain_freeJoerg Roedel
Implement domain_alloc and domain_free iommu-ops as a replacement for domain_init/domain_destroy. Signed-off-by: Joerg Roedel <jroedel@suse.de>
2014-11-04iommu: Add iommu_map_sg() functionOlav Haugan
Mapping and unmapping are more often than not in the critical path. map_sg allows IOMMU driver implementations to optimize the process of mapping buffers into the IOMMU page tables. Instead of mapping a buffer one page at a time and requiring potentially expensive TLB operations for each page, this function allows the driver to map all pages in one go and defer TLB maintenance until after all pages have been mapped. Additionally, the mapping operation would be faster in general since clients does not have to keep calling map API over and over again for each physically contiguous chunk of memory that needs to be mapped to a virtually contiguous region. Signed-off-by: Olav Haugan <ohaugan@codeaurora.org> Signed-off-by: Joerg Roedel <jroedel@suse.de>
2014-07-07iommu: Constify struct iommu_opsThierry Reding
This structure is read-only data and should never be modified. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Joerg Roedel <jroedel@suse.de>
2014-02-28arm: dma-mapping: remove order parameter from arm_iommu_create_mapping()Marek Szyprowski
The 'order' parameter for IOMMU-aware dma-mapping implementation was introduced mainly as a hack to reduce size of the bitmap used for tracking IO virtual address space. Since now it is possible to dynamically resize the bitmap, this hack is not needed and can be removed without any impact on the client devices. This way the parameters for arm_iommu_create_mapping() becomes much easier to understand. 'size' parameter now means the maximum supported IO address space size. The code will allocate (resize) bitmap in chunks, ensuring that a single chunk is not larger than a single memory page to avoid unreliable allocations of size larger than PAGE_SIZE in atomic context. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
2014-01-07iommu/shmobile: Allocate archdata with kzalloc()Laurent Pinchart
The archdata attached_list field isn't initialized, leading to random crashes when accessed. Use kzalloc() to allocate the whole structure and make sure all fields get initialized properly. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Joerg Roedel <joro@8bytes.org>
2013-04-02iommu/fsl: Make iova dma_addr_t in the iommu_iova_to_phys API.Varun Sethi
This is required in case of PAMU, as it can support a window size of up to 64G (even on 32bit). Signed-off-by: Varun Sethi <Varun.Sethi@freescale.com> Signed-off-by: Joerg Roedel <joro@8bytes.org>
2013-02-06iommu/shmobile: Add iommu driver for Renesas IPMMU modulesHideki EIRAKU
This is the Renesas IPMMU driver and IOMMU API implementation. The IPMMU module supports the MMU function and the PMB function. The MMU function provides address translation by pagetable compatible with ARMv6. The PMB function provides address translation including tile-linear translation. This patch implements the MMU function. The iommu driver does not register a platform driver directly because: - the register space of the MMU function and the PMB function have a common register (used for settings flush), so they should ideally have a way to appropriately share this register. - the MMU function uses the IOMMU API while the PMB function does not. - the two functions may be used independently. Signed-off-by: Hideki EIRAKU <hdk@igel.co.jp> Signed-off-by: Joerg Roedel <joro@8bytes.org>
ue='20'>20space:mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-09-05 20:42:11 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-09-05 20:43:45 +1000
commit986774e5c7ddf5c1de1e1adb831baac84a2dae66 (patch)
tree63c0af0ec32cfd39615d8212bdc3a707e5e30d5b
parent98763e98cb4c0af033b5276423e451f1f8cd11ee (diff)
add commit count via gocui subtitle
Diffstat
-rw-r--r--Gopkg.lock4
-rw-r--r--pkg/gui/commit_message_panel.go35
-rw-r--r--pkg/gui/confirmation_panel.go17
-rw-r--r--pkg/gui/files_panel.go58
-rw-r--r--pkg/gui/gui.go9
-rw-r--r--vendor/github.com/jesseduffield/gocui/gui.go24
-rw-r--r--vendor/github.com/jesseduffield/gocui/view.go3
7 files changed, 64 insertions, 86 deletions
diff --git a/Gopkg.lock b/Gopkg.lock
index 73c8c3731..2bbaa2118 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -189,11 +189,11 @@
[[projects]]
branch = "master"
- digest = "1:145fe566d21b0e2579e1600f09e4e4b01da017676ba8e079de75a2e21111538b"
+ digest = "1:71e6c15797951d3fabaa944d70253e36a6cee96bf54ca0bc43ca3de3b4814bbb"
name = "github.com/jesseduffield/gocui"
packages = ["."]
pruneopts = "NUT"
- revision = "c4051ef0fbcbe519bc1d082a579a38100c7cf044"
+ revision = "2cb6e95bbbf850bb32cc1799e07d08ff0f144746"
[[projects]]
digest = "1:ac6d01547ec4f7f673311b4663909269bfb8249952de3279799289467837c3cc"
diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go
index 88a011c76..7ac566b3f 100644
--- a/pkg/gui/commit_message_panel.go
+++ b/pkg/gui/commit_message_panel.go
@@ -1,6 +1,9 @@
package gui
import (
+ "strconv"
+ "strings"
+
"github.com/jesseduffield/gocui"
)
@@ -30,7 +33,6 @@ func (gui *Gui) handleCommitConfirm(g *gocui.Gui, v *gocui.View) error {
func (gui *Gui) handleCommitClose(g *gocui.Gui, v *gocui.View) error {
g.SetViewOnBottom("commitMessage")
- g.SetViewOnBottom("commitMessageCount")
return gui.switchFocus(g, v, gui.getFilesView(g))
}
@@ -44,3 +46,34 @@ func (gui *Gui) handleCommitFocused(g *gocui.Gui, v *gocui.View) error {
)
return gui.renderString(g, "options", message)
}
+
+func (gui *Gui) simpleEditor(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier) {
+ switch {
+ case key == gocui.KeyBackspace || key == gocui.KeyBackspace2:
+ v.EditDelete(true)
+ case key == gocui.KeyDelete:
+ v.EditDelete(false)
+ case key == gocui.KeyArrowDown:
+ v.MoveCursor(0, 1, false)
+ case key == gocui.KeyArrowUp:
+ v.MoveCursor(0, -1, false)
+ case key == gocui.KeyArrowLeft:
+ v.MoveCursor(-1, 0, false)
+ case key == gocui.KeyArrowRight:
+ v.MoveCursor(1, 0, false)
+ case key == gocui.KeyTab:
+ v.EditNewLine()
+ case key == gocui.KeySpace:
+ v.EditWrite(' ')
+ case key == gocui.KeyInsert:
+ v.Overwrite = !v.Overwrite
+ default:
+ v.EditWrite(ch)
+ }
+
+ v.Subtitle = gui.getBufferLength(v)
+}
+
+func (gui *Gui) getBufferLength(view *gocui.View) string {
+ return " " + strconv.Itoa(strings.Count(view.Buffer(), "")-1) + " "
+}
diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go
index 0bb633f32..58577e430 100644
--- a/pkg/gui/confirmation_panel.go
+++ b/pkg/gui/confirmation_panel.go
@@ -115,20 +115,6 @@ func (gui *Gui) createConfirmationPanel(g *gocui.Gui, currentView *gocui.View, t
return nil
}
-func (gui *Gui) handleNewline(g *gocui.Gui, v *gocui.View) error {
- // resising ahead of time so that the top line doesn't get hidden to make
- // room for the cursor on the second line
- x0, y0, x1, y1 := gui.getConfirmationPanelDimensions(g, v.Buffer())
- if _, err := g.SetView("confirmation", x0, y0, x1, y1+1, 0); err != nil {
- if err != gocui.ErrUnknownView {
- return err
- }
- }
-
- v.EditNewLine()
- return nil
-}
-
func (gui *Gui) setKeyBindings(g *gocui.Gui, handleConfirm, handleClose func(*gocui.Gui, *gocui.View) error) error {
actions := gui.Tr.TemplateLocalize(
"CloseConfirm",
@@ -143,9 +129,6 @@ func (gui *Gui) setKeyBindings(g *gocui.Gui, handleConfirm, handleClose func(*go
if err := g.SetKeybinding("confirmation", gocui.KeyEnter, gocui.ModNone, gui.wrappedConfirmationFunction(handleConfirm)); err != nil {
return err
}
- if err := g.SetKeybinding("confirmation", gocui.KeyTab, gocui.ModNone, gui.handleNewline); err != nil {
- return err
- }
return g.SetKeybinding("confirmation", gocui.KeyEsc, gocui.ModNone, gui.wrappedConfirmationFunction(handleClose))
}
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go
index 43f7e5831..f85ff9d33 100644
--- a/pkg/gui/files_panel.go
+++ b/pkg/gui/files_panel.go
@@ -12,7 +12,6 @@ import (
"github.com/fatih/color"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands"
- "strconv"
)
func (gui *Gui) stagedFiles() []commands.File {
@@ -219,60 +218,6 @@ func (gui *Gui) handleFileSelect(g *gocui.Gui, v *gocui.View) error {
return gui.renderString(g, "main", content)
}
-func (gui *Gui) simpleEditor(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier) {
- switch {
- case key == gocui.KeyBackspace || key == gocui.KeyBackspace2:
- v.EditDelete(true)
- case key == gocui.KeyDelete:
- v.EditDelete(false)
- case key == gocui.KeyArrowDown:
- v.MoveCursor(0, 1, false)
- case key == gocui.KeyArrowUp:
- v.MoveCursor(0, -1, false)
- case key == gocui.KeyArrowLeft:
- v.MoveCursor(-1, 0, false)
- case key == gocui.KeyArrowRight:
- v.MoveCursor(1, 0, false)
- case key == gocui.KeyTab:
- v.EditNewLine()
- case key == gocui.KeySpace:
- v.EditWrite(' ')
- case key == gocui.KeyInsert:
- v.Overwrite = !v.Overwrite
- default:
- v.EditWrite(ch)
- }
-
- gui.renderCommitCount(v)
-}
-
-func (gui *Gui) getCommitCount(view *gocui.View) int {
- return strings.Count(view.Buffer(), "") - 1
-}
-
-func (gui *Gui) renderCommitCount(view *gocui.View) error {
- num := 0
- offset := 5
- count := gui.getCommitCount(view)
- _, y0, x1, _ := gui.getConfirmationPanelDimensions(gui.g, view.Buffer())
-
- if count > 99 {
- num = 3
- } else if count > 9 {
- num = 2
- } else {
- num = 1
- }
-
- if _, err := gui.g.SetView("commitMessageCount", x1-num-offset, y0-1, x1-offset+1, y0+1, 0); err != nil {
- if err != gocui.ErrUnknownView {
- return err
- }
- }
-
- return gui.renderString(gui.g, "commitMessageCount", strconv.Itoa(count))
-}
-
func (gui *Gui) handleCommitPress(g *gocui.Gui, filesView *gocui.View) error {
if len(gui.stagedFiles()) == 0 && !gui.State.HasMergeConflicts {
return gui.createErrorPanel(g, gui.Tr.SLocalize("NoStagedFilesToCommit"))
@@ -280,9 +225,8 @@ func (gui *Gui) handleCommitPress(g *gocui.Gui, filesView *gocui.View) error {
commitMessageView := gui.getCommitMessageView(g)
g.Update(func(g *gocui.Gui) error {
g.SetViewOnTop("commitMessage")
- g.SetViewOnTop("commitMessageCount")
gui.switchFocus(g, filesView, commitMessageView)
- gui.renderCommitCount(commitMessageView)
+ commitMessageView.Subtitle = gui.getBufferLength(commitMessageView)
return nil
})
return nil
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 6c35f9dca..bb395f9d2 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -264,15 +264,6 @@ func (gui *Gui) layout(g *gocui.Gui) error {
commitMessageView.Editable = true
commitMessageView.Editor = gocui.EditorFunc(gui.simpleEditor)
}
- if commitMessageCountView, err := g.SetView("commitMessageCount", 0, 0, width/2, height/2, 0); err != nil {
- if err != gocui.ErrUnknownView {
- return err
- }
- g.SetViewOnBottom("commitMessageCount")
- commitMessageCountView.Frame = false
- commitMessageCountView.BgColor = gocui.ColorDefault
- commitMessageCountView.FgColor = gocui.ColorWhite
- }
}
if appStatusView, err := g.SetView("appStatus", -1, optionsTop, width, optionsTop+2, 0); err != nil {
diff --git a/vendor/github.com/jesseduffield/gocui/gui.go b/vendor/github.com/jesseduffield/gocui/gui.go
index 26ba79bd6..4393c06c4 100644
--- a/vendor/github.com/jesseduffield/gocui/gui.go
+++ b/vendor/github.com/jesseduffield/gocui/gui.go
@@ -476,6 +476,11 @@ func (g *Gui) flush() error {
return err
}
}
+ if v.Subtitle != "" {
+ if err := g.drawSubtitle(v, fgColor, bgColor); err != nil {
+ return err
+ }
+ }
}
if err := g.draw(v); err != nil {
return err
@@ -582,6 +587,25 @@ func (g *Gui) drawTitle(v *View, fgColor, bgColor Attribute) error {
return nil
}
+// drawSubtitle draws the subtitle of the view.
+func (g *Gui) drawSubtitle(v *View, fgColor, bgColor Attribute) error {
+ if v.y0 < 0 || v.y0 >= g.maxY {
+ return nil
+ }
+
+ start := v.x1 - 5 - len(v.Subtitle)
+ for i, ch := range v.Subtitle {
+ x := start + i
+ if x >= v.x1 {
+ break
+ }
+ if err := g.SetRune(x, v.y0, ch, fgColor, bgColor); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
// draw manages the cursor and calls the draw function of a view.
func (g *Gui) draw(v *View) error {
if g.Cursor {
diff --git a/vendor/github.com/jesseduffield/gocui/view.go b/vendor/github.com/jesseduffield/gocui/view.go
index 0dd897aa4..53ab06f8c 100644
--- a/vendor/github.com/jesseduffield/gocui/view.go
+++ b/vendor/github.com/jesseduffield/gocui/view.go
@@ -77,6 +77,9 @@ type View struct {
// If Frame is true, Title allows to configure a title for the view.
Title string
+ // If Frame is true, Subtitle allows to configure a subtitle for the view.
+ Subtitle string
+
// If Mask is true, the View will display the mask instead of the real
// content
Mask rune