minigbm: add GBM_BO_USE_SW_{READ,WRITE}_{OFTEN,RARELY} usage flags

Need for these flags has arisen because buffer's allocated
BO_USE_SCANOUT flag is not mmapable in amd, whereas going further
for ensuring atomictity related operations are functional, one
needs buffer to be mmap'd.

These flags shall be used to strike balance in enabling
AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED on amd and mmap X-tiled buffers
on Intel platforms.

BUG=b:65297611, chromium:777706
TEST=On Kahlee,
     UI comes up.
     GLMark2 & GLbench autotests show no performance regression
     atomictest -t multiplanes passes
     WebGL Aquarium

Change-Id: I582452d331f4a05106939447784a76eba06d13c2
Reviewed-on: https://chromium-review.googlesource.com/758618
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
This commit is contained in:
Shirish S 2017-10-13 09:54:03 +05:30 committed by chrome-bot
parent 07d36cc464
commit 355b156a78
2 changed files with 19 additions and 1 deletions

12
gbm.h
View file

@ -236,7 +236,8 @@ enum gbm_bo_flags {
* Buffer is guaranteed to be laid out linearly in memory. That is, the
* buffer is laid out as an array with 'height' blocks, each block with
* length 'stride'. Each stride is in the same order as the rows of the
* buffer.
* buffer. This is intended to be used with buffers that will be accessed
* via dma-buf mmap().
*/
GBM_BO_USE_LINEAR = (1 << 4),
/**
@ -255,6 +256,15 @@ enum gbm_bo_flags {
* Buffer inaccessible to unprivileged users.
*/
GBM_BO_USE_PROTECTED = (1 << 8),
/**
* These flags specify the frequency of software access. These flags do not
* guarantee the buffer is linear, but do guarantee gbm_bo_map(..) will
* present a linear view.
*/
GBM_BO_USE_SW_READ_OFTEN = (1 << 9),
GBM_BO_USE_SW_READ_RARELY = (1 << 10),
GBM_BO_USE_SW_WRITE_OFTEN = (1 << 11),
GBM_BO_USE_SW_WRITE_RARELY = (1 << 12),
};
int