OSDN Git Service

Revert "i915: Add GBM_BO_USE_HW_VIDEO_DECODER use flag"
[android-x86/external-minigbm.git] / cros_gralloc / cros_gralloc_buffer.cc
index c84e21a..0301af1 100644 (file)
@@ -44,7 +44,8 @@ int32_t cros_gralloc_buffer::decrease_refcount()
        return --refcount_;
 }
 
-int32_t cros_gralloc_buffer::lock(uint32_t map_flags, uint8_t *addr[DRV_MAX_PLANES])
+int32_t cros_gralloc_buffer::lock(const struct rectangle *rect, uint32_t map_flags,
+                                 uint8_t *addr[DRV_MAX_PLANES])
 {
        void *vaddr = nullptr;
 
@@ -55,7 +56,7 @@ int32_t cros_gralloc_buffer::lock(uint32_t map_flags, uint8_t *addr[DRV_MAX_PLAN
         * just use the first kernel buffer.
         */
        if (drv_num_buffers_per_bo(bo_) != 1) {
-               cros_gralloc_error("Can only support one buffer per bo.");
+               drv_log("Can only support one buffer per bo.\n");
                return -EINVAL;
        }
 
@@ -64,12 +65,11 @@ int32_t cros_gralloc_buffer::lock(uint32_t map_flags, uint8_t *addr[DRV_MAX_PLAN
                        drv_bo_invalidate(bo_, lock_data_[0]);
                        vaddr = lock_data_[0]->vma->addr;
                } else {
-                       vaddr = drv_bo_map(bo_, 0, 0, drv_bo_get_width(bo_), drv_bo_get_height(bo_),
-                                          map_flags, &lock_data_[0], 0);
+                       vaddr = drv_bo_map(bo_, rect, map_flags, &lock_data_[0], 0);
                }
 
                if (vaddr == MAP_FAILED) {
-                       cros_gralloc_error("Mapping failed.");
+                       drv_log("Mapping failed.\n");
                        return -EFAULT;
                }
        }
@@ -84,13 +84,13 @@ int32_t cros_gralloc_buffer::lock(uint32_t map_flags, uint8_t *addr[DRV_MAX_PLAN
 int32_t cros_gralloc_buffer::unlock()
 {
        if (lockcount_ <= 0) {
-               cros_gralloc_error("Buffer was not locked.");
+               drv_log("Buffer was not locked.\n");
                return -EINVAL;
        }
 
        if (!--lockcount_) {
                if (lock_data_[0]) {
-                       drv_bo_unmap(bo_, lock_data_[0]);
+                       drv_bo_flush_or_unmap(bo_, lock_data_[0]);
                        lock_data_[0] = nullptr;
                }
        }