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

Unified Diff: ui/ozone/platform/drm/gpu/gbm_buffer.cc

Issue 2761533002: ozone: Import multi-planar GBMs. (Closed)
Patch Set: LE not LT. Created 3 years, 9 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
« no previous file with comments | « ui/ozone/platform/drm/common/drm_util.cc ('k') | ui/ozone/platform/drm/gpu/gbm_buffer_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/gpu/gbm_buffer.cc
diff --git a/ui/ozone/platform/drm/gpu/gbm_buffer.cc b/ui/ozone/platform/drm/gpu/gbm_buffer.cc
index 5d4643411a6e5f0f9de70d737a2c51c0dc209e44..dff2d96b234c136d4bca99760c71942f79a5c67c 100644
--- a/ui/ozone/platform/drm/gpu/gbm_buffer.cc
+++ b/ui/ozone/platform/drm/gpu/gbm_buffer.cc
@@ -184,23 +184,27 @@ scoped_refptr<GbmBuffer> GbmBuffer::CreateBufferFromFds(
DCHECK_EQ(planes[0].offset, 0);
// Try to use scanout if supported.
- bool try_scanout =
- gbm_device_is_format_supported(
- gbm->device(), format, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING) &&
- (planes.size() == 1);
+ bool try_scanout = gbm_device_is_format_supported(
+ gbm->device(), format, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
gbm_bo* bo = nullptr;
if (try_scanout) {
- struct gbm_import_fd_data fd_data;
- fd_data.fd = fds[0].get();
+ struct gbm_import_fd_planar_data fd_data;
fd_data.width = size.width();
fd_data.height = size.height();
- fd_data.stride = planes[0].stride;
fd_data.format = format;
+ DCHECK_LE(planes.size(), 3u);
+ for (size_t i = 0; i < planes.size(); ++i) {
+ fd_data.fds[i] = fds[i < fds.size() ? i : 0].get();
+ fd_data.strides[i] = planes[i].stride;
+ fd_data.offsets[i] = planes[i].offset;
+ fd_data.format_modifiers[i] = planes[i].modifier;
+ }
+
// The fd passed to gbm_bo_import is not ref-counted and need to be
// kept open for the lifetime of the buffer.
- bo = gbm_bo_import(gbm->device(), GBM_BO_IMPORT_FD, &fd_data,
+ bo = gbm_bo_import(gbm->device(), GBM_BO_IMPORT_FD_PLANAR, &fd_data,
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
if (!bo) {
LOG(ERROR) << "nullptr returned from gbm_bo_import";
« no previous file with comments | « ui/ozone/platform/drm/common/drm_util.cc ('k') | ui/ozone/platform/drm/gpu/gbm_buffer_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698