Skip to content

Commit

Permalink
Add VPM size to detectPlatform output
Browse files Browse the repository at this point in the history
Now that DMA is enabled, it's interesting to know what the actual size is of the VPM.
This adds it to the output of `detectPlatform`.

Example output:

```
> sudo obj-qpu/bin/detectPlatform
Detected platform: Raspberry Pi 2 Model B Rev 1.1
Hardware revision: a01041
Number of slices: 3
Number of QPU's per slice: 4
Size of VPM: 12KB                    # <-- This is new

```

**NOTE:* This will probably not work on your machine until mn416#52 and mn416#53 have been merged.
  • Loading branch information
wimrijnders committed Jul 16, 2018
1 parent 26eefe6 commit 7926555
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Lib/VideoCore/RegisterMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ int RegisterMap::numQPUPerSlice() {
}


/**
* @brief get the size of the VPM.
*
* @return Size of VPM in KB
*/
int RegisterMap::VPMSize() {
uint32_t reg = readRegister(V3D_IDENT1);
int value = (reg >> 28) & 0xf;

if (value == 0) return 16; // According to reference doc p.97
return value;
}


RegisterMap *RegisterMap::instance() {
if (m_instance.get() == nullptr) {
m_instance.reset(new RegisterMap);
Expand Down
1 change: 1 addition & 0 deletions Lib/VideoCore/RegisterMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class RegisterMap {

static int numSlices();
static int numQPUPerSlice();
static int VPMSize();

private:
RegisterMap();
Expand Down
1 change: 1 addition & 0 deletions Tools/detectPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ int main(int argc, char *argv[]) {
if (geteuid() == 0) { // Only do this as root (sudo)
printf("Number of slices: %d\n", RegisterMap::numSlices());
printf("Number of QPU's per slice: %d\n", RegisterMap::numQPUPerSlice());
printf("Size of VPM: %dKB\n", RegisterMap::VPMSize());
} else {
printf("You can see more if you use sudo\n");
}
Expand Down

0 comments on commit 7926555

Please sign in to comment.