e_hwc: add ARGB8888 to fallback format fo gbm_surface 19/295719/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Mon, 10 Jul 2023 11:59:30 +0000 (20:59 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Thu, 13 Jul 2023 01:24:15 +0000 (10:24 +0900)
Change-Id: I97b1ecb604582575ca39d1fae6e17e2dd7592a1d

src/bin/e_hwc.c
src/bin/e_hwc.h

index 22ec8e0..eca86b3 100644 (file)
@@ -227,7 +227,6 @@ _e_hwc_gbm_surface_alloc(void *data, int w, int h)
    E_Output *output = hwc->output;
    struct gbm_device *gdevice;
    struct gbm_surface *gsurface;
-   int format = GBM_FORMAT_ABGR8888;
 
    if (output->tdm_hwc)
      {
@@ -237,7 +236,7 @@ _e_hwc_gbm_surface_alloc(void *data, int w, int h)
         EINA_SAFETY_ON_NULL_RETURN_VAL(gdevice, NULL);
 
         gsurface = gbm_surface_create(gdevice, w, h,
-                                      format,
+                                      hwc->gbm_format,
                                       GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
         EINA_SAFETY_ON_NULL_RETURN_VAL(gsurface, NULL);
      }
@@ -250,9 +249,9 @@ _e_hwc_gbm_surface_alloc(void *data, int w, int h)
    hwc->gsurface = gsurface;
    hwc->gsurface_width = w;
    hwc->gsurface_height = h;
-   hwc->gsurface_format = format;
+   hwc->gsurface_format = hwc->gbm_format;
 
-   EHINF("The gbm_surface(%p, %dx%d) fmt(%c%c%c%c)is created.", hwc, gsurface, w, h, FOURCC_STR(format));
+   EHINF("The gbm_surface(%p, %dx%d) fmt(%c%c%c%c)is created.", hwc, gsurface, w, h, FOURCC_STR(hwc->gsurface_format));
 
    return (void *)gsurface;
 }
@@ -298,23 +297,33 @@ _e_hwc_ecore_evas_gbm_alloc(E_Hwc *hwc, int src_w, int src_h)
 {
    Ecore_Evas *ee;
    struct gbm_device *gdevice;
+   int gbm_formats[2] = {GBM_FORMAT_ABGR8888, GBM_FORMAT_ARGB8888};
+   int i, format_count;
 
    gdevice = e_comp_screen_gbm_device_get(e_comp->e_comp_screen);
    if (!gdevice) return NULL;
 
-   if (e_comp->avoid_afill)
-     {
-        ee = ecore_evas_tbm_native_allocfunc_new("gl_tbm_ES", gdevice, src_w, src_h,
-                                                 _e_hwc_gbm_surface_alloc,
-                                                 _e_hwc_gbm_surface_free,
-                                                 (void *)hwc);
-     }
-   else
+   format_count = sizeof(gbm_formats) / sizeof(int);
+   for (i = 0; i < format_count; i++)
      {
-        ee = ecore_evas_tbm_native_allocfunc_new("gl_tbm", gdevice, src_w, src_h,
-                                                 _e_hwc_gbm_surface_alloc,
-                                                 _e_hwc_gbm_surface_free,
-                                                 (void *)hwc);
+        hwc->gbm_format = gbm_formats[i];
+
+        if (e_comp->avoid_afill)
+          {
+             ee = ecore_evas_tbm_native_allocfunc_new("gl_tbm_ES", gdevice, src_w, src_h,
+                                                      _e_hwc_gbm_surface_alloc,
+                                                      _e_hwc_gbm_surface_free,
+                                                      (void *)hwc);
+          }
+        else
+          {
+             ee = ecore_evas_tbm_native_allocfunc_new("gl_tbm", gdevice, src_w, src_h,
+                                                      _e_hwc_gbm_surface_alloc,
+                                                      _e_hwc_gbm_surface_free,
+                                                      (void *)hwc);
+          }
+
+        if (ee) break;
      }
 
    EHINF("ecore_evas engine:gl_tbm with gbm ee:%p avaoid_afill:%d", hwc, ee, e_comp->avoid_afill);
index 94f22f2..be96bf7 100644 (file)
@@ -201,6 +201,8 @@ struct _E_Hwc
    Eina_List           *wins_commit_data_list;
 
    Eina_List           *sync_callback_list;
+
+   int                  gbm_format;
 };
 
 E_API extern int E_EVENT_HWC_ACTIVE;