JD9365 LCD glitch when rotating

Description

I had firsten 7” mustert yellow screen but that esp was not strong enough, it could also be a little bigger and was really a pcb with a screen attached.

So I bought this one and tried to transfer my lvgl code. That seems to have succeeded only I want the screen in landscape while it is always in portrait. I do find it odd that the background color does show up over the full page but then the content is in the wrong direction.

The info from the seller always sends me to the documentation but I can’t figure it out, I have also read in several places that I don’t control my LCD screen directly but via a driver.
What is going wrong?

Mvg. Christophe

What MCU/Processor/Board and compiler are you using?

I bought these 10,1-inch ESP32P4-ontwikkelbord ondersteunt Xiaozhi ESP32 C6 capacitief touchscreen - AliExpress 502

Display color 16.7M color
SKU Capacitance touch:JC8012P4A1C_I_W_Y
Size 10.1 inch
Type TFT
Driver chip JD9365
Resolution 800 * 1280(Pixel)
Effective display area 216.58 * 135.36(mm)
Module size 242.80 * 158.70(mm)
View IPS
Esp ESP32P4
Lcd jd9365 (i think)
Touch gsl3680 (i think)

What do you want to achieve?

So I want the contents of my screen to be in landscape mode and not portrait. There is a very small camera in it (which I disconnected), I want it to be at the top).

What have you tried so far?

I tried adjusting the my_disp_flush. Also flipped the screen size and tried to get both hardware and software rotate on it. Every time the screen glitches

Code to reproduce

#pragma GCC push_options
#pragma GCC optimize("O3")

#include <Arduino.h>
#include "lvgl.h"
#include "ui.h"
#include "pins_config.h"
#include "src/lcd/jd9365_lcd.h"
#include "src/touch/gsl3680_touch.h"

jd9365_lcd lcd = jd9365_lcd(LCD_RST);
gsl3680_touch touch = gsl3680_touch(TP_I2C_SDA, TP_I2C_SCL, TP_RST, TP_INT);

static lv_disp_draw_buf_t draw_buf;
static lv_color_t *buf;
static lv_color_t *buf1;

// 显示刷新
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
{
  const int offsetx1 = area->x1;
  const int offsetx2 = area->x2;
  const int offsety1 = area->y1;
  const int offsety2 = area->y2;
  lcd.lcd_draw_bitmap(offsetx1, offsety1, offsetx2 + 1, offsety2 + 1, &color_p->full);
  lv_disp_flush_ready(disp); // 告诉lvgl刷新完成
}

void setup()
{
  Serial.begin(115200);
  Serial.println("ESP32P4 MIPI DSI LVGL");
  lcd.begin();
  touch.begin();


  lv_init();
  size_t buffer_size = sizeof(int32_t) * LCD_H_RES * LCD_V_RES;
  //buf = (int32_t *)heap_caps_malloc(buffer_size, MALLOC_CAP_SPIRAM);
  //buf1 = (int32_t *)heap_caps_malloc(buffer_size, MALLOC_CAP_SPIRAM);
  buf = (lv_color_t *)heap_caps_malloc(buffer_size * 2, MALLOC_CAP_SPIRAM);
  buf1 = (lv_color_t *)heap_caps_malloc(buffer_size * 2, MALLOC_CAP_SPIRAM);
  assert(buf);
  assert(buf1);

  lv_disp_draw_buf_init(&draw_buf, buf, buf1, LCD_H_RES * LCD_V_RES);

  static lv_disp_drv_t disp_drv;
  /*Initialize the display*/
  lv_disp_drv_init(&disp_drv);
  disp_drv.hor_res = LCD_H_RES;
  disp_drv.ver_res = LCD_V_RES;
  disp_drv.flush_cb = my_disp_flush;
  disp_drv.draw_buf = &draw_buf;
  disp_drv.full_refresh = false;
  disp_drv.drv_update_cb = lvgl_port_update_callback;
  lv_disp_drv_register(&disp_drv);


  static lv_indev_drv_t indev_drv;
  lv_indev_drv_init(&indev_drv);
  indev_drv.type = LV_INDEV_TYPE_POINTER;
  indev_drv.read_cb = my_touchpad_read;
  lv_indev_drv_register(&indev_drv);

  //lv_disp_set_rotation(NULL, LV_DISP_ROT_270);
  

  Serial.println("About to call ui_init()");
  ui_init();
}

void loop()
{
  lv_timer_handler();  // LVGL laten draaien
    ui_tick();           // jouw eigen LVGL UI logica
  delay(5);
}

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.
This is what the screen looks like without modifications


When I try to rotate the screen it stays black or glitches this way

solution: Guition JC8012P4A1 · Issue #201 · esp-arduino-libs/ESP32_Display_Panel · GitHub