At the moment, the ArcCodec produces YV12 on Intel. The gralloc
module should support it, atleast temporarily until UYVY hardware
overlays are enabled on CrOS.
TEST=ran graphics_Gbm, tested Chrome boots on Cyan
BUG=b/29335168, chromium:616275
CQ-DEPEND=CL:372359
Change-Id: I27c888d3467aa89e8ca48b22523cbc76973aa314
Reviewed-on: https://chromium-review.googlesource.com/373048
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Added the drv analogues of the 2 flexible formats we need to support.
Added analogues of most of the gralloc use flags, except:
GRALLOC_USAGE_SW_READ_MASK
GRALLOC_USAGE_SW_WRITE_MASK
GRALLOC_USAGE_HW_MASK
GRALLOC_USAGE_FOREIGN_BUFFERS
GRALLOC_USAGE_ALLOC_MASK
These are used as masks and don't make sense as usage hints. In
addition, put the new flags in the drivers' supported lists and
added a flexible format query function.
BUG=chromium:616275
TEST=minigbm still builds
CQ-DEPEND=CL:371501
Change-Id: Idd2ecd6fde3e6c5caaaf3a8404d0d7db20b4ecf4
Reviewed-on: https://chromium-review.googlesource.com/372359
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
It doesn't make sense to have the drv prefix for static backend
functions, so remove it.
TEST=minigbm still builds
CQ-DEPEND=CL:370798
Change-Id: I65272162b8c7cf5d3716c7e5fcf0475c35522c47
Reviewed-on: https://chromium-review.googlesource.com/371501
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Gralloc requires the ability to mmap a buffer into userspace. This
change adds the necessary entry points to our internal "drv"
interface.
BUG=chromium:616275
TEST=minigbm still builds. Also ran:
./gralloctest mapping
with CL:362062 applied on minnie and cyan (decided to split that CL
into smaller patches).
CQ-DEPEND=CL:366041
Change-Id: I7396b0c79702f24eb779984805bc679c237bd932
Reviewed-on: https://chromium-review.googlesource.com/370798
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
When a dmabuf is imported multiple times, further imports after the
first one are not refcounted, i.e. the first close() will lose the
dmabuf. To avoid this, user space needs to track the number of imports
and only close() the dmabuf once the last import is closed.
BUG=None
TEST=Ran graphics_Gbm on minnie. Still passes.
Change-Id: Iba63556ccc94ac5d49be2f827ceead85e0e22c9c
Reviewed-on: https://chromium-review.googlesource.com/366041
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
We would like to reuse the same set of drivers for ChromeOS (with
a minigbm frontend) and Android (with a gralloc frontend). Since
we don't want to pollute the gbm API with gralloc formats and usages,
we can refactor minigbm on top a private API that will be a superset
of gbm and gralloc. This change redirects gbm calls to the
private API.
TEST=Ran graphics_Gbm on minnie and cyan, and checked if Chrome boots.
BUG=chromium:616275
CQ-DEPEND=CL:367791
Change-Id: I50d10f9d6c7ea936b0d76c5299a58d948939fdf9
Reviewed-on: https://chromium-review.googlesource.com/367780
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
We need some additional minigbm API to set kind for buffer.
BUG=chromium:478339
TEST=none
Change-Id: I770e5d4d8af07d846557953ba52a3529b8715c8d
Signed-off-by: Vince Hsu <vince.h@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/346364
Commit-Ready: Mark Zhang <markz%nvidia.com@gtempaccount.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Some of our Android framework code expects one fd per format. The gbm
API allows it, so let's go with this representation. Also fixed a bug
that comes up when bo->num_planes = 2, but the handles are the same.
BUG=chromium:616275
TEST=gbmtest, plane_test
Change-Id: Iec0e6319d144941a73c26497af2078112d5e4e64
Reviewed-on: https://chromium-review.googlesource.com/360905
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
This modifier is vendor specific field except the vendor ID. It will be
used to extract the tiling and compression information in NVIDIA EGL
driver.
BUG=chromium:478339
TEST=none
Change-Id: I9ec88b61da4a9b2d30d7d9203e86197814291a1c
Signed-off-by: Vince Hsu <vince.h@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/346366
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
To pass the surface format parameters to EGL, we add format modifiers
which are used for dmabuf import. The vendor ID definitions are copied
from drm_fourcc.h.
BUG=chromium:478339
TEST=none
Change-Id: Ida3e6787b29af73ff534c054006f93c3bad4c5b9
Signed-off-by: Vince Hsu <vince.h@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/346365
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
This patch does alignment if needed on the width and height, but does
not expose this change to the public facing gbm_bo. It is expected that
framebuffer creation in the kernel with do alignment such that
applications don't have to have platform specific knowledge of alignment
requirements.
TEST=nv12_test
BUG=chromium:607241
Change-Id: I6138afb56537f516fac038ff4db39593c623fccd
Reviewed-on: https://chromium-review.googlesource.com/341010
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
The presence of this enum makes mistakes handling gbm formats very easy
to make. With this patch, no new code can use this enum. Any old code
that tries will see errors.
BUG=None
TEST=drm-tests
CQ-DEPEND=CL:343592
Change-Id: If3b19975a137928965f14bad26d1e895dd839810
Reviewed-on: https://chromium-review.googlesource.com/343528
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Haixia Shi <hshi@chromium.org>
We deprecated GBM_BO_USE_WRITE in Chrome OS, so we should remove it from the
drivers.
BUG=chromium:356871
CQ-DEPEND=CL:342391
Change-Id: I29c10817cf71ae51d12092f05228e92f342ca4e5
Reviewed-on: https://chromium-review.googlesource.com/341911
Commit-Ready: Dongseong Hwang <dongseong.hwang@intel.com>
Tested-by: Dongseong Hwang <dongseong.hwang@intel.com>
Reviewed-by: Dongseong Hwang <dongseong.hwang@intel.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
There are no users of this flag, and the only thing it is defined to
affect is gbm_bo_write, which has no implementation. I suspect this is a
leftover from the original gbm that is no longer needed.
This also removes the declaration of gbm_bo_write to keep others from
thinking minigbm actually implements it.
BUG=None
TEST=minigbm still builds
Change-Id: I0b72efa14208b32e924292cef957273359c7d40b
Reviewed-on: https://chromium-review.googlesource.com/331289
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
the 'prime_handle' variable has a 'flags' and the kernel code for
DRM_IOCTL_PRIME_FD_TO_HANDLE will fail if 'flags' contains something
else than DRM_CLOEXEC or 0.
Right now, the 'flags' field is uninitialized and DRM initialization
fails on some VM configs with kernel 4.4.
BUG=chromium:591626
TEST=run null_platform_test and Chrome browser using the arm64-llvmpipe
overlay and kernel 4.4 on QEMU VM.
Change-Id: Ieac8eb280fe14f1e268f8869dcc9fe46c1bb9599
Reviewed-on: https://chromium-review.googlesource.com/337970
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
This patch relax the restriction and permit read/write access on dma-buf. In
particular this is necessary for the userspace mmap()ing a dma-buf fd, so
Chrome could now use it for unpriviledged Renderers write into a graphics
buffer without much difficulty. This has been discussed in upstream here:
http://lists.freedesktop.org/archives/dri-devel/2015-December/097562.html
Kernel changes are needed to use this userspace feature:
Author: Daniel Thompson <daniel.thompson@linaro.org>
Date: Fri Jun 19 14:52:28 2015 +0100
drm: prime: Honour O_RDWR during prime-handle-to-fd
BUG=chromium:581151
TEST=test_that -b strago $DEVICE graphics_SanAngeles
test_that -b strago $DEVICE graphics_GLBench
test_that -b strago $DEVICE graphics_Sanity
Change-Id: I37aff88623ba6aa45797b0ccb6cd2d15c5c51f41
Reviewed-on: https://chromium-review.googlesource.com/323990
Commit-Ready: Tiago Vignatti <tiago.vignatti@intel.com>
Tested-by: Tiago Vignatti <tiago.vignatti@intel.com>
Reviewed-by: Ilja Friedel <ihf@chromium.org>
Reviewed-by: Tiago Vignatti <tiago.vignatti@intel.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
We need to give useable sizes to imported buffers, not just the ones
we create.
BUG=chromium:592681
TEST=run the test on lumpy
Change-Id: Ife99988600607e2f4a56bbad37b48c21829701dd
Reviewed-on: https://chromium-review.googlesource.com/332448
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Ilja Friedel <ihf@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Add a minigbm driver to support the virtio_gpu DRM driver as used by
QEMU virtual machine.
BUG=chromium:591626
TEST=null_platform_test runs on emulated ARM64 virtual machine using
virtio_gpu driver and VIRTIO MMIO transport.
Change-Id: I1bbb060bb882d732b17435a2422cd7fb2c77a5f0
Reviewed-on: https://chromium-review.googlesource.com/332286
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
A lot of these can be made const/static so let's do this.
BUG=none
TEST=compiles
Change-Id: Id0b534ca477b25488b264622f062471063378c1c
Signed-off-by: Stphane Marchesin <marcheu@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/329561
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Some drivers will enable tiling with the other GBM_BO_USE_* flags as an
optimization, but this interferes with reading/writing to mmapped
buffers and other devices that might expect linear buffers.
This CL adds an explicit request to minigbm to only allocate linear
buffer objects. This request is only honored for buffers that meet all
the following requirements:
- YUV formats or ARGB/XRGB 32-bit formats.
- Not combined with GBM_BO_USE_RENDERING
A backend might still reject an allocation even if it meets those
requirements.
This CL also raises the limit on the number of driver formats to 16.
TEST=on samus, run vgem_fb_test with GBM_BO_USE_LINEAR flag in
gbm_bo_create
BUG=None
Change-Id: I8ca31c4c1753af816b13bd75e4feb5b76d153e2a
Reviewed-on: https://chromium-review.googlesource.com/329248
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Previously, gbm_bo_create called gbm_device_is_format_supported with 0
hardcoded as the usage flags. This meant gbm_bo_create could attempt to
create buffer objects for unsupported combos of usage flags and pixel
formats. Using 0 as the usage flag basically meant ANY usage flag that
was supported by the device would work.
Of course that's not the reality, and the usage flag should be
considered along with the pixel format during buffer object creation,
which is what this CL does.
TEST=ui works
BUG=None
Change-Id: Icd3bd0f47dc33790e4476515f2024f9765bea0a2
Reviewed-on: https://chromium-review.googlesource.com/329306
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Cirrus supports both formats for scanout and EGL+llvmpipe requires it.
Cirrus+llvmpipe is still used for running Chrome OS in a VM, so GBM
needs to support allocating BOs of the required format for rendering.
TEST=ui works in VM
BUG=chromium:588140
Change-Id: Ibc834c334f54e9a36173285d18c0aa97de58fdb6
Reviewed-on: https://chromium-review.googlesource.com/328750
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Enable NV12 format on Exynos.
BUG=chromium:368775
TEST=HW video overlay works on snow and peach_pi
Change-Id: Ia149618fa086b9ba3ef998149c3557052833e33b
Signed-off-by: Yuly Novikov <ynovikov@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/318550
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Add a minigbm driver to support the evdi drm.
BUG=none
TEST=Ozone recognizes the evdi dri card
Change-Id: Ic0528194ecf8c388f9818e125ed72d17cfff3a4c
Reviewed-on: https://chromium-review.googlesource.com/322161
Commit-Ready: Michał Łukaszek <michal.lukaszek@displaylink.com>
Tested-by: Michał Łukaszek <michal.lukaszek@displaylink.com>
Reviewed-by: Michał Łukaszek <michal.lukaszek@displaylink.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Chromium expects this format to be supported for import of
foreign buffers.
BUG=chromium:541558
TEST=chromium glimage tests pass
Change-Id: I7ff2f53ef31fc491699f7ad9aea34b3e63289690
Reviewed-on: https://chromium-review.googlesource.com/312591
Commit-Ready: David Reveman <reveman@chromium.org>
Tested-by: David Reveman <reveman@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Add a minigbm driver to support the marvell drm.
BUG=chrome-os-partner:43199
TEST=Freon boots to browser
Change-Id: Ib00d4433a6e3103505a4ceaed1e4ac1ea0d2ba5e
Signed-off-by: Daniel Blum <dblum@marvell.com>
Reviewed-on: https://chromium-review.googlesource.com/315359
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Eduardo Gallofin <eduardog@marvell.com>
We only support GBM_BO_IMPORT_FD for now.
BUG=chromium:541558
TEST=run unit test (graphics_Gbm)
Change-Id: I1232cfdb57efdbbe9c3243b74c4fc5bf20cd8c08
Signed-off-by: Stphane Marchesin <marcheu@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/311203
Commit-Ready: Ilja Friedel <ihf@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Ilja Friedel <ihf@chromium.org>
Reviewed-by: David Reveman <reveman@chromium.org>
Reviewed-by: Haixia Shi <hshi@chromium.org>
Having spew on errors would have made debugging the Netflix
double fd close more obvious.
BUG=chromium:462459, chromium:464628
TEST=Builds for link, tegra, nyan.
Change-Id: I050794fbca8e9291752e52119751847ffcacd798
Reviewed-on: https://chromium-review.googlesource.com/265065
Reviewed-by: Ilja Friedel <ihf@chromium.org>
Commit-Queue: Ilja Friedel <ihf@chromium.org>
Tested-by: Ilja Friedel <ihf@chromium.org>
Add gbm_driver_mediatek function in gbm_get_driver to support
mediatek drm
BUG=None
TEST=Use gbmtest with minigbm to verify
Change-Id: Ieaccdbf5a2bde94f70addb8ac5192fbbcecf321e
Signed-off-by: JB Tsai <jb.tsai@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/261503
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
The soname needs to match mesa exactly. The actual library is installed
as libminigbm.so.1.0.0 - this filename does not matter, and it is
probably better to be specific.
BUG=chromium:446653
TEST=chrome built against mesa boots with minigbm &
chrome built against minigbm boots with minigbm
Change-Id: Id031cc1eb63ab27df57ef9e0313994723e24987c
Reviewed-on: https://chromium-review.googlesource.com/244782
Reviewed-by: Haixia Shi <hshi@chromium.org>
Tested-by: Michael Spang <spang@chromium.org>
Commit-Queue: Michael Spang <spang@chromium.org>
A missing include in helpers.c triggered a bunch of missing-prototypes
warnings.
BUG=None
TEST=Local build with -Wall is now free of warnings
Change-Id: I8d6655ba48abd5cb4f48fa29520f62b076a45690
Reviewed-on: https://chromium-review.googlesource.com/241441
Reviewed-by: Lauri Peltonen <lpeltonen@nvidia.com>
Commit-Queue: Lauri Peltonen <lpeltonen@nvidia.com>
Tested-by: Lauri Peltonen <lpeltonen@nvidia.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
If GBM_BO_USE_RENDERING flag is passed, allocate tiled buffers. Add logic
to the Tegra backend to compute tiled buffer dimensions and tiling
parameters (kind and block height).
The tiling parameters must somehow be passed to EGL at EGLImage creation.
The long term plan is to introduce an extensible structure that can contain
arbitrary vendor specific metadata. For now, we abuse the PITCH attribute
to pass tiling parameters.
Add a new GBM utility function gbm_bo_get_stride_or_tiling, which returns
either the tiling parameters or byte pitch, depending whether the buffer
is tiled or not.
The Nvidia term for our tiled layout is "blocklinear".
BUG=None
TEST=null_platform_test on Tegra
Change-Id: I4e0226efa401b08f7e4a009a7f74b3453c622a10
Signed-off-by: Lauri Peltonen <lpeltonen@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/236663
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Commit-Queue: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
The previous version was a quick and dirty implementation, this one
should be complete.
BUG=chromium:434924
TEST=
Change-Id: Ia6840bd75c7ea1c8d083ae9c5a3da6699f468273
Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/231731
Reviewed-by: Haixia Shi <hshi@chromium.org>
We don't want to use the misc. platform-specific libdrms, but we
still need the headers for the ioctl definitions and such. So let's
react to the GBM_* flags and use pkg-config to find the path to those
headers.
BUG=chromium:412508
TEST=emerge-daisy_freon minigbm
Change-Id: Ie8e1812fc0cebbc025d9c57a9032541c6a7e6da0
Reviewed-on: https://chromium-review.googlesource.com/219010
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Let's add pkg-config and install headers since this is needed for
ozone to build with a gbm platform.
BUG=chromium:394868,chromium:402597,chromium:413947,chromium:412508
TEST=emerge minigbm, then try pkg-config-board --libs --cflags. Rejoice that it works!
Change-Id: I94a26b1986db76e2d0dad638feda80ec10f48a9f
Reviewed-on: https://chromium-review.googlesource.com/218979
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Instead of overriding with our own, let's use the libdir passed down
from the ebuild.
BUG=none
TEST=emerge minigbm
Change-Id: Ic38fd538add6d4c85e502b9dc0feeabaa8378e2e
Reviewed-on: https://chromium-review.googlesource.com/218978
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
ARRAY_SIZE is unsigned, which leads to a warning. Let's fix this by
iterating with an unsigned.
BUG=none
TEST=emerge minigbm
Change-Id: I9b683d19d8ce5208bb4ec25d69292bbefcc4f91d
Reviewed-on: https://chromium-review.googlesource.com/218977
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>