OSDN Git Service

minigbm: cros_gralloc: fix initialization race condition
authorGurchetan Singh <gurchetansingh@chromium.org>
Tue, 1 Aug 2017 22:02:24 +0000 (15:02 -0700)
committerchrome-bot <chrome-bot@chromium.org>
Fri, 4 Aug 2017 02:23:18 +0000 (19:23 -0700)
commitbcfd758b6de740e13c2cc2dc1f9374111c896448
tree703bf6e901ae2f4bfd55de0090baff865b300353
parentd846de667cba72121ec579912d0854729f013731
minigbm: cros_gralloc: fix initialization race condition

On Android M, since we don't hold a lock during cros_gralloc_driver::init(),
another thread would sometimes access data before the driver was initialized.
This would lead to dEQP crashes. We don't experience this issue on Android
N since the framework has it's own layer of locks in the Gralloc1On0Adapter.

This patch makes the module initialization during (*registerBuffer) and
gralloc_open re-entrant.

BUG=b:63511976
TEST=run cts --package com.drawelements.deqp.gles2 on veyron_tiger has no
     crashes

Change-Id: I2b72f2f8ed5e4a5afbacb291ed8cd928beb2a3b3
Reviewed-on: https://chromium-review.googlesource.com/597015
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
cros_gralloc/gralloc0/gralloc0.cc