Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1242)

Unified Diff: ui/ozone/platform/drm/gbm_surface_factory.cc

Issue 1050923003: zero-copy: Clarify to allocate/destroy GpuMemoryBuffer on any thread and use it on the main thread o (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just add thread check Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/ozone/platform/drm/gbm_surface_factory.cc
diff --git a/ui/ozone/platform/drm/gbm_surface_factory.cc b/ui/ozone/platform/drm/gbm_surface_factory.cc
index 290073bc3ba8166e13eccb1bd382565d013df1ec..d0f0273e5e47064e14177f9ac13d284fb31aaad1 100644
--- a/ui/ozone/platform/drm/gbm_surface_factory.cc
+++ b/ui/ozone/platform/drm/gbm_surface_factory.cc
@@ -74,6 +74,7 @@ GbmSurfaceFactory::GbmSurfaceFactory(bool allow_surfaceless)
}
GbmSurfaceFactory::~GbmSurfaceFactory() {
+ DCHECK(thread_checker_.CalledOnValidThread());
}
void GbmSurfaceFactory::InitializeGpu(DrmDeviceManager* drm_device_manager,
@@ -83,6 +84,7 @@ void GbmSurfaceFactory::InitializeGpu(DrmDeviceManager* drm_device_manager,
}
intptr_t GbmSurfaceFactory::GetNativeDisplay() {
+ DCHECK(thread_checker_.CalledOnValidThread());
#if defined(USE_MESA_PLATFORM_NULL)
return EGL_DEFAULT_DISPLAY;
#else
@@ -93,6 +95,7 @@ intptr_t GbmSurfaceFactory::GetNativeDisplay() {
}
int GbmSurfaceFactory::GetDrmFd() {
+ DCHECK(thread_checker_.CalledOnValidThread());
scoped_refptr<GbmDevice> gbm = GetGbmDevice(gfx::kNullAcceleratedWidget);
DCHECK(gbm);
return gbm->get_fd();
@@ -100,6 +103,7 @@ int GbmSurfaceFactory::GetDrmFd() {
const int32* GbmSurfaceFactory::GetEGLSurfaceProperties(
const int32* desired_list) {
+ DCHECK(thread_checker_.CalledOnValidThread());
static const int32 kConfigAttribs[] = {EGL_BUFFER_SIZE,
32,
EGL_ALPHA_SIZE,
@@ -122,17 +126,20 @@ const int32* GbmSurfaceFactory::GetEGLSurfaceProperties(
bool GbmSurfaceFactory::LoadEGLGLES2Bindings(
AddGLLibraryCallback add_gl_library,
SetGLGetProcAddressProcCallback set_gl_get_proc_address) {
+ DCHECK(thread_checker_.CalledOnValidThread());
return LoadDefaultEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address);
}
scoped_ptr<SurfaceOzoneCanvas> GbmSurfaceFactory::CreateCanvasForWidget(
gfx::AcceleratedWidget widget) {
+ DCHECK(thread_checker_.CalledOnValidThread());
LOG(FATAL) << "Software rendering mode is not supported with GBM platform";
return nullptr;
}
scoped_ptr<SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget(
gfx::AcceleratedWidget widget) {
+ DCHECK(thread_checker_.CalledOnValidThread());
scoped_refptr<GbmDevice> gbm = GetGbmDevice(widget);
DCHECK(gbm);
@@ -147,6 +154,7 @@ scoped_ptr<SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget(
scoped_ptr<SurfaceOzoneEGL>
GbmSurfaceFactory::CreateSurfacelessEGLSurfaceForWidget(
gfx::AcceleratedWidget widget) {
+ DCHECK(thread_checker_.CalledOnValidThread());
if (!allow_surfaceless_)
return nullptr;
@@ -179,6 +187,7 @@ scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap(
OverlayCandidatesOzone* GbmSurfaceFactory::GetOverlayCandidates(
gfx::AcceleratedWidget w) {
+ DCHECK(thread_checker_.CalledOnValidThread());
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kOzoneTestSingleOverlaySupport))
return new SingleOverlay();
@@ -192,6 +201,7 @@ bool GbmSurfaceFactory::ScheduleOverlayPlane(
scoped_refptr<NativePixmap> buffer,
const gfx::Rect& display_bounds,
const gfx::RectF& crop_rect) {
+ DCHECK(thread_checker_.CalledOnValidThread());
scoped_refptr<GbmPixmap> pixmap = static_cast<GbmPixmap*>(buffer.get());
if (!pixmap.get()) {
LOG(ERROR) << "ScheduleOverlayPlane passed NULL buffer.";
@@ -209,10 +219,12 @@ bool GbmSurfaceFactory::ScheduleOverlayPlane(
}
bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() {
+ DCHECK(thread_checker_.CalledOnValidThread());
return allow_surfaceless_;
}
bool GbmSurfaceFactory::CanCreateNativePixmap(BufferUsage usage) {
+ DCHECK(thread_checker_.CalledOnValidThread());
switch (usage) {
case MAP:
return false;

Powered by Google App Engine
This is Rietveld 408576698