| 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";
|
|
|