Chromium Code Reviews| Index: ui/ozone/platform/drm/gpu/drm_device.cc |
| diff --git a/ui/ozone/platform/drm/gpu/drm_device.cc b/ui/ozone/platform/drm/gpu/drm_device.cc |
| index 1df20c6c5d9ec1702cce442285d059911cf356f4..00d1adf7c2b957767acfa36dd87d538c109322ca 100644 |
| --- a/ui/ozone/platform/drm/gpu/drm_device.cc |
| +++ b/ui/ozone/platform/drm/gpu/drm_device.cc |
| @@ -220,23 +220,29 @@ bool SetBlobProperty(int fd, |
| const char* property_name, |
| unsigned char* data, |
| size_t length) { |
| - uint32_t blob_id; |
| + uint32_t blob_id = 0; |
| int res; |
| - res = CreatePropertyBlob(fd, data, length, &blob_id); |
| - if (res != 0) { |
| - LOG(ERROR) << "Error creating property blob: " << base::safe_strerror(res) |
| - << " for property " << property_name; |
| - return false; |
| + |
| + if (data) { |
| + res = CreatePropertyBlob(fd, data, length, &blob_id); |
| + if (res != 0) { |
| + LOG(ERROR) << "Error creating property blob: " << base::safe_strerror(res) |
| + << " for property " << property_name; |
| + return false; |
| + } |
| } |
| + |
| + bool success = false; |
| res = drmModeObjectSetProperty(fd, object_id, object_type, prop_id, blob_id); |
| if (res != 0) { |
| LOG(ERROR) << "Error updating property: " << base::safe_strerror(res) |
| << " for property " << property_name; |
| - DestroyPropertyBlob(fd, blob_id); |
| - return false; |
| + } else { |
| + success = true; |
| } |
| - DestroyPropertyBlob(fd, blob_id); |
| - return true; |
| + if (blob_id != 0) |
| + DestroyPropertyBlob(fd, blob_id); |
| + return success; |
| } |
| std::vector<GammaRampRGBEntry> ResampleLut( |
| @@ -728,11 +734,17 @@ bool DrmDevice::SetColorCorrection( |
| return false; |
| } |
| - ScopedDrmColorLutPtr degamma_blob_data = |
| - CreateLutBlob(ResampleLut(degamma_lut, degamma_lut_size)); |
| - ScopedDrmColorLutPtr gamma_blob_data = |
| - CreateLutBlob(ResampleLut(gamma_lut, gamma_lut_size)); |
| - ScopedDrmColorCtmPtr ctm_blob_data = CreateCTMBlob(correction_matrix); |
| + ScopedDrmColorLutPtr degamma_blob_data; |
| + if (!degamma_lut.empty()) { |
| + degamma_blob_data = |
| + CreateLutBlob(ResampleLut(degamma_lut, degamma_lut_size)); |
|
robert.bradford
2016/04/27 12:29:46
Is there any way to put this into CreateLutBlob/Cr
|
| + } |
| + ScopedDrmColorLutPtr gamma_blob_data; |
| + if (!gamma_lut.empty()) |
| + gamma_blob_data = CreateLutBlob(ResampleLut(gamma_lut, gamma_lut_size)); |
| + ScopedDrmColorCtmPtr ctm_blob_data; |
| + if (!correction_matrix.empty()) |
| + ctm_blob_data = CreateCTMBlob(correction_matrix); |
| for (uint32_t i = 0; i < crtc_props->count_props; ++i) { |
| ScopedDrmPropertyPtr property( |